One of the big issues with a datalogger is long-term data storage,
A SD card has a very large power consumption (300mA), when comparing with a flash memory (25mA), and needs a power up time of about 250 ms, whereas a flash memory needs about 5 ms.
Sure, you can make the SD card sleep, but it's still very power consuming (350uA), and flash memory is still a more acceptable option (1uA).
Since we would like to read 10 channels (12 bits), like the STM32F103 (Blue Pill), and 1 bit to mark each reading made (index), so that uC can go to deep sleep, here are some basic calculations for W25Q128, W25Q64, W25Q80:
(Note that the minimum allowable erasure block forces incomplete memory usage to achieve independence between channels)
Unfortunately, regulators have made a big mess with memory units, so we should not confuse MB with MiB (GB with GiB etc):
KiB = 1024 Bytes
MiB = 1024 x 1024 Bytes
W25Q128
Total capacity: 128 Mits (16 MiB)
16x1024 KiB = 16384 KiB
Minimum eraseble amount (block): 4 KiB (16 pages of 256 Bytes)Data requiriments:
10 labels: 4 KiB per label (4096 characteres)
- 40 KiB for labels
10 index progress: 1 bit per readMemory statistics for W25Q128:
- 124 KiB (31 blocks of 4 KiB) per channel for index: 124x 1024 x8 = 1015808 bits (maximum readings: 1015808)
- 10x 124 KiB for total index: 1240 KiB
1 channel read: 12 bits
10 channels read: 120 bits (15 Bytes)- 1015808 data (readdings): 1015808 x 120 bits = 121896960 bits = 15237120 Byte = 14880 KiB = 14.54 MiB
- 7200 KiB / 4 KiB = 28800 blocks (460800 pages)
Total usage:
- index: 1240 KiB
- label: 40 KiB
- data: 14880 KiB
-- Total: 16160 KiB (maximum: 16384 KiB)
--- Memory free: 224 KiB (Over flow: 0 KiB)1015808 readings:
- 1 read per minute: 1015808 / 1440 (day) = 705.42 days = 1.93 year
- 1 read per seconds: 1015808 / 86400 (day) = 11.75 days
W25Q64
Total capacity: 64 Mits (8 MiB)
8x1024 KiB = 8192 KiB
Minimum eraseble amount (block): 4 KiB (16 pages of 256 Bytes)Memory statistics for W25Q64:
- 60 KiB (15 blocks of 4 KiB) per channel for index: 60x 1024 x8 = 491520 bits (maximum readings: 491520)
- 10x 60 KiB for total index: 600 KiB
1 channel read: 12 bits
10 channels read: 120 bits (15 Bytes)- 491520 data (readdings): 491520 x 120 bits = 58982400 bits = 7372800 Byte = 7200 KiB = 7.03125 MiB
- 7200 KiB / 4 KiB = 28800 blocks (460800 pages)
Total usage:
- index: 600 KiB
- label: 40 KiB
- data: 7200 KiB
-- Total: 7840 KiB (maximum: 8192 KiB)
--- Memory free: 352 KiB (Over flow: 0 KiB)491520 readings:
- 1 read per minute: 491520 / 1440 (day) = 341.33 days
- 1 read per seconds: 491520 / 86400 (day) = 5.68 days
W25Q80
Total capacity: 8 Mits (1 MiB)
1024 KiB
Minimum eraseble amount (block): 4 KiB (16 pages of 256 Bytes)Memory statistics for W25Q80:
- 8 KiB (2 blocks of 4 KiB) per channel for index: 8x 1024 x8 = 65536 bits (maximum readings: 65536)
- 10x 8 KiB for total index: 80 KiB
1 channel read: 12 bits
10 channels read: 120 bits (15 Bytes)- 65536 data (readdings): 65536 x 120 bits = 7864320 bits = 983040 Byte = 960 KiB
- 960 KiB / 4 KiB = 240 blocks (3840 pages)
Total usage:
- index: 80 KiB
- label: 40 KiB
- data: 960 KiB
-- Total: 1080 KiB (maximum: 1024 KiB)
--- Memory free: 0 KiB (Over flow: 56 KiB)Total memory: 1024 KiB
- index: 80 KiB
- label: 40 KiB
-- Total: 120 KiB (maximum: 1024 KiB)
--- Memory free: 904 KiB (Over flow: 0 KiB)904 KiB = 904 x 1024 = 925696 Bytes = 7405568 bits = 7405568 bits / 120 bits (per readding) = 61713 readdings maximum
61713 readings:
- 1 read per minute: 61713 / 1440 (day) = 42.85 days
- 1 read per seconds: 61713 / 86400 (day) = 0.71 day
SanDisk microSD - OEM Product Manual - datasheet
W25Q128FV - datasheet (similar to other W25Q64 and W25Q80, but different capacity)