×

SparkFun will be closed on Tuesday, November 5th to support our team in being able to go out and vote! Orders placed after 2 pm MT Monday, November 4th will ship on Wednesday, November 6th. Thanks for your patience and understanding.

Adventures in Science: Rotary Encoders

It's Monday, and that means it's time for Adventures in Science! This week, we dive into the mysterious world of rotary encoders.

Favorited Favorite 0

There are two types of rotary encoders: incremental and absolute. Incremental encoders are useful for determining how many times a shaft has rotated or even counting fractions of a rotation. Absolute encoders, on the other hand, can determine the exact position of a shaft (depending on the resolution and precision of the encoder disc). For the video, I focus mainly on incremental encoders, how they can be used in wheeled robots to measure distance traveled, and how quadrature encoders work to determine the direction a shaft is spinning.

Incremental encoders, in their basic form, detect light, magnetic or physical changes on a disc that rotates with the shaft. We show an optical encoder in the video as a demo (the build for which can be found on Hackster). We then add two photocells to the encoder demo to show how a quadrature encoder works. We can use a simple magnetic encoder to count the number of rotations on a shaft, which we can use to determine how far a robot has traveled by placing one on each motor. Code for making our robot (lovingly named "Fred") move in a straight line for one meter can be found here.

Many of the top competitors in AVC use a combination of rotary encoders and a magnetometer (compass) to create a dead reckoning system that allows their robot to navigate around the course. Additionally, many self-balancing robots rely on encoders along with an inertial measurement unit (IMU) to determine if the robot is leaning one way or the other.

What are some other useful, fun or unusual uses for rotary encoders that you've seen?


Comments 4 comments

  • CF / about 7 years ago / 1

    Shawn, here is an example of "worst dimmer ever." I'll take your dimmer over that any day!

  • Gio Ex / about 7 years ago / 1

    The N64 controller's analog stick used rotary encoders instead of potentiometers... The PlayStation 1 "dualshock" controllers used potentiometers... I'm not so sure about the Sega Saturn's "3d controller" though...

Related Posts

Recent Posts

Halloween Hacking

SparkFun Spooktacular

Tags


All Tags