DIY Projects

DIY Measuring Wheel using Arduino and Rotary Encoder

Learn how to build cheap and best DIY Measuring Wheel or Surveyor's wheel using Rotary encoder with Arduino

In this interesting Arduino Project lets learn how to interface Rotary Encoder with Arduino to make DIY measuring wheel and display the measured length on LCD display. And learn how it works.

At some point in our education we all used measuring scales to measure the lengths or distances on paper, but in practical works there are measuring tapes to measure some bigger lengths. Now a days as the technology is booming there are even devices like laser measuring devices which can measure the length through a laser beam.

In this project, we are building a digital Measuring wheel. By using some mathematical formulas, we can measure the distance from one point to another point, through the distance travelled by wheel. The Rotary encoder is connected to wheel to measure the distance and send it to the microcontroller to perform mathematical calculations and display the values on LCD display.

Measuring Wheel also has names such as Surveyor’s wheel, Hodo meter, Click wheel, Way wiser, Trundle wheel or a perambulator. We all use these meters especially odometers in our daily life with out knowing its name. Yes, while riding a bike or car you can see the distance meter on the drivers dashboard which display the distance travelled.

Required components:

  • Arduino Microcontroller
  • Incremental Rotary encoder
  • Wheel
  • 16X2 LCD display with I2C adapter
  • Push button
  • Few connecting wires

Circuit diagram of Arduino Measuring Wheel

Now connect all the required components exactly as shown in the below circuit diagram.

Measuring Wheel with Arduino and rotary encoder circuit diagram

As you can see from the above circuit diagram, Rotary encoder is connected to Arduino NANO we used it because of its smaller size, you can even use Arduino UNO if you have.

Power pins + and GND of encoder are connected to 5V and GND pins of Arduino respectively. The two output pins CLK and DT of Encoder are connected to D2 and D3 pins of Arduino respectively as D2 and D3 are Arduino interrupt pins and we are using Interrupts function in the code, we should not change those pins. To know more about this interface in detail please refer our article: Rotary encoder with Arduino in detail with example codes.

A Wheel is fixed on the encoder shaft as a knob to rotate it.

The power supply pins VCC and GND of LCD display are connected to 5V and GND pins of Arduino NANO. I2C pins SDA and SDA are connected to A4 and A5 of Arduino. If you don’t have I2C connected refer this article: Interfacing LCD Display with Arduino

A push button is connected to pin D4 as shown.

How Arduino Measuring wheel works?

As we know Rotary Encoder measures in the number of rotations with steps, to measure a distance we need to convert the rotations into travelled distance, to do that we need to attach a wheel to the shaft of Encoder. Know the distance travelled is calculated with the circumference of the wheel. Different Rotary encoders have different number of rotation steps. Lets assume N number of steps, to know that rotate the encoder from 0 to 360 degrees and check the position value. Read this article to know how to check position : check position example

So, Circumference of the wheel = 2 X π X R(Radius of the wheel).

The distance travelled for one step of Encoder = (2xπxR)/N.

So using that formula we can calculate the distance by knowing the rotation steps travelled.

Also read: Pulse Per Mile calculator with formula

Program code:

Now its time to upload the code. connect Arduino to a PC where Arduino IDE is installed. Choose the board as Arduino NANO or which ever you use and select the correct port from the Tools menu. Install required libraries from the built in Library manager or you can download the latest version from the below links

Required Libraries:

  • Download LiquidCrystal_I2C – Link

Next copy the below code and paste it in IDE workspace and press upload button. That’s it the code will be uploaded.

// Compiled and tested with no errors
// DIY Measuring wheel using Arduino and Rotary encoder with reset button
// source -
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);

#define outputA 2  //CLK pin
#define outputB 3  //DT pin
#define rstbtn  4  //reset button pin

int counter = 0;
const float pi = 3.14; // Pi value 

const int R = 7;  //Radius of the wheel from center to edge
const int N = 40; //no of steps for one rotation
float distance = 0;

void setup() {
  // Initialize LCD
  lcd.print ("CIRCUITSCHOOLS..");
  lcd. setCursor (0, 1);
  lcd.print ("Measuring Wheel");

  // Initialize encoder pins
  pinMode(outputA, INPUT);
  pinMode(outputB, INPUT);
  pinMode(rstbtn, INPUT_PULLUP);
  attachInterrupt(digitalPinToInterrupt(outputA), readEncoder, FALLING);

void readEncoder() {
  int bValue = digitalRead(outputB);
  if (bValue == HIGH) {
    counter++; // Clockwise
  if (bValue == LOW) {
    counter--; // Counterclockwise

// Get the counter value, disabling interrupts.
// This make sure readEncoder() doesn't change the value
// while we're reading it.
int getCounter() {
  int result;
  result = counter;
  return result;

void resetCounter() {
  counter = 0;

void loop() {
  distance = ((2*pi*R)/N) * getCounter();
  lcd.setCursor(0, 0);
  lcd.print("Distance: in cms");
  lcd.setCursor(0, 1);
  lcd.print("        ");

  if (digitalRead(rstbtn) == LOW) {

After uploading the code check the device by rotating the wheel clock wise and anti clock wise to see weither the length are adding and substracting.

arduino surveyor wheel using rotary encoder output on LCD display

Output of DIY Odometer using Arduino:

You can attach this rotary encoder to some rod, and attach the Arduino and LCD display which is powered from 9Volt battery to make this device portable as below image.

measuring wheel fitted to wooden plank wit arduino and lcd

When you move the device forward while touching the wheel to the measuring surface the LCD will show the distance, When you move backward it substract the measurement. You can rest the measurement by pressing the reset push button. You can also add a switch near the battery to turn ON and OFF the device. To interface an OLED display instead of LCD please refer this article: Interfacing OLED display with Arduino.

This device will also work as an Odometers in DIY electric bicycles and cars but you need to use a good Rotary encoder instead of this.

If you like this Arduino Odometer project please subscribe to our YouTube Channel “Circuit Schools to encourage us to publish more interesting projects. If you have any doubts write to us from below comment section.

CircuitSchools Staff

We at CircuitSchools publish on basics of electronics and electric components and everything related to evolution of electrical technology with complete analysis of development boards and modules along with latest projects with innovative ideas.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button