100% found this document useful (3 votes)
575 views

Rahul VK: Simple Pendulum Experiment Using IR Sensor 1.1.2020

1) An infrared sensor is used to measure the time period of a simple pendulum. This time period is then used to calculate the value of gravitational acceleration 'g'. 2) The experiment aims to find the value of g using the simple pendulum apparatus and measuring the time period with an infrared sensor connected to an Arduino microcontroller. 3) Key components used are a simple pendulum, infrared sensor, Arduino Uno, and LCD display. The infrared sensor detects the pendulum bob and measures the time period which is then used to calculate g.

Uploaded by

Sarifudin Husni
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (3 votes)
575 views

Rahul VK: Simple Pendulum Experiment Using IR Sensor 1.1.2020

1) An infrared sensor is used to measure the time period of a simple pendulum. This time period is then used to calculate the value of gravitational acceleration 'g'. 2) The experiment aims to find the value of g using the simple pendulum apparatus and measuring the time period with an infrared sensor connected to an Arduino microcontroller. 3) Key components used are a simple pendulum, infrared sensor, Arduino Uno, and LCD display. The infrared sensor detects the pendulum bob and measures the time period which is then used to calculate g.

Uploaded by

Sarifudin Husni
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

 

  

Simple Pendulum Experiment Using IR Sensor 


1.1.2020 
─ 

Rahul Vk 
Author of ​AnyGeeks 

Overview 
An Infrared Sensor is connected to a simple pendulum which records the time period of the 
pendulum which is then used to calculate the value of g. The result is displayed in an lcd 
screen which is connected to the apparatus. 
 

 

 

Aim 
To find the value of acceleration due to gravity using a simple pendulum.The time period of 
the pendulum is measured by an Infrared Sensor connected to the Simple Pendulum. 

Apparatus 
1. A Simple Pendulum 
2. An IR Sensor 
3. Arduino Uno(a microprocessor for reading the sensor output) 
4. 16 x 2 LCD Display 

Theory 
The simple pendulum executes Simple Harmonic Motion (SHM) as the acceleration of the 
pendulum bob is directly proportional to its displacement from the mean position and is 
always directed towards it. The time period (T) of a simple pendulum for oscillations of 
small amplitude, is given by the relation T = 2ㄫ√L/g where L is the length of the 
pendulum, and g is the acceleration due to gravity at the place of experiment. 

It can be written as T 2 = 4 Π2 L/g or g = 4 Π2 L/T 2  

Procedure 
1. Take a clamp stand and place it on the table. Attach a pendulum bob to the stand 
using a string. 
2. Measure the effective length of the string. 
3. Attach the infrared sensor to the stand in such a way that the sensor would 
perfectly line up with the bob of the pendulum when it is equilibrium.(as shown in 
fig1)  
4. Now take three jumper wires with headers soldered at the ends. 
5. Connect the first wire to vcc pin of the Infrared Sensor 
6. Connect the second wire to the ground of the Infrared Sensor 
7. Connect the third wire to the output of the Infrared Sensor. 

 

8. Take the arduino uno board and power it up by either connecting to a computer 
directly using the usb cable or connect a DC adaptor(9 - 20 V) to the DC jack or 
supply 5V directly through the Vin pin on the arduino uno board. 
9. Now connect the first wire from the sensor to the 5V pin of Arduino Uno Board. 
10. Now connect the second wire from the sensor to the GND pin on arduino. 
11. Now connect the third wire from the sensor to the Digital Pin 8 of the Arduino Uno. 
12. Now take the LCD screen and solder 12 wires into the Vss, Vdd , Vo, Rs, Rw, E, D4, 
D5, D6, D7 , A , K pins of the lcd respectively. 
13. Now connect the first wire from the lcd to the ground of the arduino 
14. Now connect the second wire from the lcd to the 5V pin of Arduino. 
15. Connect the third wire to the Digital Pin 6 of Arduino 
16. Connect the fourth wire to Digital Pin 12 of Arduino 
17. Connect the fifth wire to Ground 
18. Connect the sixth wire to Digital Pin 11 
19. Connect the seventh wire to Digital Pin 5 
20. Connect the eighth wire to Digital Pin 4 
21. Connect the ninth wire to Digital Pin 3 
22. Connect the tenth wire to Digital Pin 2 
23. Connect the eleventh wire to 5V pin  
24. Connect the twelfth wire to Ground.(refer fig2&3) 
25. Connect the Arduino Board to the computer and go to the official website 
www.arduino.cc​ and download the Arduino Integrated Development Environment. 
26. Run the setup file and follow the on screen instructions to complete the install 
27. Now open the Arduino IDE and go to tools ---> Port ----> COM1 and select it. 
28. Now type the code and click upload. 

 
fig(1) 
As we can see the bob of the pendulum should perfectly line up with IR Sensor. This is 
really important to get accurate readings. 
 

 

 
Fig2 lcd display 
The wires are soldered into VSS , VDD , VO ,RS, RW, E , D4, D5, D6, D7, A, K. 

 
Fig3, Top View of Arduino after wiring is completed. 
The black jack on the top right corner of the Arduino Board is used to connect a DC 
Adapter. The Arduino Board can function in a wide range of voltages as it has an 
onboard voltage regulator. The DC jack accept anywhere from 9V to 20V. 
In the bottom right corner of the screen you can see a silver box. It is used to 
connect the Arduino to computer as well as powering up the board. We can also 
power the board by supplying 5V directly to Vin pin of Arduino. This option is not 

 

recommended as the Vin pin bypasses the on board voltage regulator and anything 
above 5V can damage the micro processor.  

 
Fig4. 
Refer the above diagram to properly connect the LCD to Arduino Uno 

 
Fig5 
The Arduino IDE looks like this. 

 

Working 
The Arduino Uno can be programmed using C language. The code given in this project will 
ask Arduino to collect and process output from the sensor , apply it to the formula to find g 
and then display the result on the connected LCD Screen. 
The IR sensor consist of an IR Led and a photodiode. The black one on the sensor is the 
photodiode. The IR sensor used in this project can only give two outputs to the Arduino i.e 
0 or 1 . The IR Sensor constantly gives data to the Arduino in the digital form 0 or 1.If an 
object is in front of the sensor, the IR rays get reflected and is received by the IR Receiver. 
In this case the sensor sends 0 to the Arduino. If there is no object in front of the sensor 
then IR rays are not reflected and hence not received by the IR Receiver. In this case the 
sensor sends 1 to the Arduino. 

 
This is the IR Sensor used in this project. 

When an object is in front of the sensor. 



 

 
IR Sensor images from e
​ technophiles 
When the pendulum executes Simple Harmonic Motion the bob of the pendulum 
will pass in front of the sensor at fixed intervals. When the bob passes the sensor, 
the IR rays will get reflected off the bob and the sensor gives 0 to Arduino. When this 
happens an Internal Clock is started. When the bob again passes the sensor , the 
sensor will give 0 to the Arduino and the internal clock is stopped. In this way the 
time taken for one oscillation is measured. 
The length of the string is stored inside a variable in the Arduino Board. The time 
measured by clock is also stored in another variable and is converted to seconds. 
The on board processor will use these data to calculate the acceleration due to 
gravity at the place of the experiment. 
The code for this project is given below: 
---------------------------------------- 
// by RahulVk
#include <LiquidCrystal.h>
int​ Contrast=​75​;
unsigned​ ​long​ pretime;
unsigned​ ​long​ currtime;
int​ pin = ​8​;
unsigned​ ​long​ timePeriod;
float​ t;
float​ g;
boolean​ flag = true;
​LiquidCrystal​ lcd(​12​, ​11​, ​5​, ​4​, ​3​, ​2​);

void​ ​setup​(){
​Serial​.​begin​(​9600​);
​pinMode​(pin, ​INPUT​);
pretime = ​micros​();
​Serial​.​println​(​"Initialized"​);

​analogWrite​(​6​,Contrast);

 

lcd.​begin​(​16​, ​2​);
}

void​ l ​ oop​(){
​if​ (​digitalRead​(pin) == ​0​)
{
​if​ (flag == true)
{
currtime = ​micros​();
timePeriod = currtime-pretime;
pretime = currtime;
flag = !flag;
t = timePeriod/​1000​;
​Serial​.​println​(timePeriod/​1000​);
t=t​-100​;
t = t/​1000​;
g = ​12.73071552​/(t*t);
​Serial​.​println​(g);
lcd.​setCursor​(​0​, ​0​);
lcd.​print​(​"g:"​);

lcd.​setCursor​(​0​, ​1​);
lcd.​print​(g);
​delay​(​100​);

}
​else​{
flag = !flag;
​delay​(​100​);
}
}

 
What this code does is that it first initialize all the components connected to the Arduino 
Uno Board. Sets the brightness for the LCD display. First part of the program simply 
prepares all the components. 
The second part of the program will calculate the time period of the pendulum by 
measuring the time difference when the bob passes in front of the sensor and stores it in a 
variable timePeriod. The value is divided by 1000 to get the value in milliseconds. If a 
computer is connected to the Arduino Board, the computer screen will display the Time 

 

Period of each oscillation. The value is further divided by 1000 to get the value in seconds 
so we can apply it in our formula. 
The third part of the program acts as a calculator and calculates the value of g by using the 
formula g = 4 Π2 L/T 2 and displays the output on the LCD screen. A layout of the Arduino 
Board is given below. 

 

 

What We Observed 
We were able to get the value of g in a range of 9.7 - 9.9 m/ s2 . 

Under controlled conditions we were even able to get a value which was almost the 
theoretical value of g ​9.80665m/ s2  

After that we changed the length of the string to check how time period varies with length 
and the results we got are in the below table. 
 
Length of String  Time Period  Value of g 

0.37 m  1.22045 s  9.806m/ s2  

0.40 m  1.2689 s  9.806m/ s2  

Limitations 
The stand we used for this project was very weak so we had to choose a very light weight 
ball as the bob. As a result, even small air currents are enough to affect the readings. Also 
the range of the IR Sensor used is very less so we had to move the bob very closer to the 
sensor for it to detect. Hence the bob sometimes hits the sensor. A 16 pin lcd was used for 
the project, if a connection got loose then it is very time consuming to fix it as we have to 
rewire the entire apparatus. 

Precautions 
1. Ensure that the bob lines up perfectly with the sensor when in equilibrium. 
2. All connections made should be well insulated as both the Arduino Uno and LCD are very 
sensitive to small voltage changes and it could short out if two pins come in contact. 
3. Ensure that proper and stable power is supplied to Arduino. 
4 .Do not use the Vin pin to supply power unless there is a stable 5V power source because 
the Vin pin bypasses the voltage regulator and all other safety measures. 
10 
 

Conclusion 
From the above observations we found that the acceleration due to gravity at the place we 
conducted this experiment was approximately equal to 9.806m/ s2 . We were able to prove 
that the acceleration of the pendulum bob is directly proportional to its displacement from 
the mean position and is always directed towards it and that the time period of the 
pendulum bob was directly proportional to the length of the string. By computerizing the 
whole process from taking observations to calculating the value of g we were able to 
minimize blunders like incorrect reading of values, calculation mistakes,etc.  
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11 
 

 
 
 
 
 
 

References 
1. h
​ ttps://www.acs.psu.edu/drussell/Demos/Pendulum/Pendulum.html 
2.​http://ncert.nic.in/ncerts/l/kelm103.pdf 
3.​https://etechnophiles.com/beginners-guide-to-ir-sensor-and-how-to-use-it-with-arduino/ 
4.​https://www.omnicalculator.com/physics/simple-pendulum 
5.​https://www.arduino.cc/en/Guide/ArduinoUno 
6.​https://libraries.io/github/Bouni/Arduino-Pinout 
 

 
 

You might also like