Common practice question. How are readings from discrete quadrature encoders usually supplied?

I’m making some quadrature encoders to capture information from the wheels of my robot and return them to the Arduino Due which is controlling the motors.

I’m using ATTiny85s to do the reading of the rotor signals, which will be slaves on an I2C bus.

I have all this working, but had a question about how this problem is normally solved, specifically what information to return from the slaves to the master.

My goal is to have speed control over the robot, so I can tell it to move at, say 0.1 m/s and it will apply the correct power to each motor to achieve this.

Currently the ATTiny code is polled, and on request it returns the total number of ‘clicks’ travelled and the master looks at its current time, compares the last read and works out direction and speed from there.

To move that processing to the slave I would need to add timing code to the ATTiny which it doesn’t currently have, but it occurs to me that it would probably be more accurate than letting the Due do it. Maybe?

All the tutorials I found everything was being done be the one Arduino so I’m curious if others have done this and what advantages/disadvantages might be to either approach that I haven’t thought of.

EDIT: My robot playing with some sheep.

submitted by /u/gristc
[link] [comments]