Jump to content
Sign in to follow this  
Hitoshi

Faster analogread ?

Recommended Posts

Hi, I'm using Arduino IDE on my pcDuino v1

I'm a beginner with Arduino boards or pcDuino, I would like to record signals on sd card or usb key for example.

My program works but I would like to increase the data capture frequency and the function "analogRead" is a little too slow.

I tried to read on /proc/adc5 without using analogRead but I got the same time.

 

For one capture (+ write on buffer) I get an average of 21-24µs with a data capture frequency of 10 kHz

 

Do you know a method to get faster values ?

 

Thanks.

Share this post


Link to post
Share on other sites

Without looking at the code I can not say for sure but I am guessing that you are trying to sample, write, sample, write. The file save is likely slowing you down.

 

Try writing a test program that samples and saves to an array. Record the time, then do 10,000 samples or more, and when done record the time again. I was able to achieve higher results then that using a python script so I know a compiled C program will do better.

 

I don't know what your expectations are for sampling speed but you must remember that there is a full OS between you and the metal and it will not be as fast as without the OS. 

Share this post


Link to post
Share on other sites

Hi, thank you for your answer.

Finally I chose Arduino Due, results are more accurate (no full OS in background) and analogRead is faster than on pcDuino

The only problem is the speed for writing values on SD card (with a SD shield), with high data capture frequency (20 kHz), the buffer is full in about 1 second and after for writing the buffer it takes 190ms

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×