Reading wheel encoders

Hi folks

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: https://www.robotshop.com/letsmakerobots/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.

mehcs.jpg

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.

encoderdisk.jpg

I looked in my IC drawer and found some SIPO registers, a 16bit I2C IO-expander and some AtTiny85 and got this idea:

 

encoder.png

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? 

I am curious

Why do you have the Serial to Parallel to Serial conversion in there at all? Why don’t you just have the arduino talk to the ATtiny85 directly?

** I would love to use a**

 

I would love to use a solution without too many components.

I think I got two reasons for what I came up with.

I’m afraid of running low on digital pins. I have to connect two encoders. For software serial I should then use 4 digital pins. The Arduino will be talking to a Linux PC on the robot, so pin D0 and D1 are not free. D2-D5 are used for two motors (pwm and direction). Ok I still got some digital pins.

Then I want to minimize the time the Arduino should use on communication. IC2 are already used on compass and ultrasonic rangers. I have never done at robot at this scale before. I want Arduino to control the speed of the motors by encoder readings that is corrected by the compass. I’m not sure what this requires of the Arduino.

Maybe the true reason is that was short of ideas.

Can ATtiny85 be an I2C slave?

 

Thank you Stephen and

Thank you Stephen and birdmun for making me start using the inside of my head.

I made me search for the right stuff. Look what I found:

http://playground.arduino.cc/Code/USIi2c

Thanks again.

Allan