Sie sind auf Seite 1von 9

‫‪Republic of Yemen‬‬ ‫الجمهورية اليمنية‬

‫‪Sana'a university‬‬ ‫جامعة صنعاء‬


‫‪Faculty of‬‬ ‫كلية الهندسة‬
‫‪engineering‬‬ ‫قسم الميكانيكا‬
‫‪D.O.Mechanics‬‬

‫عمل الطالب‪- :‬‬


‫‪2016-159‬‬ ‫محمود عبد السالم حسن الحبيب‬
‫‪2016-68‬‬ ‫حمد قيصر مظفر الشيباني‬
‫‪2016-284‬‬ ‫أسامة عبد السالم الصالحي‬
‫‪2016-66‬‬ ‫معاذ حسن الزوقري‬

‫تحت إشراف‪-:‬‬
‫م‪/‬مهران العبسي‬
DIY: Measuring Wheel/Surveyor’s Wheel Using Arduino &
Rotary Encoder:-

A surveyor’s wheel may also be known by other names like: click


wheel, odometer, way wiser, 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 UNO 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
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.

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.

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 = 30

 R = 5.5

By solving

 Travelled distance in one Step is = (2πR*pos)/N

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 2 LCD is begun and in the line 16 “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”.

#include <LiquidCrystal.h>

LiquidCrystal lcd(5, 6, 7, 8, 9, 10);

int pin1 = 2;

int pin2 = 3;

int Pos = 0;

int State;

int LastState;

int unitselector= 12;

const float pi = 3.14;

const float R = 1;

const int N = 30;


float distance = 0;

void setup() {

pinMode (pin1 ,INPUT);

pinMode (pin2 ,INPUT);

pinMode (unitselector ,INPUT);

lcd.begin(16, 2);

lcd.print("SURVEYOR'S WHEEL");

LastState = digitalRead(pin1);

Serial.begin(9600);

void loop() {

State = digitalRead(pin1);

if (State != LastState){

if (digitalRead(pin2) != State) {

Pos --;

else {

Pos ++;

distance = (2*pi*R*Pos)/N;

if (digitalRead(unitselector)==1){
lcd.setCursor(0, 1);

lcd.print( distance);

lcd.setCursor(7, 1);

lcd.print("cm ");

Serial.print(distance);

Serial.println(" Cm");

if (digitalRead(unitselector)==0){

float inch= distance/2.54;

lcd.setCursor(0, 1);

lcd.print(inch );

lcd.setCursor(7, 1);

lcd.print("inch ");

Serial.print(inch);

Serial.println(" inch");

LastState = State;

}
Measured values and uncertainty: -

Tru
N 𝑥𝑖 e Random Systemic Precision Accuracy
accuracy

1 24.18 3.88 0.575 3.305 102.44% 19.11% 80.89%


2 24.18 3.88 0.575 102.44% 19.11% 80.89%
3 23.05 2.73 -0.575 97.56% 13.45% 86.55%
4 24.18 3.88 0.575 102.44% 19.11% 80.89%
5 24.18 3.88 0.575 102.44% 19.11% 80.89%
6 23.03 2.73 -0.575 97.56% 13.45% 86.55%
7 23.03 2.73 -0.575 97.56% 13.45% 86.55%
8 23.03 2.73 -0.575 97.56% 13.45% 86.55%
9 24.18 3.88 0.575 102.44% 19.11% 80.89%
10 23.03 2.73 -0.575 97.56% 13.45% 86.55%

1 10
𝑠𝑥 = √( ∑ (𝑥𝑖 − 𝑥 ′ )2
𝑁 − 1 𝑥=1

1 10
𝑠𝑥 = √( ∑ (𝑥𝑖 − 𝑥 ′ )2
9 𝑥=1

𝑠𝑥 = 0.6061 𝑐𝑚

𝑡9,95% = 2.262 cm

𝑠𝑥 ′ = 0.1917 𝑐𝑚
𝑢(𝑥𝑖 ,𝑟𝑒𝑝) = ±2.262 ∗ 0.6061𝑐𝑚
𝑢(𝑥 ′ ,𝑟𝑒𝑝) = ±2.262 ∗ 0.6061𝑐𝑚

Das könnte Ihnen auch gefallen