Reading multiple analog sensors quickly and storing to SD card

Hi everyone! New to the Particle community and hoping to get a good push in the right direction. I am looking to do the following:

Read 1 analog sensor at 500+ksps 12+ bit resolution (differential signal)
Read 5 analog sensors at 1ksps 12+ bit resolution (single-ended input)
Read 1 analog sensor with 3 separate analog output channels at 20ksps 12+ bit resolution (single-ended inputs)
Read 1 SPI sensor at 20ksps (has onboard FIFO of 512 bytes)

After triggering, data will be recorded for 50ms

The application is shock detection and requires that data from all sensors be time synced to each other. The sensors read constantly, and upon a shock event, the data (including the shock) must be stored (this likely forces the use of a circular buffer?). The data must be stored on an SD card after an event has occurred and the data will then be transmitted from the SD card to a receiver later. I know that there is no way to read all of those channels simultaneously with just the Particle’s ADCs, let alone wait for the massive write-time an SD card takes. I have been down the Google rabbit hole and come across solutions involving everything from circular buffers to FPGAs so the processor doesn’t have to get tied up doing “read-read-read”. As I have never implemented buffers or even attempted HDL programming, I was hoping to get suggestions before I embark on a journey. Anyone know of / have any similar projects that I might use as a guideline?

Hardware I’ve considered:

For the 8 single-ended inputs: MAX11047-59
For the 1 differential input: Bridge Amplifier coupled with ADS7279

TL;DR:

Read 9 analog and 1 digital sensors at relatively high speed and resolution for 50ms --> store data to SD card --> later send SD card data wirelessly to a receiver.

@zipf, that is some serious data sampling! Given that this is for shock detection, is using an SD card that sits in a mechanical socket a reliable way to store data?

The system you are proposing is like a digital storage oscilloscope with a predefined trigger. Much like higher speed logic analyzers and scopes, you WILL need an FPGA or other dedicated device to capture directly to RAM and provide an interface to the photon (possibly SPI) to read that data for transmission. The number of sensors which must be read simultaneously or at least in a coordinated fashion is the big challenge. You could consider a dedicated processor like an STM32F4 or F7 class processor with “bare metal” programming to capture data. A full analysis of your requirements including timing is needed to pick the correct solution.

1 Like