Log in

View Full Version : Sensor Info


robotsarecool
28-05-2016, 21:58
Hi all!
Why do digital encoders need two inputs? Also what is the difference between analog sensors and digital sensors?

Knufire
28-05-2016, 22:11
Digital sensors report a binary (on/off, 0/1, etc) value back to the robot. Analog sensors will report a voltage back from the robot (usually something between 0 and 5 volts). That's why things like switches, buttons, proximity sensors are digital, but things like potentiometers that measure angle are analog.

Now by that logic, an encoder (which measure the distance the shaft has spun) should be analog, since it's not measuring something that is simply on or off. However, it's actually a digital sensors, just by the nature of how the sensor works. Inside an encoder, there's a little disk with slits in it, and a little light sensor reading the disk. If the light sensor is over a slit, it returns a 1, if it's not over a slit, it returns a 0. As the shaft spins, it'll rapidly switch between 1 and 0. The robot counts how many times this switch happens (and knowing how many slits are on the disk) you can figure out how much the disk has rotated.

However, this doesn't tell us which direction the encoder shaft is spinning. If we spin it backwards, we would get the same sequence of 0 and 1. Therefore, quadrature encoders (which are most FRC encoders) have two light sensors on them. They're spaced such that (if we label the two A and B), you'll get this sequence when you spin the encoder shaft.

Aon Bon Aoff Boff Aon Bon Aoff Boff

But now, when you spin this backwards, you get a slightly different sequence

Bon Aon Boff Aoff Bon Aon Boff Aoff

By using two digital inputs, we can now tell which direction the encoder is spinning as well as how fast it has spun.

More information:
http://www.creative-robotics.com/quadrature-intro

robotsarecool
29-05-2016, 14:49
Thank you so much! :D