Measuring DC Motor RPM Through Built-in Hall Sensor Encoder


When we deal with controlling motor speed, normally we just provide PWM and the motor will rotate accordingly to the voltage reach at motor terminal. To have a better speed controlling, we can monitor RPM. Revolutions per minute (abbreviated rpm, RPM, rev/min, r/min) is the number of turns in one minute. It is a standard unit of rotational speed or the frequency of rotation around a fixed axis.

To monitor RPM, we need to have a feedback or sensor to sense shaft rotation. Luckily, nowadays, there have many DC motor in the market comes with built-in hall sensor encoder attach to the motor shaft. There have a few options offered by Cytron Technologies:

  1. SPG30 With Encoder (Spur Gear)
  2. IG32 With Encoder (Planetary Gear)
  3. IG42 With Encoder (Planetary Gear)


How it works? Please check on this video.

Hardware Preparation

This tutorial uses:

  1. Maker UNO
  2. Cytron 10Amp DC Motor Driver
  3. DC Motor IG42E-24K
  4. Planetary Motor Bracket (IG42E/IG45)
  5. LiPo Rechargeable Battery 11.1V 2200mAH
  6. 2-3 Cell LIPO Balance Charger

You can make hardware connection based on the table below.

MD10C: +Battery +ve
MD30C: –Battery -ve
MD30C: AMotor red/black wire
MD30C: BMotor red/black wire
MD30C: PWMMaker UNO: pin 10
MD30C: DIRMaker UNO: pin 12
Motor brown wire (Hall sensor VCC)Maker UNO: 5V
Motor green wire (Hall sensor GND)Maker UNO: GND
Motor blue wire (Hall sensor A)Maker UNO: pin 3
Motor purple wire (Hall sensor B)Not connected


This is sample code used in the video. Enjoy it!

Thank you

Thank you for reading this tutorial and we hope it helps your project development. If you have any technical inquiry, please post at Cytron Technical Forum.

2 thoughts on “Measuring DC Motor RPM Through Built-in Hall Sensor Encoder”

  1. when i put a PWM value from serial monitor (0 to 255) for motorPwm then the values from encoder reading is not correct anymore.Can u discuss about this please .thank u

  2. hi. how to calculate distance from starter point to where the robot goes? what item that i need to use?

Leave a Comment

Your email address will not be published.

Share this Tutorial

Share on facebook
Share on whatsapp
Share on email
Share on print
Share on twitter
Share on pinterest
Share on facebook
Share on whatsapp
Share on email
Share on print
Share on twitter
Share on pinterest

Latest Tutorial

Soil Moisture Alarm Using CircuitPython on Seeeduino XIAO
Read Surrounding Temperature and Humidity Using Grove Beginner Kit
Program Seeeduino XIAO Using CircuitPython
Does Technology Make Us Feel Safe
Send Video to Telegram Bot Using Raspberry Pi Camera
Scroll to Top