Project tutorial

Exploring Encoders - Step Trackers for Motors © CC BY

Build Absolute, Incremental, and Quadrature Encoders

  • 1,504 views
  • 2 comments
  • 7 respects

Components and supplies

Adafruit Break Beam
You can also use LDRs and LEDs.
×3
DC motor
The shaft diameter in the CAD file is 3mm. You might need to adjust this according to the motor you pick. A smaller and cheaper motor is: https://www.amazon.com/RS-550s-18v-Electronic-Controlled-Replacement/dp/B00TE42PME/ref=sr_1_1?ie=UTF8&qid=1477015531&sr=8-1&keywords=rs550
×1
A000066 iso both
Arduino UNO & Genuino UNO
Any Arduino should work.
×1
12002 04
Breadboard (generic)
You can use this instead of soldering.
×1
11026 02
Jumper wires (generic)
If you are using a breadboard, you can use jumper wires.
×1
Motor Controller
You can just use a battery and a potentiometer.
×1
OpenBeam Starter Kit
You don't have to use this. You can use other materials to construct the stand.
×1
2 Pin Board Side
You don't need this if you are just going to breadboard the project.
×3
2 Pin Sensor Side
You don't need this if you are just going to breadboard the project.
×3
3 Pin Board Side
You don't need this if you are just going to breadboard the project.
×3
Contact - 22-28 AWG
You don't need this if you are just going to breadboard the project.
×15
3 Pin Sensor Side
You don't need this if you are just going to breadboard the project.
×3
Hook-up wire (solid 22-28AWG)
You don't need this if you are just going to breadboard the project - use jumpers.
×1
Header pins
You don't need this if you are just going to breadboard the project.
×1
Solder (Generic)
You can just use bread boards. This is a good tutorial for learning how to solder:https://learn.sparkfun.com/tutorials/how-to-solder---through-hole-soldering?_ga=1.113903495.1265549123.1409440336
×1
Prototyping Board
You don't need this if you are just going to breadboard the project.
×1
Screw Terminal
You don't need this if you are just going to breadboard the project.
×1
Tens70
9V battery (generic)
You can use power or PWM on Arduino instead.
×1
Keystone 233 image 75px
9V Battery Clip
You can use power or PWM on Arduino instead.
×1
61vhxtmzbyl
AA Batteries
You can use power on Arduino.
×1
AA Battery Holder
You can use power on Arduino.
×1

Necessary tools and machines

3drag
3D Printer (generic)
You could also cut the templates out of cardboard.
Crimper
You don't need this if you are going to breadboard the project.
09507 01
Soldering iron (generic)
We like Hakko. You don't need this if you are breadboarding the project.

Apps and online services

D94d qxu
Autodesk Fusion 360
This is how we created our drawings.
Ide web
Arduino IDE
You'll need this to upload the code.

About this project

Project Overview

Encoders are like Fitbits for motors. Depending on the type of encoder, they can keep track of the distance the motor traveled, the direction, or the exact angle it has turned. Typically, encoders are really small and spin at high rates. To investigate how they work, we made larger slower models of them. This project demonstrates how incremental, quadrature, and absolute encoders work.

Construction

Encoder Disk

A rotary encoder is a wheel with slits that is attached to the shaft of a motor (or other device that you want to monitor the position of). Our encoders were 3D printed.

Structure

Our structure is made out of OpenBeam. We wanted something sturdy and adjustable. We wanted to be able to move the sensors up and down to align with each other and closer and father away from each other if needed. The mounts for the motor and sensors were made for OpenBeam, but you can use other materials you have.

Sensors

We used Adafruit's break beam sensors. You could use LDRs and LEDs. The transmitter just needs to be powered. It can be powered with 3.3-5V. We use 2 AA batteries. The black is ground and the red is power. The receiver has a white wire. This is the signal wire. which goes to digital pins 5, 6, and 7 of the Arduino. We power the receiver via the Arduino (you can power both the transmitter and receiver via the Arduino ).

Motor

We have a larger motor and a motor controller wired to a 9V battery. You can use a smaller motor and a potentiometer to control the encoder. Just watch out for the voltage rating on the motor and change the diameter of the opening to fit your motor.

Troubleshooting

The break beam sensors use IR that can sometimes transmit through the material you are using. We had to paint our 3D printed material. The cardboard worked just fine.

We had a bad crimp causing one break beam to always ride high. Using a multimeter, we determined there wasn't a short on the board or an issue with the code.

Alternative Materials

  • For the detectors, you can replace the break beams with LEDs and LDRs.
  • You don't have to use a 3D printer. You can just cut encoders out of cardboard.
  • The motor we used was one we already had. Smaller motors will work too.
  • You don't need OpenBeam. You can make the stand out of things you already have around your house/workshop/classroom.

Custom parts and enclosures

Absolute Encoder - 3 Bit
Incremental Encoder
Motor Mount Lower
Used on OpenBeam
Motor Mount Upper
Used on OpenBeam
Quadrature Encoder
Sensor Mounts
This is for OpenBeam. You'll need two of these.

Schematics

Wiring Diagram
Red wires to power, Black to ground. White to signal. Pin 5 of Arduino to inner sensor. Pin 6 of Arduino to middle sensor. Pin 7 of Arduino to outer sensor.
Oyhu3x0tpx45gaa1yf0p
Motor Controller Hookup
The first two terminals go to the motor and the second two go to a battery. We used a 9V battery. The switch allows you to power off and turn the motor both clockwise and counterclockwise. The knob adjusts the speed.
Snwbjavseqhivl3dkvuw
Top of Transmitter Board
We wired a AA battery pack to the green terminal. We soldered a connector to the board and crimped the other side to the sensor.
Jxziijhf2rdtsgzwxrnf
Transmitter Board Wiring
We used hookup wire and soldered the black wire side of the connector to the ground rail and ground pin of the terminal The power side was soldered to the red side.
Csfpczxmqkstu6gxu28y
Wiring to Arduino
We soldered a connector to the board and crimped the other side to the sensor. The black wire is ground, red is power, and white is signal. We went to Arduino ground, Arduino 3.3V power, and pins 5, 6, and 7 for the signal pins.
Axzzc1t0nfh1f6vlvufj
Receiver Wiring
We soldered hookup wire to a power rail for the red sensor wires. We soldered hookup wire to a ground rail for the black sensor wires.
J683cfxbgqi1aq0upyz0

Code

Code for Absolute, Incremental, and Quadrature Encoders

Comments

Similar projects you might like

Water Softener

Project tutorial by moty

  • 265 views
  • 0 comments
  • 5 respects

Know the Temp of Your Home From Anywhere with Arduino Cloud!

Project tutorial by Isaac100

  • 1,246 views
  • 0 comments
  • 9 respects

Simple Obstacle Senor With Arduino

Project tutorial by muhammed shameel k.v

  • 88 views
  • 0 comments
  • 2 respects

Safe City: A Device to Keep You Safe

Project tutorial by Patel Darshil

  • 630 views
  • 0 comments
  • 6 respects

Scavenger Hunt Clues w/ Telephone Keypad

Project tutorial by Sam Horne

  • 940 views
  • 0 comments
  • 3 respects
Add projectSign up / Login