ATKIN
ATKIN
PAPER
Investigating the Torricelli law using a pressure sensor with the Arduino
and MakerPlot
To cite this article: Keith Atkin 2018 Phys. Educ. 53 065001
Abstract
This paper examines the Torricelli law for the flow of liquid from a small
drain hole in a container. It shows how the system can be modelled using
either a traditional calculus-based approach or a non-calculus step-wise
computer method appropriate to the background of the student group. An
experiment to measure the head of out-flowing liquid as a function of time is
then described. The conventional method of manual timing is replaced by a
pressure-sensing technique involving use of the Arduino microcontroller and
MakerPlot graphing software.
t1 := 0 s g := 981 cm s–2
tend
n:= H := 20 cm
∆t
( ) 2
b
n = 650 points k := B . √ 2.g h1 := H v1 := √ 2.g.H
tdrain := 2.√
k = 0.1474 cm1/2s–1 H
k
tdrain = 60.66 s
H h
for i ∈[1..n]
20
16
h / cm
12
0
0 10 20 30 40 50 60
t/s
M
180
v / cm s–1
120
60
0
0 10 20 30 40 50 60
t/s
N
Drain
+5 V
GND
A0 To PC
50 pF 51 kΩ
3
MPX5010DP 2
1 Filter circuit ARDUINO
P1 P2
Transducer pins:
1 Output voltage (notch in pin)
2 Ground
3 Supply voltage
void setup()
{
Serial.begin(9600);
Serial.println(); // clear garbage
Serial.println("!RSET"); // reset XY plot
}
void loop()
{
N = analogRead(A0); // read input from sensor to port A0
V = G*N; // convert to voltage
h = (V-V0)/beta; // calculate head in cm
if(h<=H) // test for starting head H
{
Serial.print(t); // output t to channel 0
Serial.print(","); // separator
Serial.println(h); // output h to channel 1
t = t + Dt; // increment time
}
else
{
Serial.println();
Serial.println("!RSET"); // keep resetting plot till h <= H
}
}
here is to measure the variation of liquid head Hence, the sensor produces a voltage dependent
with time using a pressure sensor coupled to an on h. The manufacturers recommend a simple
Arduino microcontroller. The device used was the noise reducing filter circuit be placed between the
MPX5010DP, a piezo-resistive silicon transducer MPX5010DP output and the input of the micro-
(A similar device was used by Ladino et al to controller. This is shown in figure 6. With the
investigate the Gay-Lussac law [3]). This sensor other electrical connections.
costs just a few pounds and is manufactured by Before use, it is necessary to calibrate the
NXP and sold by Systs Ltd on Amazon. system. This is easily done by filling the can to
A 30 cm tall transparent cylindrical can is greater and greater measured heads h (with the
fitted with a short drain tube, of internal diam- drain tube plugged!) and recording the corre
eter (ID) 6 mm, about 3 cm above the bottom sponding sensor voltages.
of the can. This marks the datum line. The sen-
A linear relation of the form V = βh + V0
sor has two ports P1 and P2. The device meas-
is obtained where V is the output voltage, β
ures the pressure difference between P1 and
= 0.041 V cm−1, and V0 = 0.279 V
P2. P1 is attached to the top of a narrow acrylic
tube (ID 3 mm), the bottom of which as held at This calibration is used in the Arduino code
the datum level. P2 is open to the atmosphere. to calculate h as a function of time t.
20
15
h / cm
10
0
0 10 20 30 40 50 60
t/s
The Arduino code is shown in figure 7. To To run the experiment, the can is filled with
obtain a graphical output, I use MakerPlot2, a water to a level a couple of centimetres above the
readily downloadable software package which I desired initial level H. The drain plug is removed
have described in a number of my previous papers and plotting starts automatically when the water
[4–7]. The Arduino is connected to a PC, with passes level H.
Arduino code and MakerPlot loaded together. It
was found most convenient to use MakerPlot’s
XY plotting interface, using the X-axis for time Results
and Y-axis for measured depth. The outcome of a typical run with H = 20 cm, is
shown in figure 8, in which the predicted drain
time of just over 60 s is confirmed. A closer com-
2
MakerPlot is downloadable from makerplot.com. parison of theory and experiment is possible by