Arduino Uno timing accuracy?

Status
Not open for further replies.

MikeMl

Well-Known Member
Most Helpful Member
I have a periodic stream of pulses roughly 10ms between rising edges. I want to measure the period of the pulses. I am willing to take data for up to 10s (average of ~1000 periods) before computing the answer. What absolute accuracy can I expect considering the untrimmed 16MHz resonator and the millis() function in the Uno?
 
Using FreqMeasure your count of CPU cycles is expected to be 16k and over 1k samples is expect to be 16M. THe resolution is now greater than the Xtal accuracy of < 50 ppm which can be tuned or replaced with a 1ppm TCXO to determine your accuracy.
 
The Arduino does very poorly at measuring time, at least in my experience. The libraries are very bulky and waste a lot of time that is not taken into account. The millis() function alone is horrifically inaccurate. I would recommend either writing your own libraries and take the instruction timing into account (nearly impossible to do with C++), or use a bare micro (AVR, PIC) running Assembly (for most efficient code).
 
Millis is not that bad With a little testing you could hit time almost on the head. The ardunio's I have got crystals and playing with some code for time it was as good as my alarm clock it lost a sec or two a day.
 
Well you need a frequency counter with start stop lucky i have one. but you could detect a level rise with a gate and a level stop with a gate now to get to the count you need registers quite a few 10ms is long time
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…