Storing data: alternatives to Flash memory and SD card. (MKR1000)

Hello,

I am working on a project with an MKR1000 WiFi.

The idea is to use two ultrasonic sensors to detect if people pass through a doorway and keep count. The project involves sharing this number via telegram bot.

I use a watchdog to solve any eventual issues with the WiFi connection or with the Telegram server. Therefore I need to find a way to store the count number every time it changes to make the information survive the watchdog-triggered resets.

Possible solutions are:

  • Saving into flash memory. CONS: limited write cycles.

  • Using an SD card. CONS: it looks like an expensive solution to store just an integer number.

  • A webhook to save data into a server (for example into a google sheet). CONS: limited number of (free) requests to the server.

I am about to give up and accept the SD card solution.

But I wanted to check if anyone has a suggestion.

Thank you.

Maybe You could use 2 8 bit serial shift registers as memory. I assume that power will remain during the restart. However a powerfail will erase the data.

How about an RTC module with its own coin battery? I think they have a small amount of ram.

I am not familiar with shift registers, nor the RTC module.

I'll do some research and I'll come back if I have further questions.

Thank you very much for your inputs.

Hello.

In the end, I decided to use two CD4021BE shift registers in series (operating in serial-in serial-out mode).
I can now store a 2-byte number using just 3 digital pins (data in, data out, clock). I connected the latch pin to ground, as I am only using the serial mode.

It won't survive a loss of power, but that's outside the scope of my project.

Thank you for your help.

Nice to hear. It's almost a djungle fix but keeping things simple has its points. The RTC alternative even has battory backup covering a total loss of power. That could be a future alternative, if needed.