Brought to you by:
Frontline The following article is Free article

Using scratch programming to control photogates in educational physics experiments

and

Published 22 October 2019 © 2019 IOP Publishing Ltd
, , Citation L F da Silva and P S Carvalho 2020 Phys. Educ. 55 013001 DOI 10.1088/1361-6552/ab49e0

0031-9120/55/1/013001

Abstract

This frontline shows how to build a computer-controlled photogate using Snap4Arduino, a programming environment derived from Scratch for controlling the Arduino microcontroller board. The advantages of the proposed photogate are that it is affordable to schools, easy-to-assemble and simple to use by younger students in secondary schools who are not familiar with programming languages. An experiment was conceived to evaluate the device proposed that matched the performance of a commercial photogate. We show that the computer-controlled photogate setup can be used in experiments with objects moving fast (like in free fall) with a good precision.

Export citation and abstract BibTeX RIS

Introduction

In physics laboratory activities concerning kinematics in middle and secondary schools, students need to determine speed and acceleration by definition, concepts that involve time measurements. In most cases, students make use of a timing device of events called photogate, which sometimes requires purchasing additional software.

Alternative less expensive photogates have been proposed in the literature [1, 2], relying on the low-cost Arduino microcontroller board as a data acquisition system. The Arduino uses C/C++ as the programming language, but line code can be difficult to implement by teachers and younger students in secondary schools if they have no prior knowledge in programming.

Fortunately, there is a more friendly programming environment called Snap4Arduino [3]. It has a drag-and-drop user interface and is a modified version of Scratch [4]. Snap4Arduino interacts with Arduino and includes a series of coding blocks allowing one to manipulate the basic functions of the Arduino board by people not familiar with C/C++.

In this work, we used Snap4Arduino, which implements functions that make time measurements possible in the order of milliseconds, to build a Scratch-controlled photogate.

Experimental set-up

The built-in photogate, shown on the left-hand side of figure 1, is a simple u-shaped Styrofoam packing case with two holes where the infrared LED (emitter) was placed in one side and the phototransistor (detector) on the other side. These are connected to the breadboard by four crocodile clips. When the emitted beam of light falls on the detector, the output voltage is low, but if this light is blocked the output voltage signal goes high, triggering a computer-controlled timer.

Figure 1.

Figure 1. The experimental setup: on the left side the 'photogate' made with Styrofoam packing discarded and on the right side the sketch of the photogate circuit with emitter (dark blue) and detector (dark grey) infrared components.

Standard image High-resolution image

The solderless electronic circuit build on the breadboard, shown on the right-hand side of figure 1, is similar to that described by Galeriu [1] and uses just one infrared phototransistor PD333-3B/H0/L2 (peak wavelength at 870 nm), one infrared LED (peak wavelength at 870 nm), two 10 kΩ resistors in series, a 220 Ω resistor and jumper wires. The Arduino Uno supplies a voltage of 3.3 V and the trigger pulse output was connected to the digital pin 8.

To take the advantages of Snap4Arduino we set up the Arduino with Joan Guillén's SA5Firmata library [5].

Results and discussion

To evaluate the quality of our photogate, we prepared an experiment to measure the acceleration g due to gravity of an object in free fall. We dropped a rectangular piece of clear acrylic with two spaced opaque black bands through the photogate (figure 2), measuring the time the light is blocked by the black bands and the time the light is unblocked. The opaque bands are made of black tape 19 mm length and the distance from the leading edge band to the leading edge of the next band is about 30 cm.

Figure 2.

Figure 2. Experimental setup for the free fall experiment.

Standard image High-resolution image

The Scratch code shown in figure 3 is available in [6]. The light-blue block of code implements the Arduino pulse-in function (pin, value, optional timeout) that returns the pulse width in microseconds. The parameter pin is the number of the pin on which we want to read the pulse: the value is either HIGH or LOW and the timeout (optional, default is one second) the number of microseconds to wait for the pulse to start. Pulse width is the amount of time the pulse takes to go from LOW to HIGH, and back to LOW again.

Figure 3.

Figure 3. The Scratch code for the Free Fall experiment using Snap4Arduino environment [6].

Standard image High-resolution image

The Scratch block code executes two loop functions, to measure the time in microseconds when each band passes and saves the current time in milliseconds when it leaves. We can read the time intervals dt1 and dt2 when the light is blocked (which allows the calculation of the average speed when each band passes by the photogate and will be treated as approximately the instantaneous speeds) and the time interval Dt  =  tf  −  ti between the two blocks of light (that will be used for the determination of the average acceleration g by its definition).

We have done similar experimental measurements with a Pasco photogate model ME-9215A to compare with those obtained with the Scratch-controlled photogate (table 1). The Pasco equipment was adjusted for a resolution of 0.1 ms while Scratch provided the time in microseconds.

Table 1. Record of direct and indirect measurements that allow the determination of the acceleration g due to gravity of an object in free fall. The last column refers to the average of g.

Scratch-controlled Photogate Δt1 (µs) Δt2 (µs) Δt (ms) v1 (ms−1) v2 (ms−1) g (ms−2) Average g (ms−2)
  16322 6967 162 1.164 2.727 9.649 10.06
16554 7023 149 1.148 2.705 10.454
16326 6955 167 1.164 2.732 9.390
16397 6980 150 1.159 2.722 10.422
16254 6938 151 1.169 2.739 10.395
Pasco (ME-9215A) Δt1 (ms) (gate mode) Δt2 (ms) (gate mode) Δt (ms) (pulse mode) v1 (ms−1) v2 (ms−1) g (ms−2) Average g (ms−2)
  19.5 7 177.2 0.974 2.714 9.819 9.82
  19.7 7 177.6 0.964 2.714 9.853
  19.5 7 177.6 0.974 2.714 9.797
  19.5 7 177.3 0.974 2.714 9.813
  19.6 7 177.4 0.969 2.714 9.836
  19.5 7 177.2 0.974 2.714 9.819

The results obtained with Pasco equipment need two drops, made sequentially in gate and pulse modes. However, with the Scratch setup we need only one single drop, which is one advantage for this setup.

The average values obtained experimentally for g with both photogates differ only in about 2%. With the Scratch-controlled photogate we obtained an average acceleration g  =  10.06 m s−2, which is in excellent agreement with the standard value of the acceleration of gravity.

Conclusion

The experimental results attest that it is possible to get reliable results with simple, low-cost equipment. The Scratch-controlled photogate is an easy-to-assemble setup that unveils what a computer program does, provides an easy communication with Arduino and enables students to understand how a photogate works by interpreting block code. It has the advantage to be used by younger students in secondary schools that are not familiar with programming algorithms and line code language. Another advantage for the Scratch setup is that it can be used to measure times in experiments with objects moving fast (like in free fall) and needs only one single experiment for data acquisition. This photogate can be used for implementation and integration in STEM disciplines with young students and draw students' attention to the idea that measurements of time intervals can be a tricky parameter to control.

Acknowledgments

The authors are indebted to Instituto Federal Goiano and to Foundation for Science and Technology, Project UID / NAN /50024/2019 for funding this work.

Please wait… references are loading.

Biographies

Paulo Simeão Carvalho

Paulo Simeão Carvalho is an assistant professor at the Department of Physics and Astronomy, Faculty of Sciences, University of Porto since 1998. He is also researcher at IFIMUP and member of UEC (Unit for Teaching of Sciences). His research interests are multimedia curricular materials, active learning, physics education and teachertraining.

Luciano Fonseca da Silva

Luciano Fonseca da Silva is a professor at the Instituto Federal Goiano since 2010. His research interests are physics and science education.

10.1088/1361-6552/ab49e0