SPIFash Cycles and Wear

I am building a unit that pulls the temperature data from 60 sensors and needs to send it one way or another to a central node eventually to be sent to an online database.

I was thinking that rather than chew up power I would record the sensor data over say 5 minutes then store it on the SPI Flash. every 5 minutes the commmunications routine would kick in and send the data to the core system.

Having not used SPI Flash I am wondering that the write cycles are? Given that each time I collect the data (every 30 seconds) it consumes about 500 bytes. Breaking that down over how many writes in a year is going to be quite high so wondering if i shouild not instead add a CF device rather than relying on the SPI Flash.

Any sugestions for this?

Firstly, let’s simply calculate:

  • 60 sensors;
  • Assume that each sensor’s data is 10 bytes;
  • Collecting and storing data every 5 minutes;

Every day, you will receive (24 * 60 / 5) * 60 * 10 = 172800 Bytes data.

The Wireless Stick has 4M-bytes FLASH. But the 4M also used for the bootloader, partition map, user code, etc. It can’t be all used for storing data. Assume you have 2M-bytes flash size to use, it means the system can run last up to 2000000 / 172800 = 11.57 days.

I think this is obviously unreasonable. Why not use a micro TF card? Here is a simple example of TF card:

I should have mentined that the units only need to store the data collected during the low power phase and then every 30 mins upload the data to the main node that will have a TF card as well then the node can clear/overwrite the data stored.
However I am thinking that a TF card could be wirth adding to the nodes as well.

I think i just found a reason why I cant use a TF or CF card.
The Wireless Shell module is already using the pins for the Lora module.

GPIO19 = LoRa_miso
GPIO18 = LoRa_CS
GPIO23 = (free)
GPIO5 = LoRa_SCK

The CF library uses
GPIO19 = miso
GPIO18 = clk
GPIO23 = mosi
GPIO5 = cs

How well will the LoRa radio work when it is sharing the miso/mosi with anothe device?
I guess the other option could be to use SoftSPI however i can see a few issues with that in the long run.

I think you don’t nee use the software SPI, it’s very slow and spend a lot system source.

Share a SPI bus with LoRa or CF are completely OK! Just use a different CS pin.

Thank you, I will try that.
SoftSPI seemed to work OK on pins 39, 12, 23 and 9 but would be nice to free up those pins for other things and share the LoRa SPI.