New Products See All

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?

Today we officially announce our new micro:bit product line!

Continue reading

Sometimes, when testing power supplies, it's handy to be able to load them consistently. This gizmo will help you do that.

Continue reading

What "cleaning" a room does to air quality.

Continue reading

The Thing is the first non-LoRa board officially supported inside myDevices’ Cayenne IoT project builder!

Continue reading

Let's take a look at how LIDAR works and how we can use it in robots.

Continue reading

The new Pi Zero W has made its way to SparkFun, along with everything you need to connect it up!

Continue reading