I have analog signal coming from various sources at a very fast rate. Using hold circuit I have extended the signal duration for each channel to 10 microsecond without significant droop in other analog signals. Now I am trying to measure data from each analog input and store in PC in Excel file.
So far I have used analogRead() instruction to read the 6 channels on one board and stored them in Excel file using PLX-DAQ. But it is not fulfilling my purpose.
I want the ADC to trigger these signals in middle of hold output, do the conversion and send the data to PC for logging within this 10 us.
Kindly suggest a suitable way.
Thanks in advance.
Arduino's ADC can do about 10 points per millisecond. I've seen some others drop the ADC bit-width to 8 bit to make conversion faster. If you're looking at 100,000 reads per second, you need some other processors. Even if arduino can read that quickly, how is it supposed to send/store data at that rate?
Thanks for the reply.
I am successfully able to measure and read signal on Serial monitor every 600us per reading. The ADC prescaler reading was set to 4 and it was giving me fairly accurate reading.
Is it possible to some how read signals every 100us or so? Someone suggested me to utilize serial buffer. I don't know how to utilize buffer for storing and reading fast data?
Any help is appreciated.
Have you tried higher serial baud rate? Maybe your baud rate is choking your data rate.
Yeah, I tried higher baud rate. The Arduino IDE serial monitor allows a maximum upto 250000 bps. I used Teraterm to read at baud rate upto 921600 bps. But the result is same. I am not getting data any faster.
int triggerpin=7; // trigger input to start analog input reading
bool val = LOW;
ADCSRA &= ~(bit (ADPS0) | bit (ADPS1) | bit (ADPS2));
//ADCSRA |= bit (ADPS0); // prescaler 2
ADCSRA |= bit (ADPS1); // 4
//ADCSRA |= bit (ADPS0) | bit (ADPS1); // 8
//ADCSRA |= bit (ADPS2); // 16
//ADCSRA |= bit (ADPS0) | bit (ADPS2);
//ADCSRA |= bit (ADPS1) | bit (ADPS2);
//ADCSRA |= bit (ADPS0) | bit (ADPS1) | bit (ADPS2);
val = digitalRead(triggerpin);
if ( val == HIGH) // if trigger is present
float voltage = analogRead(A0)*5.0/1023;
//double voltage = analogRead(A0)*5.0/1023;
Serial.println("No trigger present");
You're limited by the Arduino a/d conversion rate. If you want to go faster, you'll need an external a/d.
There are loads available. You'll probably have to knock up a PCB.
You might want to consider using a due instead of the uno.
See this thread for further information.
Question: What does that 10 usec window mean? If it means that you want to read all 6 channels in that 10 usec window, you're out of luck. You might be able to do 3 in that window.
With a prescalar of 4, the ADC clock has a period of .25 usec. It needs 13 clocks per sample, putting you at 3.25 usec per sample. You will need at least another microsec delay after you change mux channel to let it settle down before conversion. So say 5 usec between conversions. It will take you 30 usec from start to end to read your 6 channels. The sample and hold circuit on the Arduino is only one channel, not 6. With a prescalar of 2, you might be able to shrink it down to 3 usec between conversions, for a total of 18 usec. Be aware that the higher sampling rates can be more noisy. You might want to consider dropping the 2 least significant bits and go with an 8 bit sample.
If you want to do 100,000 samples a second (total, not 6x100,000) you will need to transmit 200,000 bytes per second if you do 10 bit read. Dropping it down to an 8 bit sample cuts your transmission by half. If you can live with that kind of resolution, 115Kbaud might do it for you, but I'm not that experienced with serial.
My bad. I though that baud meant bytes per sec, not bits per sec. At 100,000 bytes per second, you will need 1 Mbaud (10 bits for every byte sent). Not going to happen with the UART.