Need to make a datalogger that can sample at 100Ksps

I am looking to collect 1 analog signal quickly thru the analog pin of an Arduino Uno between a voltage range of 0-500mV. I am looking to collect at a rate of 100Ksps. I looked thru the forum and have learned that storing the data may be an issue. For what I am looking for my math shows that I need 200KB of space over a 5 second time period(if someone can confirm my math please) which is more then the 2KB of SRAM space the Arduino Uno has. I made a sketch to see how fast I can collect data with the arduino itself and I am only getting 8932sps while writing it to the serial monitor which is not enough, I have tried it already(below is my sketch). From what I have researched I may be looking to get an MCP3008 ADC which collects at 200Ksps. Also do I need to look into learning about pre-scalers to improve performance? Looking for some direction here, I done as much as I can with what I know.

int time1;
int counter;
int value;

void setup() {
  Serial.begin(115200);
  time1=millis();
  while((millis()-time1)<1000){
    value=analogRead(A0);
    counter+=1;
    }
  Serial.println(counter);
}

void loop() {
  }

That's about 10ksps

for sampling at this speed I would use a raspberry pi - have a look at raspberry-pi-analog-to-digital-converters/mcp3008
Programming in Java I have created 10mByte arrays on a pi without any problems
be worth going onto the raspberry pi forum and asking for advice

1 Like

The Arduino UNO ADC can be pushed to about 79 ksps if you don't need all 10 bits of resolution. You still need some place to store the data at that rate.

To get any faster speed you would have to push the ADC beyond its published limits or use an external ADC.

5 seconds of 100,000 samples per second is 500,000 samples. If you are fitting that into 200,000 bytes that's only 3.2 bits per sample. I think your calculation is off somewhere. Figure 500 KB for 8-bit samples.

Yes, I forgot to mention what I get with that sketch. I get about 9ksps.

For 500,000 samples at 10 bits per sample. Would I multiply 500,000 by 1.25 bytes? or do you round up to 2 bytes? Can you do fractional bytes?

Any alternatives to raspberry pie's? They are currently like $250 off Amazon right now compared to when they were normally $40. Teensy? I have never programed one but they are more readily available and better priced. What performance specifications are the most important for my situation.

have you tried the pi shop?

How about a Teensy?

Pi Shop is all out of stock

Yes teensy boards are available to buy. Is that a good option to do what I am trying to do? I have never dealt with them but I can learn. Does teensy go more into the world of embedded systems?

I would not, because the raspberry pi is not real time. It is Linux preemptive multitasking and so it can not sample at that speed over that time period.

For sampling a signal at a constant rate it is next to useless.

However if the OP were to use a sound card on the Pi or his own computer then download the free app Audacity, that will allow the reading of a signal and the display and storage of the resulting sound file.

Teensy's are an excellent option and are well supported. If you go to the Teensy website you will find a link to their Forum.

There are several threads about high speed adc readings and your 100KBPS certainly seems achievable on a Teensy. You should be able to get assistance with your project through the Teensy forum.

2 Likes

would an ESP32 with ADC using DMA meet requirements? online information is very vauge
possible using DMA and double buffering upload results to server using WiFi or ESP-NOW?

  • To log at high rates you need something like this Teensy program that logs an ADC as text at 25,000 samples per second.

I have logged at over 1,000,000 samples per second with DMA ADC in binary on a Teensy.*

3 Likes

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.