I'm sorry if this has been asked before - if so I haven't been able to find it.
Can someone give me some advise (and/or education) on how you go about reading a very high speed encoder. Maybe i'm wrong but it doesn't seem possible for an AVR to directly read the encoder of a typical servo motor. As an example i've got a used servo motor purchased off of ebay (~$5) that according to mfg specs does 10000 rpm and has a 2000 count optical encoder attached. So in quadrature that's 8000ct per rev * 10000/min / 60 secs/min = ~1.3million pulses/second... it might be possible (although very unlikely I think) on an Arduino if the code does nothing more than counts pulses on an interrupt but with any kindof code at all I'd assume it wouldn't be possible at all.
I'm hoping to have enough execution time in the arduino to implement PID (i'll just be using a preexisting PID library - not reinventing the wheel). In order to make this work, therefore, I'm assuming that i'll need an external component to handle the encoder pulses. I Would appreciate info on how to do this.
It depends on how often you want to read the information but you can always use hardware like this:- http://www.thebox.myzen.co.uk/Workshop/Rotary_Max.html
and read the output of the counter into the arduino. If the counter is endanger of overflowing before you read it you can always cascade several to give you more capacity.
I'd be suspicious of that 10,000 RPM number. That's often quoted as no-load speed of DC motors but with any load on them the speed slows right down.
If you ignore the quadrature and only use one of the encoder lines (foregoing direction information) you're cutting the counts/rev in two. Maybe that's slow enough to handle with an AVR.
Otherwise you're right, 1.3million pps is way too fast for a device operating at 20 MHz.
--
The Quick Shield: breakout all 28 pins to quick-connect terminals
you guys are all right in that I don't need anywhere near that kind of speed or resolution at the arduino. but from just some basic experimentation 100k-200k on an interrupt pretty much consumed the arduino and left me with no time to run PID code. When I added PID algorithm into the equation the maximum I could see without missing steps was less than 100K. I have started experimenting with just putting the interrupt on one pin instead of both and then reading both pins to determine direction.
i'll have to look into pre-scaler's - not familiar.
I have found a few single chip solutions for this since I started looking - the best/easiest seems to be the avago HCTL-2032-SC but its pretty pricy at ~$10 in single qtys from mouser - it does support two encoders on a single IC though..