Same-day dispatch before 2 PM · Free delivery over ₹999 · GST invoices Get the appPrices incl. GST
Geekobot
Snap & SendNEWGeeko AIWhere's myOrder
Log in
Products
  • Projects
    • Component guidesHow parts work, with code you can run
    • Learning pathsFrom your first LED to your first robot
    • Workshops & eventsOnline sessions for makers and classes
    • ElectrolarkFree guided builds, simulator and certificates
    • Students & teachersStudent discount and classroom help
    • CommunityShare builds and ask other makers
    • CalculatorsOhm's law, LED resistor, 555 and 100+ more
    • Circuit builderWire parts and run the circuit, powered by Electrolark
    • Geeko AIAsk what to buy or how to wire it
    • Snap & SendPhotograph a part or list, we find it
    • Part finderAnswer a few questions, get the right part
    • Compatibility checkWill these two parts work together?
    • Compare partsSpecs side by side
    • Business & bulk ordersGST invoices, credit and volume prices
    • Request a quotationSend your list, get a quote
    • Classroom kitsPer-student kits and lab bundles
    • Gift cardsFor students, teams and events
  • Atal Tinkering Lab
BOM to cart
Geekobot

Components, kits and know-how for makers, students, engineers, labs and businesses across India.

Ask Geeko AIOrders, parts and projects, any timeEmail supportReply within 1 working dayGet the Geekobot appAdd it to your home screen, free

Follow us

Shop

  • Boards & SBCs
  • Sensors & Modules
  • IoT & Wireless
  • Drone & FPV
  • 3D Printing
  • Filaments & Resins
  • Motors & Drivers
  • Power & Batteries
  • Semiconductors
  • Passive
  • Displays & LEDs
  • Switches & Relays
  • Wires & Cables
  • Prototyping
  • Tools & Test
  • Robotics
  • STEM Kits
  • Atal Tinkering Lab
  • Mechanical Parts
  • Audio

Orders

  • Track your order
  • Help & support
  • Shipping and delivery
  • Refunds and cancellation
  • Contact us

Learn

  • Projects
  • Geeko AI project assistant
  • Learning paths
  • Guides
  • Calculators
  • Electrolark: free guided builds

Part tools

  • Part finder
  • Compare parts
  • Will it work with my board?

Institutions

  • Classroom kits
  • Atal Tinkering Lab
  • Students & teachers
  • Workshops & Events

Business

  • Business & education
  • Request a quotation
  • BOM bulk upload
  • Quick order by SKU

Company

  • About Geekobot
  • Community
  • Gift cards
  • Terms & conditions
  • Privacy policy
  • Product directory
  • Sitemap

© 2026 Geekobot, a trade name of OLatus Systems Private Limited. All rights reserved.

20, 1st Floor, Neeladri Complex, 10th Cross, Sampige Rd, 2nd Main, Malleshwaram, Bengaluru, Karnataka 560003 · GSTIN 29AACCO0462F1ZM

+91 91810 15607 · connect@geekobot.in · Monday to Saturday, 10 AM to 2 PM IST

UPI · CARDS · NETBANKING · GST INVOICES

ShopProjectsGeeko AIGuides
Compare 0 parts →
Log in

Shop by category

Shop all components
  • Boards & SBCs1,910 products
    • Alternative Single Board Computers
    • Arduino Ecosystem
    • FPGA & Logic Boards
    • Microcontroller & Wireless Boards
    View all
  • Sensors & Modules4,701 products
    • Biomedical & Heart Rate
    • Current, Voltage & Power
    • Force, Weight & Pressure
    • Gas, Weather & Environmental
    View all
  • IoT & Wireless2,314 products
    • RF Modules
    • RFID & NFC
    • Antennas & RF Accessories
    • Cameras & Smart Vision
    View all
  • Drone & FPV3,558 products
    • Flight Control & Navigation
    • FPV Video & Optics
    • Frames & Structural Parts
    • Motors & Propulsion
    View all
  • 3D Printing2,204 products
    • 3D Printers
    • 3D Scanners & Digitizers
    • Laser Engravers & Cutters
    • Material Management & Upgrades
    View all
  • Filaments & Resins1,472 products
    • Filaments
    • Photopolymer Resins
    View all
  • Motors & Drivers463 products
    • BLDC Motor Drivers
    • DC & Geared Motors
    • DC Motor Drivers
    • Linear Actuators & Solenoids
    View all
  • Power & Batteries557 products
    • Battery Holders & Connectors
    • Breadboard Power
    • Chargers & BMS
    • DC-DC Converters
    View all
  • Semiconductors295 products
    • Diodes & Rectifiers
    • Interface & RF Encoder ICs
    • Logic ICs (74xx)
    • Logic ICs (CD4000)
    View all
  • Passive67 products
    • Capacitors
    • Circuit Protection
    • Crystals & Oscillators
    • Inductors
    View all
  • Displays & LEDs572 products
    • 7-Segment & Dot Matrix
    • Addressable LEDs
    • Character LCDs
    • Graphic LCDs
    View all
  • Switches & Relays184 products
    • Keypads & Touch
    • Push Buttons & Tactile
    • Relay Modules
    • Relays
    View all
  • Wires & Cables233 products
    • Board-to-Wire Connectors
    • Crimp & Splice
    • Headers & Dupont
    • Heat Shrink & Sleeving
    View all
  • Prototyping101 products
    • Breadboards
    • Interface Modules
    • PCBs & Perfboards
    View all
  • Tools & Test717 products
    • Bench Power Supplies
    • Hand Tools
    • Measuring Tools
    • Meters & Testers
    View all
  • Robotics180 products
    • Humanoid & Legged Robots
    • Robot Chassis & Platforms
    • Robotic Arms & Grippers
    • Wheels & Casters
    View all
  • STEM Kits268 products
    • Arduino Learning Kits
    • Coding & IoT Kits
    • Early Coding (Ages 3-8)
    • Invention Kits
    View all
  • Atal Tinkering Lab196 products
    • Package 1: Electronics, Robotics, IoT and Sensors
    • Package 2: Rapid Prototyping Tools
    • Package 3: Mechanical, Electrical and Measurement Tools
    • Package 4: Power Supply, Accessories and Safety Equipment
    View all
  • Mechanical Parts212 products
    • Bearings
    • Brackets & Mounts
    • Couplers
    • Fasteners & Standoffs
    View all
  • Audio109 products
    • Amplifier Modules
    • Buzzers & Sirens
    • Speakers
    View all
  1. Home
  2. ›Guides
  3. ›Motors & Motion
  4. ›Motor Encoders and Speed Feedback
Step 8 of 16 in Motors and robotsPart of a learning path.
Next

Concept explainer · Intermediate · 3 min read

Motor Encoders and Speed Feedback

By Geekobot Learning Team · Updated 24 Oct 2026

On this page
Short answerWorking out counts per revolutionWiring and readingClosing the loop with PIDTry itCommon mistakesFAQsParts and next steps
Short answer

A motor encoder reports how far and how fast a shaft has turned. Most DC gear motors with encoders use a magnetic disc and two Hall sensors giving quadrature A and B pulses, so you get both speed and direction. Counts per output revolution equal pulses per motor turn times the gear ratio, times four if you count every edge. With these counts, a PID loop can hold a robot's wheel speed steady.

Key specs at a glance

Types
Magnetic (Hall) incremental, optical incremental, absolute (e.g. AS5600)
Signals
A and B quadrature, sometimes an index pulse
Typical resolution
7 to 11 pulses per motor turn (Hall), hundreds to thousands (optical)
Counts per output rev
PPR × gear ratio × 4 (all edges)
Wiring
Motor +, motor −, encoder VCC, GND, A, B
Reading
Interrupt pins, or hardware counters (ESP32 PCNT, STM32 timers)
01

Working out counts per revolution

Example: an encoder with 11 pulses per motor revolution on a motor with a 30:1 gearbox. Counting every rising and falling edge of A and B (4x decoding) gives 11 × 30 × 4 = 1320 counts per wheel revolution. With a 65 mm wheel (about 204 mm circumference), each count is about 0.15 mm of travel.

Speed: count the pulses in a fixed time, such as 50 ms, then RPM = counts ÷ counts per rev ÷ time in minutes.

02

Wiring and reading

Encoder motors usually have a 6-wire cable: two thick wires to the motor driver, and VCC (3.3 or 5 V), GND, A and B for the encoder. The Hall outputs are often open-collector; add pull-ups if the board does not have them.

On an Arduino Uno, put A on an interrupt pin and read B inside the interrupt to get direction. With two motors, use pins 2 and 3 for the A channels. Above a few thousand counts per second, an Uno starts missing pulses; an ESP32's PCNT hardware or an STM32 timer in encoder mode counts with no CPU load. The same quadrature idea is explained for knobs in rotary encoders.

03

Closing the loop with PID

Without feedback, two 'identical' motors run at different speeds and a robot curves. With encoders, a PID loop compares measured speed to the target every 20 to 50 ms and adjusts the PWM duty. Start with only P, increase until it oscillates, back off, then add a little I to remove steady error. The same counts give odometry: distance and heading for a robot that drives a set path. For absolute angle on a joint, use a magnetic absolute encoder such as the AS5600.

04

Try it: Wheel speed calculator

Change the values and the diagram and results update as you type.

05

Common mistakes to avoid

  • !Forgetting the gear ratio in counts per revolution.
  • !Reading encoder pins by polling in a busy loop and missing pulses.
  • !No pull-ups on open-collector encoder outputs.
  • !Running encoder wires next to motor wires without twisting.
  • !Tuning PID with too-large gains first.
06

Frequently asked questions

What is a quadrature encoder?

An encoder with two outputs a quarter-cycle apart; which changes first shows direction, and the count shows distance.

How do I calculate encoder counts per revolution?

Multiply the encoder's pulses per motor turn by the gear ratio, then by 4 if you count all edges of both channels.

Can Arduino Uno read two motor encoders?

Yes at modest speeds, using interrupt pins 2 and 3. For high-speed motors use an ESP32 or STM32 hardware counter.

What is the difference between incremental and absolute encoders?

Incremental encoders count changes from where they started; absolute encoders report the actual angle even after power-up.

Why use encoders on a robot?

To drive straight, control speed under load and measure distance travelled.

Parts for this guide

  • Metal Gear DC Motor with Hall Encoder (25mm / 37mm)
    ₹480View
  • 65mm Rubber Robot Wheel for BO / TT Motors
    ₹12View
  • 4WD Smart Robot Car Chassis Kit
    ₹689View
Shop DC & Geared MotorsShop Robot Chassis & Platforms

Calculators

Wheel speed calculatorGear ratio calculatorMotor power torque calculator

Terms in this guide

InterruptA hardware signal that makes the microcontroller pause its program and run a short function immediately, for example when a button pin changes.PIDProportional-integral-derivative control: a feedback loop that steers towards a target smoothly by combining the current error, its history and its rate of change.PWMPulse-width modulation: switching a signal on and off quickly so its average sets brightness, speed or position.Hall effectThe small voltage produced across a conductor or sensor in a magnetic field. Hall sensors use it to detect magnets or measure current without electrical contact.FeedbackRouting part of an amplifier's output back to its input. Negative feedback through resistors sets an op-amp's gain precisely.

Projects that use it

Put this into practice: 9 step-by-step builds in our project library use parts from this guide.

Beginner · 1 hourValve and gate angle indicatorView projectBeginner · 1 hourWind vane direction meterView projectBeginner · 1 hourWindow and door opening angle meterView project
Browse all 9 projects

Keep learning

Component guideBeginnerDC Motors ExplainedA brushed DC motor spins when current flows through it: voltage sets the speed and the load sets the current it draws.4 min read · Motors & MotionComparisonBeginnerMotor Drivers ExplainedA motor driver lets a low-power microcontroller control the speed and direction of motors using an H-bridge.4 min read · Motors & MotionHow-toBeginnerRotary EncodersA rotary encoder is a knob that turns endlessly and outputs two square-wave signals, A and B, a quarter step apart.3 min read · Switches, Relays & InputComponent guideBeginnerHall Effect Sensors and Reed SwitchesA Hall effect sensor detects a magnetic field with no contact.3 min read · SensorsBuying guideBeginnerChoosing a Robot ChassisFor a first robot car, a 2WD acrylic chassis with two gear motors and a caster wheel is cheapest and easiest to program.3 min read · Robotics

Sources

  • Motor encoder manufacturer data for Hall quadrature encoders
  • ams-OSRAM AS5600 datasheet
  • Espressif ESP32 PCNT documentation

Written by the Geekobot team from manufacturer datasheets. Always check the datasheet for the exact part and variant you buy.

On this page
Short answerWorking out counts per revolutionWiring and readingClosing the loop with PIDTry itCommon mistakesFAQsParts and next steps
Need a hand?Ask Geeko AI which part fits your project, or talk to the Geekobot team.Ask Geeko AIHelp & support

Parts for this guide3 items · ₹1,181

Metal Gear DC Motor with Hall Encoder (25mm / 37mm) · 65mm Rubber Robot Wheel for BO / TT Motors · 4WD Smart Robot Car Chassis Kit

Ask the Community

Ask a question