readme.md: update section SD card

This commit is contained in:
cyberman54 2022-01-31 11:03:22 +01:00
parent a4133d6e0a
commit e6f4e26d73

View File

@ -218,7 +218,7 @@ This describes how to set up a mobile PaxCounter:<br> Follow all steps so far fo
# SD-card # SD-card
Data can be stored on an SD-card if one is availabe. Simply choose the file in src/hal and add the following lines to your hal-file: Data can be stored on an SD-card if the board has SD-card slot. To enable this feature, specify the board's SD interface and it's pins in the board's hal file (src/hal/<board.h>):
#define HAS_SDCARD 1 // SD-card-reader/writer, using SPI interface #define HAS_SDCARD 1 // SD-card-reader/writer, using SPI interface
OR OR
@ -230,30 +230,21 @@ Data can be stored on an SD-card if one is availabe. Simply choose the file in s
#define SDCARD_MISO (2) #define SDCARD_MISO (2)
#define SDCARD_SCLK (14) #define SDCARD_SCLK (14)
Please choose the correct number for the connection of the reader/writer.
This is an example of a board with SD-card: https://www.aliexpress.com/item/32990008126.html This is an example of a board with SD-card: https://www.aliexpress.com/item/32990008126.html
In this case you take the file src/hal/ttgov21new.h and add the lines given above (numbers given are for this board). For this board use file src/hal/ttgov21new.h and add the lines given above.
Another approach would be this tiny board: https://www.aliexpress.com/item/32424558182.html (needs 5V). Another approach would be this tiny board: https://www.aliexpress.com/item/32424558182.html (needs 5V).
In this case you choose the correct file for your ESP32-board in the src/hal-directory and add the lines given above to the correct h-file. Please correct the numbers given in the example to the numbers used corresponding to your wiring. In this case you choose the correct file for your ESP32-board in the src/hal-directory and add the lines given above to the correct h-file. Please correct the numbers given in the example to the numbers used corresponding to your wiring.
Some hints: Data is written to a single file and after 3 write-operations the data is flushed to the disk to minimize flash write cycles. Thus, up to the last 3 records of data will get lost when the PAXCOUNTER looses power.
These cheap devices often handle SD-cards up to 32GB, not bigger ones. They can handle files in the old DOS-way, to say the filenames are in the 8.3-format. And they often cannot handle subdirectories.
The software included here writes data in a file named PAXCOUNT.xx, where xx can range from 00 to 99. The software starts with 00, checks to see if such a file already exists and if yes it will continue with the next number (up to 99 - in this case it will return no sd-card). So an existing file will not be overwritten. Format of the file is CSV, thus easy import in LibreOffice, Excel, Influx, etc. Each record contains timestamp (ISO8601), paxcount (wifi and ble) and battery voltage (optional). Voltage is logged, if the device has a battery voltage sensor (to be configure in board hal file).
The data is written to the card and after 3 write-operations the data is flushed to the disk. Thus, up to the last 3 records of data will get lost when the PAXCOUNTER looses power.
And finally: this is the data written to the disk:
timestamp,wifi,ble[,voltage] timestamp,wifi,ble[,voltage]
2022-01-28T19:36:35Z,17,48 2022-01-30T21:12:41Z,11,25[,4100]
2022-01-28T19:37:35Z,21,52 2022-01-30T21:14:24Z,10,21[,4070]
2022-01-28T19:38:35Z,14,49 2022-01-30T21:16:08Z,12,26[,4102]
2022-01-30T21:17:52Z,11,26[,4076]
Format of the data is CSV, timestamp is ISO8601, which can easily imported into LibreOffice, Excel, Influx, etc.
Voltage is logged, if the device has a battery voltage sensor (to be configure in board hal file).
If you want to change this please look into src/sdcard.cpp and include/sdcard.h. If you want to change this please look into src/sdcard.cpp and include/sdcard.h.