Arduino Forum

Topics => Science and Measurement => Topic started by: matthewadkinsee on Sep 20, 2016, 04:46 pm

Title: {Answered} Precision of digital inputs of Arduino Uno
Post by: matthewadkinsee on Sep 20, 2016, 04:46 pm
I am looking to use an encoder (such as something from https://ecatalog.dynapar.com/ecatalog/incremental-encoders/en/flt=1111/Optical)  and have an Arduino Uno (or other if suggested for better performance) process the data which my c# program will then poll for.  What I am wondering is "What is the precision of an Arduino Uno's digital inputs"?  In other words, will the digital inputs handle 1000 pulses/sec, 100 pulses/sec, 10 pulses/sec???  Obviously the more the merrier.

I have contacted Arduino support and they didn't have anything in way of a datasheet, so I can understand if no one out there can give me exacts, but at this point I'll take personal experiences over nothing at all.

As stated above, if the Uno isn't the best option then I will take suggestions.

p.s. If you could also tell me which encoder you use/recommend that would also be appreciated.

Thank you.
Title: Re: Precision of digital inputs of Arduino Uno
Post by: CrossRoads on Sep 20, 2016, 05:06 pm
Inputs can be read really quickly - 1000 pulses per second is change in level (for a square wave) every 500uS. 2000 clock cycles at 16 MHz. It takes a couple microseconds to process an interrupt, say 8 uS, so a rate 50-60x that could be managed even (depending on what your code does of course).
The Atmega328P or whatever microcontroller datasheet  that you are using is what you need to review.
http://www.atmel.com/products/microcontrollers/avr/megaAVR.aspx (http://www.atmel.com/products/microcontrollers/avr/megaAVR.aspx)
Title: Re: Precision of digital inputs of Arduino Uno
Post by: cattledog on Sep 20, 2016, 07:31 pm
Quote
In other words, will the digital inputs handle 1000 pulses/sec, 100 pulses/sec, 10 pulses/sec???  Obviously the more the merrier.
I have been able to benchmark quadrature encoder reading with a 16MHz Arduino Uno at around 95K counts per second. The program is not doing anything else except processing the interrupts from the encoder.

To get faster than that you will need external hardware or a faster processor.

What is your application?
Title: Re: Precision of digital inputs of Arduino Uno
Post by: matthewadkinsee on Sep 20, 2016, 09:34 pm
95k counts per second  :o

That is more than accurate enough for my purposes.  I haven't purchased an Arduino Uno yet but will do so now that I have that info.

My c# application includes mapping events in a conveyor belt (several thousand meters long).  I will be polling the Arduino for the current number of pulses (0 to some number) to determine speed and location.

Thanks for the answers!
Title: Re: {Answered} Precision of digital inputs of Arduino Uno
Post by: cedarlakeinstruments on Oct 03, 2016, 03:15 pm
FYI in case you decide to shortcut the process and go with something off the shelf, we make pulse counters with serial interfaces. They are mainly used to read flowmeters, but will take generic digital inputs: http://www.cedarlakeinstruments.com/blog/products/rs232-serial-pulse-counter
Title: Re: {Answered} Precision of digital inputs of Arduino Uno
Post by: MarkT on Oct 22, 2016, 02:22 pm
FYI in case you decide to shortcut the process and go with something off the shelf, we make pulse counters with serial interfaces. They are mainly used to read flowmeters, but will take generic digital inputs: http://www.cedarlakeinstruments.com/blog/products/rs232-serial-pulse-counter

That's not a quadrature encoder unit, so it won't work with changes of direction, which in practice
means it won't keep accurate position in any motion control system with backlash.

I'm not sure advertising is allowed on this forum - moderators?