Reading wheel encoders
April 11, 2013
I’m looking for an efficient way to read wheel-encoders and have read a bunch of articles on the subject.
Including OddBots very fine article: http://letsmakerobots.com/node/24031.
My first idea was to use an old pc mouse utilizing ps/2 library with arduino. I made some mechanical parts to let mouse encoder shafts read the rotations of the wheels.
I hooked everything up. Run some ps/2 example code. Uploaded it to the Arduino and waited to see all the readings. Nothing happened. After having an extra look at the PS/2 mouse, I found that it was dead. A lesson learnt: Check that whatever you at going to use is functioning from a start.
I did not want to waste all the good work I already had done. My first thought was to read the mechanical encoder from the mouse. I made some readings, but the signal from one channel was too lousy to make any sense. Now I want to rebuild the encoder and use CNY70 sensors instead. I will glue an encoder disk on the existing disk. This way I will get 2.4 counts per cm the robot travels.
I looked in my IC drawer and found some SIPO registers, a 16bit I2C IO-expander and some AtTiny85 and got this idea:
ATtiny are going to use transition interrupts on both cannels to count both up and down transitions. When requested, ATtiny will deliver the number of count and direction to the shift register. The parallel outputs from the register are read by the IO expander. Finaly my Arduino will read the numbers using I2C.
But before I'm going til solder all theese componets on a pcb, I would like some clever opinions from my fellow LMRians. Is it at all possible to do it this way?