DIY: Measuring Wheel/Surveyor’s Wheel Using Arduino & Rotary Encoder

john November 18, 2017 3 Comments

DIY: Measuring Wheel/Surveyor’s Wheel Using Arduino & Rotary Encoder

A surveyor’s wheel may also be known by other names like: clickwheel, hodometer, waywiser, trundle wheel, measuring wheel or a perambulator. All these devices serve a single purpose, which is, measuring distance.

The origin of surveyor’s Wheel is from an odometer. Odometer simply counts the number of rotations of the wheel. The distance travelled by the wheel is directly proportional to the radius of wheel.

In the digital Surveyor’s Wheel a rotary encoder is attached to the wheel. This rotary encoder precisely counts the number of rotations. It also counts the rotation angle, and hence the digital system is much more precise then mechanical system.

An Arduino Nano is used as the controlling unit. It reads the pulses coming from the rotary encoder and calculates the traveled distance and prints on LCD (Liquid Crystal Display).

Components

ComponentSpecificationQuantity
ArduinoNano1
Rotary Encoder1
LCD16X21
Battery9 Volt1
Battery Holder1
Battery Holder1
Switch1
Wheel1
Preset10K1
Jumper Wire3

Working

When the Rotary encoder rotates, it sends the pulses to Arduino. Output pins of the rotary encoder are connected to pin D2 and pin D3 of Arduino. Arduino identifies the rotation and direction (clockwise or anticlockwise) of the wheel. Arduino counts the pulses and converts them in distance by using some basic mathematical operations, called calibration. Now calculated distance is shown on the LCD.

 

Measuring Wheel/Surveyor's Wheel Using Arduino & Rotary Encoder

Rotary encoder

In the rotary encoder spaced conductors are placed on a disc and connected to common pin. Encoder have two output pins (OUT1 and OUT2), When encoder rotates, output pins gives ZERO and ONE. The pattern of ZERO and ONE in OUT1 and OUT2 helps in determination of direction and rotation.

Arduino

Arduino is the brain of the whole project which counts the rotation. Arduino converts the rotation into distance using calibration and displays the information on LCD.

LCD

LCD (Liquid Crystal Display) is the output device; it shows the measured distance in Centimeter.

In this project, we are using 16×2 LCD (16 Columns and 2 Rows). The LCD has 16 pins, some pins are power pins, and 6 pins are connected to Arduino and two pins are used for backlight. A preset is also connected to 3rd pin of LCD which is used for contrast control of the LCD.

Circuit

In the circuit Arduino, LCD and Rotary Encoder are the main components. Rotary encoder has three pins. One pin is connected to GND and two pins are connected to D2 and D3 pins of Arduino. LCD is connected to Arduino through pins D0 to D5. Vin pin of Arduino is powered by a 9-volt battery through a switch.

Measuring Wheel/Surveyor's Wheel Using Arduino & Rotary Encoder

 

In this project a PCB is designed using EAGLE CAD software. If you are good in PCB Etching, you can use the figure provided below to DIY.

Measuring Wheel/Surveyors Wheel Using Arduino & Rotary Encoder

Measuring Wheel/Surveyors Wheel Using Arduino & Rotary Encoder

 

You can also make the circuit on breadboard or Zero PCB using the image below.

Measuring Wheel/Surveyors Wheel PCB Design

Measuring Wheel/Surveyors Wheel PCB Design

clickwheel, hodometer, waywiser, trundle wheel, perambulator

Measuring Wheel/Surveyor's Wheel Using Arduino & Rotary Encoder

Measuring Wheel/Surveyor’s Wheel

Video

Calibration

In this DIY project, the rotary encoder measures the number of the rotation but we have to convert the rotation into travelled distance. Travelled distance depends on the diameter of the wheel.

Rotary encoder moves 22 steps in one complete rotation (360 degree). Steps per rotation depends on the rotary encoder which can be changed from 8 to 48, but in our case it is 22.

Suppose N is the steps per rotation and R is the radius of wheel.

  • Travelled distance in one Rotation is = 2xπxR
  • Travelled distance in one Step is     = 2xπxR/N

In our case

  • N = 22
  • R = 7

By solving

  • Travelled distance in one Step is     = 2R

Code

Download Program/Code

In the beginning of code “LiquidCrystal.h” header file is used for the LCD Display. After it LCD is declared by the function “LiquidCrystal lcd(5, 6, 7, 8, 9, 10)”, where pins are declared in the bracket.

In the line 5 and 6 two integers are declared by names pin1 and Pin2, that are interrupt pins of Arduino. Three Integers are declared in lines 8, 9 and 10, where Pos is the current position of Rotary encoder. Other two integers are “State” and “LastState”.

Now a “constant float” is declare by the name “pi”, which is equal to 3.14. Two constant integers are declared by the name “R” that is Radius and “N” is step per revolution of the Rotary encoder. Now a float is declared by name the “distance”, which is the measured distance

In the void setup section, pin1 and pin2 are declared by INPUT.

In the line 23 LCD is begun and in the line 24 “SURVEYOR’S WHEEL” is displayed on the LCD.

In the line 26 “LastState” is digital read value if “pin1”. In the void loop section integer State is equal to “digitalRead(pin1)”. An “if” loop is used in line 30 it become true when “State” and “LastState” are not equals. An “if” is also used inside the loop, it becomes true when “digitalRead(pin2)” is not equals to the “State”. In this loop “Pos” increase and in the else “Pos” decreases.

Now measured distance is 2*pi*R/N which is the circumstances of circle (wheel). Where Pi is 3.14, R is Radius and N is step per revolution of Rotary encoder. Now this distance is printed on the LCD, at the end “LastState becomes” equals to the “State”.

Comments
  • November 23, 2017

    Nice project

  • David Bley
    November 18, 2017

    Is it possible to obtain the code listing?

    Typically the bearings in encoders will fail being an axle for a wheel. If this project is to have long life, provide bearings for wheel and connect wheel axle to encoder shaft with flexible coupling.

    • john
      November 18, 2017

      Hi David..the code has been uploaded.

Leave a Reply

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