I am working on a project that involves raspberry pi and the accelerometer sensor ADXL355. The raspberry's responsibility is to fetch the data from the sensor, filter only useful data and publish it to a thingsboard.io instance on the cloud. All the different devices are powered by a battery, charged by a solar panel and monitored by the Raspberry.
As of now this is my setup:
This setup works fine but I would like to add more reliability on fetching data. It is vital to me that every single datapoint is fetched and processed. This set up doesn't allow me to operate safely on the linux os without possibly interfere with the process of fetching data. I would like to be able to restart the raspberry without losing data.
The sensor offers a fifo buffer functionality: it will save in an internal buffer up to 32 (xyz) datapoints, but considering that the sampling rate could go up to 1KHz, that leaves me with a 32 milliseconds buffer, which is nowhere close to enough to sustain a possible deploy of a new firmware or reboot of the OS of the Raspberry.
Sometimes (even though I applied the RT patch) and set the priority of the program that fetches data to the highest possible, I see intervals of up to 18ms before the program gets its context back (from some kernel interrupt routine I assume?), I'm worried that it could happen that the interval gets bigger than the 32 ms buffer that I have and potentially lose data.
What I wanted to know is what are the best practices regarding decoupling data fetch from the transmission and processing of said data?
What I thought about was to move the sensor in a dedicated Arduino board, which runs a bare metal firmware with as little responsibilities as possible fetching the data, assigning a timestamp, saving the data.
With this approach I wouldn't know to access the buffer without interfering with the program which is fetching the data. Is there any specific component that solves my problem? Like some sort of memory component that can be accessed simultaneously by different "users"? This buffer should be able to save at least up to 1GB worth of data to make up for a possible downtime window of 24 hours.