siara-cc / sqlite_micro_logger_arduino

Fast and Lean Sqlite database logger for Arduino UNO and above
Apache License 2.0
169 stars 29 forks source link

How to use it with ESP8266 #1

Open happytm opened 4 years ago

happytm commented 4 years ago

Hi Arun,

Thank you for creating excellent Database for micro controllers. I am working on small standalone IOT network and I was looking for local data storage solution for my project. I have 1 master esp8266 device collecting sensor data from multiple slave esp8266 devices and I would like to store these data to spiffs on master device.The data received by master from each slave is always a 6 byte array.There are always 3 arrays received from each slave device within 60 milliseconds. The array received is in following order & format:

array 1 - Sensor Types Format - {36:06:16:26:36:46} where 36 is slave device ID and 06 means sensor type is voltage,16 means sensor type is temperature, 26 means sensor type is humidity and so on.

array 2 - sensor values Format - {36:33:70:55:925:60} where 36 is slave device ID and 33 is voltage(3.3V),70 is teperature in F, 55 is humidity inpercentage etc.

array 3 - device status Format - {36:36:07:05:01:60} where 36 is slave device ID and 36 is last byte of device IP,07 is wifi channel number, 05 is sleep time for slave device etc.

My code is at following links:

Master - https://github.com/happytm/BatteryNode/blob/master/ProbeReceiver.ino Slave - https://github.com/happytm/BatteryNode/blob/master/ProbeSender.ino

My goal is to store all these data in spiffs by device ID and time it is received by master device.

I tried to figure out how to implement this but was not successful.

Also I wanted to overwrite spiffs data file when it is almost full (3 MB).

Please help me.

Thanks

siara-cc commented 4 years ago

Sorry I saw this message only now. Also, I won't be able to help with integrating this with your code, please check out examples given.

Also I wanted to overwrite spiffs data file when it is almost full (3 MB).

This is in my plan - to have a rolling db that keeps recording for ever. But so far I have not found the time.