Laboratory Activity No.
Angular Displacement Measuring Instrument
Name: ___________________________ Rating: ________________
Section: __________________________ Date: __________________
Objectives:
This experiment will enable the student
1. To measure angular displacement using the potentiometer.
2. To interface an potentiometer LCD display and Arduino the process
3. To create an angular displacement measuring instrument
Equipment and Materials:
Qty Equipment/Materials
1 Personal Computer
1 Arduino microcontroller
1 LCD Display
1 Potentiometer
1 USB cable
1 Power supply
1 Breadboard
8 Alligator clips
1 set Connecting wires
Introduction:
In this activity we will going to create an angular displacement measuring device or
instrument. The instrument is compose of the potentiometer as sensor, the LCD as the
indicator or display and the Arduino microcontroller as the processor.
We will configure the potentiometer into a voltage divider circuit and acquire the
measured voltage to the middle pin of the potentiometer and feed it to the one of the
Arduino. As we rotate the knob of the potentiometer indicating angular displacement the
microcontroller will sense variable voltage. We will make use the analog to digital
conversion of the Arduino microcontroller in order to process the data.
The liquid crystal display (LCD) provides the display to indicate the amount of
angular rotation does the potentiometer acquired. To display the information received by the
Arduino from the potentiometer a build in library in Arduino programming will be used to
control the output display.
Procedures:
A. Set-up
1. Connect the computer and Arduino microcontroller using USB serial cable
2. Connect the potentiometer and LCD display to the microcontroller as shown below.
B. Arduino Program:
1. Write the program below to the microcontroller. Explain what does the code will do
in the system?
#include <LiquidCrystal.h>
const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
int sensorPin = A0;
int sensorValue = 0;
int angle = 0;
void setup() {
lcd.begin(16, 2);
lcd.print("Angular displacement:");
}
void loop() {
sensorValue = analogRead(sensorPin);
angle = map(sensorValue, 0, 255, 0, 240);
lcd.setCursor(0, 1);
lcd.print(angle);
}
Data:
1. Explain line by line what does the code do?
____________________________________________________________________
____________________________________________________________________
____________________________________________________________________
____________________________________________________________________
____________________________________________________________________
____________________________________________________________________
____________________________________________________________________
2. Run the program and turn the knob of the potentiometer to into it counter clockwise
most direction. What is the reading in the LCD display?
____________________________________________________________________
____________________________________________________________________
3. Gently rotate the knob of the potentiometer clockwise. What is happening to LCD
display reading?
____________________________________________________________________
____________________________________________________________________
____________________________________________________________________
4. What is the LCD reading once the potentiometer reaches the clockwise most
rotation?
____________________________________________________________________
____________________________________________________________________
____________________________________________________________________