lbernstone / rrdtool_ESP32

Port of rrdtool (https://oss.oetiker.ch/rrdtool/) to ESP32
GNU General Public License v2.0
12 stars 0 forks source link

RRDTOOL and SD card #4

Closed rrobinet closed 2 years ago

rrobinet commented 2 years ago

Hi, Do think it is possible to use the SD card file system rather than the FFAT one. Thanks in advance Robert

lbernstone commented 2 years ago

Yes. It should be very straightforward to convert the basicDB example to SD. If you can use psram, I'd suggest the psramDB as a much more reliable method, since the data is all stored internally, and backed up to the "disk", it will be more robust in case of a sd card ejection.

rrobinet commented 2 years ago

Thanks for your answer, My first concern was about the speed of a SD card with is far less than memory access. I would like to use an ESP32 as a lightweight web server rather than a Raspberrypi, this to collect store an report on long period MQTT data collected by remote sensors (typically temperature) I will try first to ... understand (not actually straight forward for me) and then convert the basicDB using an SD card. I believe it is not just replacing

include FFAT.h

by:

include "FS.h"

include "SD.h"

include "SPI.h"

I am using a WEMOS LOLIN32 without Psram. If I am successful I will come back with my findings. Robert

lbernstone commented 2 years ago

Generating the fake data may be slow. Using the rrd normally, where you are inserting a single data point once a minute will have no speed problems.

rrobinet commented 2 years ago

@lbernstone I just had a look of how to modify the code for a SD card, this is more simple that its look!. Please find the code attached. The test is done with a Wemos LOLIN32 v1.0 (retired) with default settings. Using a Class 4 SD Card (4 MBytes/sec). Create the fake data took +/- 9 minutes on a "ShengYang Micro SD Storage Expansion Board Mini Micro SD TF Card Memory Shield Module With Pins for Arduino" (see https://www.aliexpress.com/item/32867572635.html?spm=a2g0o.order_list.0.0.6d751802kBfyua) So the real stuff may begin, i.e., recording my BME280 sensor data. Many thanks for this RRDTool port to ESP32 Robert basicDB_SD.zip