How advisable is data logging to CIRCUITPY?

For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
kevinjwalters
 
Posts: 1025
Joined: Sun Oct 01, 2017 3:15 pm

How advisable is data logging to CIRCUITPY?

Post by kevinjwalters »

I've been doing my first bit of data logging recently on a CLUE and CIRCUITPY was an obvious, easy choice for storage. I've realised I might be at risk of wearing out the flash. I've been writing 80 bytes at a time and using flush() to ensure they persist immediately. I've probably done this (see code below) every 10 seconds for about 6000 data lines. Am I at risk of trashing my CLUE?

Code: Select all

data_file.write(out_text.encode(encoding) + end)  # 80 bytes of data
data_file.flush()
Will the lifetime be extended without the flush()? Should I buffer data inside my app and write it in certain block sizes to maximise the life of flash?

User avatar
danhalbert
 
Posts: 4655
Joined: Tue Aug 08, 2017 12:37 pm

Re: How advisable is data logging to CIRCUITPY?

Post by danhalbert »

The flush is going to happen after a few seconds or less in any case, probably before 10 seconds has elapsed.

The flash lifetime for that kind of flash is often quoted as > 100k cycles. So in 24 hours at 10 seconds/cycle, you would be writing 8640 times, which is a significant fraction of 100k. So buffering sounds like a good idea. Or consider using an SD card, which does wear leveling.

Locked
Please be positive and constructive with your questions and comments.

Return to “CLUE Board”