Professional Documents
Culture Documents
- Reviews
View the article online for updates and enhancements.
E-mail: aamoya@ujaen.es
Abstract
We have designed a simple Arduino-based experiment to study free fall.
The experimental data associated to the free and vertical fall movement of a
brass saucer are gathered with the help of an ultrasonic distance sensor and
an Arduino board. The position–time curves obtained from different initial
heights are then plotted and the acceleration of gravity is experimentally
determined using Excel.
male-to-female breadboard jumper wires. During breadboard jumper wires. This board supplies
the fall, we gather the decreasing distance from the voltage to the HC-SR04 sensor. The Vcc and
the sensor to the saucer at different times. Gnd pins of the sensor must be connected to the
The HC-SR04 ultrasonic distance sensor [3] 5 V and GND pins of the Arduino board, respec-
uses the principle of echolocation. The sensor tively, while the Trig and Echo pins of the sensor
has four pins: Vcc (power supply), Gnd (ground), must be, respectively, connected to the Arduino
Trig (trigger pulse input), and Echo (echo pulse digital pins 7 and 8, such as shown in figure 2.
output). A trigger signal of 5 V, lasting for at least An Arduino code like that shown in figure 3 is
10 ms, will cause the transmitter of the sensor to needed to collect the experimental data. This code
emit a short ultrasonic signal and the Echo pin to is similar to that used in other related studies [4].
keep at 5 V. After the receiver of the sensor detects The computer compiles this program and sends
the echo signal, or after a maximum wait time of it to the Arduino board through the USB cable.
38 ms, the Echo pin is reset to 0 V. The HC-SR04 The Arduino board will execute the code and will
ultrasonic distance sensor has an operating range repeatedly send back every 10 ms to the computer
of 2 cm to 5 m, with a resolution of 0.3 cm. the two experimental measurements that we need:
The brass saucer falls freely and vertically the internal clock time, t, and the distance from
with constant acceleration due to gravity, pro- the sensor to the brass saucer, x, at that time. The
vided air resistance is negligible. The position of Arduino serial monitor will show a table with
the saucer with respect to the sensor, x, at time t two columns containing the experimental mea-
is given by: surements, which must be copied from (select
the appropriate data with the mouse, then press
gt2 Ctrl + C) and pasted into a spreadsheet such as
(1)
x = x0 −
2 Excel.
where x0 is the initial position and g = 9.81 m s−2 The Arduino board is measuring the echo time
the acceleration of gravity. with the help of the pulseIn() function, which in this
case measures the total time (in ms) during which
the HC-SR04 sensor keeps the Echo pin at 5 V. The
3. Arduino programming code result of multiplying this echo time and the speed of
The HC-SR04 sensor is connected to the Arduino sound in air at room temperature (343 m s−1) gives
Uno board with the help of four male-to-female the total distance travelled by the ultrasonic pulse.
//FREE FALL
const int trigPin=7;
const int echoPin=8;
void setup() {
Serial.begin(9600); // Initialise Serial Monitor
}
void loop() {
unsigned int echo_time;
float distanced, distancex;
unsigned long time;
pinMode(trigPin,OUTPUT); // Send a pulse
digitalWrite(trigPin,LOW);
delayMicroseconds(10);
digitalWrite(trigPin,HIGH);
delayMicroseconds(10);
digitalWrite(trigPin,LOW);
delayMicroseconds(10);
pinMode(echoPin,INPUT); // Listen to the pulse
echo_time=pulseIn(echoPin,HIGH); // Echo time to get distance d
distanced=echo_time/2.0*0.0343; // Calculate distance d
distancex=sqrt(pow(distanced,2)-pow(1.3,2)); // Calculate distance x
time=micros(); // Time instant t to print
Serial.print(time/1000000.0,2); // Print time t
Serial.print("\t");
Serial.println(distancex,2); // Print distance x
delay(1000); // Wait for 10 ms
}
0.5 5. Conclusion
Position (m)