[Home Page]

Measuring Motion Using a Macintosh Computer

(Published in Australian Science Teachers Journal, 39, No. 2, pp 44-51. June 1993.)

Jon M Pearce

School of Physics

University of Melbourne,

Parkville, Victoria,

Australia, 3052




A laboratory computer system is described which enables students to obtain real-time graphs of moving objects using a Macintosh computer. The hardware and software are explained together with an evaluation of the performance of the system. Several applications are discussed ranging from introductory laboratory work to student projects.


Short biographical resume of author:

Jon Pearce is a Senior Lecturer in Physics at the Institute of Education, University of Melbourne, where he has taught physics for eleven years. He has had previous experience teaching physics in a secondary school for six years.


Measuring Motion Using a Macintosh Computer


The idea of using a computer to measure the speed of objects should not be new to most physics teachers. A variety of techniques (Pearce, 1989) and equipment is available. See, for example, the Vernier catalogue for a range of interfaces for several computers. However the Macintosh computer has been used infrequently for such applications because of its lack of suitable interfacing ports. The basic Macintosh (MacPlus, SE, Classic, etc.) has no parallel ports (which made the BBC computer so ideal for laboratory interfacing) and has only one internal expansion slot. Some interfaces are available, but they tend to be designed around microprocessor circuits and hence, whilst flexible and powerful, are rather expensive (such as the Universal Laboratory Interface).

This paper describes part of a project at the Institute of Education to develop low cost laboratory interfaces for the Macintosh computer to be used in science laboratory work. The particular interface described enables the Macintosh to measure the position of a moving object and then display graphs of the object's position, time and acceleration. Other work in the project has been the development of a general data logging interface and a robotics interface (Lego-style).


Overview of the System

The distance measuring system connects to the serial port of the Macintosh. It comprises an ultrasonic transducer, as the active part in the measuring process, and an electronic interface to drive it. This transducer emits a burst of high frequency sound pulses (at a frequency of about 50 kHz) and listens for the echo reflected from nearby objects. The interface electronics times the delay between transmission and echo, sends this information back to the computer which then uses a known value for the speed of sound to calculate the distance to the object.

The above takes place repeatedly at a rate of between 5 to 20 times per second. The controlling program (called DistanceData) generates graphs on the screen of velocity, speed or acceleration versus time. Two such graphs can be viewed at any time and are displayed as they are recorded in real time. This is an important feature of the system as it allows students to ‘get a feel’ for the motion they are studying by giving them instant and continuous feedback. Figure 1 shows a typical screen display of position and velocity taken from a person walking away from the transducer.

Figure 1: Position-time and velocity-time graphs for a person walking. Note the variations in the velocity graph due to individual footsteps.



Figure 2: Velocity-time and acceleration-time graphs for a person walking. The small degree of smoothing makes the footsteps very prominent in the acceleration graph.


The scales of the graphs can be changed using pull-down menus, as can the rate of measurements and the degree of smoothing applied to the data. Smoothing is necessary for the speed and acceleration graphs as small errors in the position data are amplified by the differencing algorithm used in their calculation. It is useful to be able to vary the degree of smoothing so that specific features of the motion (such as the footsteps of a walker) may be observed. For example, Figure 2 shows the velocity and acceleration graphs for the same walking motion. Notice the 'bumps' in each graph caused by the individual footsteps of the walker. In Figure 3, the same data are shown, but with increased smoothing on both graphs. Now the obvious feature becomes the periods of positive and negative acceleration at each end of the walk.

Figure 3: The same velocity-time and acceleration-time graphs for a person walking but with the smoothing increased.


The raw speed-time data recorded by the computer may be output to a text file for later analysis in a spreadsheet. Previously recorded data may be loaded into the computer providing a facility in which students may try to reproduce a motion previously recorded. This is explained later.



The hardware of the system comprises three parts together with the ultrasonic transducer itself: a serial-to-parallel communication interface, a 16-bit timer and a driver circuit to control the transducer (Figure 4). Photo 1 shows the transducer set up to sense a ball rolling along a ramp. In the background can be seen the interface box. Each part of the system is described briefly below.


Figure 4: the components of the system


The Communication Interface

This part of the system takes serial data (ASCII numbers) from the Macintosh’s serial port and converts each eight-bit byte into eight individual signals which are used to control aspects of the electronics. (Actually, only one of the bits is used; this one tells the transducer driver circuit when to emit a sequence of pulses). It also has the task of sending two bytes of data back to the Macintosh representing the elapsed time between the transmission of the ultrasonic pulse and the return of its echo. (Sounds clever, eh! But most of this is done by one large integrated circuit (MC14469) known as a Universal Asynchronous Receiver Transmitter, or UART).

The Timer

The timer’s role is to time accurately the elapsed period between emitting ultrasonic pulses and receiving the echo. It consists of a 16-bit counter which counts the regular pulses from a 307.2 kHz clock. The rate of this clock, and the number of bits in the counter, together determine the duration and resolution of the time measured. The period of a 307.2 kHz clock is 3.25 microseconds which is hence the smallest time interval resolvable. A 16-bit counter can count through 65,536 states, hence the maximum duration that can be timed is 65,536 x 3.25 = 213 milliseconds.

Assuming the speed of sound to be approximately 342 ms-1, and remembering that the sound pulses travel to the object and back again, this dictates that the theoretical limits of distance measurements are from 0.5 mm (resolution) to 36 metres (maximum distance). In practice this maximum distance is limited to about 10 metres by the sensitivity of the transducer circuit.

Transducer Driver Circuit

This circuit has the task of sending a burst of ultrasonic pulses to the transducer and, at the same time, starting the timer circuit timing. It must also detect the echo and then send a signal to stop the timer and transmit its count value to the Macintosh via the UART. Most of this is carried out by a small interface kit supplied by Polaroid; both the circuit and transducer are used in the Polaroid Land Cameras. This interface kit contains circuitry to send a sequence of pulses to the transducer, amplify any signals detected by the same transducer and then output a logic signal when an echo of the correct frequency is detected. The circuit is sophisticated in that it sends a mixture of frequencies to allow for materials that reflect better at one frequency than another. It also continually increases its own gain as it waits for an echo, so that the faint echoes from more distant objects can be detected.



The software has the task of controlling the interface, recording incoming data and displaying one or two graphs on the screen in real time. It was written using the Microsoft QuickBasic compiler (Microsoft, 1988). A philosophy in developing this software was to allow students to see graphs being drawn on the screen as an object moves and to see the relationship between the graphs. Hence students can choose any two of position, velocity or acceleration to be displayed one above the other. However, it was not intended that the computer do all the thinking for the student. If the student intends to use the data for further analysis, then he or she has further access only to the position-time data by way of a text file written to disc. From the student’s point of view, the system is there to provide graphs to view and interpret while recording data. Any further analysis must be done by the student working from the original data, using a spreadsheet, and setting up all the relevant relationships for herself.

The menus allow the students to change the scale of each graph and to vary the total duration of the data collection. The rate at which measurements are taken can also be varied between the values of 5, 10, 15 and 20 measurements per second. All but the last produces a real-time display. (Twenty readings per second is a little too fast for the software to keep up. Hence at this rate the data are taken, then the graphs are displayed). The Smoothing  menu allows the student to vary the number of time intervals over which the speed and acceleration data are smoothed. The default setting allows reasonable graphs to be produced in most situations (as shown in Figures 1 and 2).

The Save option under the File menu allows the raw position-time data to be saved on disc as a text file. This is in a form that can readily be loaded into a spreadsheet, such as Excel (Microsoft, 1991) or MS-Works. (Microsoft, 1986) From here students can enter formulae enabling them to carry out further analysis on their data. For example, in studying the motion of toy cars, they may wish to calculate the changes in momentum of the car as it accelerates along a track. Alternatively, they may wish to load the data into a graphing program such as Cricket Graph (??) and produce presentation-quality graphs of the original data.

The Load option under the File menu lets previously saved data be loaded for comparison purposes. For example, in an introductory laboratory session, students are given the task of moving their own bodies to try to match position and velocity graphs to the ones previously loaded from disc. Not such an easy task!



As mentioned earlier, the range of the Polaroid transducer is limited to about 10 metres and the accuracy of the interface’s clock limits the resolution to a theoretical value of about 0.5 millimetre. In practice the resolution is never this fine due to uncertainties in the actual part of the surface that is reflecting. A stationary object will generally produce steady data but with about one in four values up to 10 mm in error. This error is generally not perceivable on the scale of the position graphs shown, and is reduced by the smoothing in velocity and acceleration graphs.

Figure 5 shows the deviation of distance data collected during a 7 second period for a stationary object at a distance of 60 cm from the sensor. The deviation ranges over about + 1 cm, or + 1.7% at this range. Duchesne et al (1991) discuss a technique for improving this variation by using the best of three echoes per data point (the echo corresponding to the shortest time being the most accurate one).

Figure 5: the deviation from the mean of measurements taken from a stationary object at 60 cm distance over a 7 second period. Data rate was 15 Hz.

The absolute accuracy of the position data recorded is determined mainly by the accuracy and stability of the clock circuit and the accuracy of the assumed value for the speed of sound in air. The clock circuit is very accurate (controlled by a crystal oscillator to within 0.01%). The value of the speed of sound introduces the most systematic error to these data as it is not corrected for temperature or humidity effects. Over a temperature range from 15o C to 25o C the speed varies around a mean value by about + 1%. This a small and tolerable error which affects directly the accuracy of the recorded position.


Application & Experience

The system is used with undergraduate physics students in two ways. Firstly it is used to introduce those who have done no prior physics to the basic ideas of position, velocity and acceleration graphs. Later it is used as part of a project in which students obtain data from a variety of moving objects and are given the task of analysing the motion using a spreadsheet.

An Introduction to Motion

Until you have tried to move your body with constant acceleration, is it hard to appreciate just how difficult is it! It is also hard for many students to obtain a deep understanding of the meaning of the various graphs until they have made their own bodies move and watched the graphs forming as they move. These two activities, trying to match a given motion and observing graphs drawn in real-time, form the basis of the introductory work using the equipment (photo 2).

The personal aspects of these activities should not be overlooked. Others have commented on the learning that can take place when a student’s body is closely coupled with an experiment (see, for example, Thornton, 1990). The students are no longer watching the motion of an impersonal object and charting its progress, but they are moving their own bodies and getting a feel for the motion and the resulting graphs produced. The result for a person walking can even show up their individual footsteps, as was shown in Figure 1.

For each activity students are required to predict the resulting graphs before obtaining them. For example, during the investigation of the motion of a ball rolled up an incline, students predict and sketch the velocity and acceleration graphs. Many students are surprised to see the acceleration remain at a constant value for the entire motion and this promotes much valuable discussion about the interpretation of "zero velocity".

Project Work

After mastering the equipment and becoming convinced that it does represent their motions accurately, students are required to use it to obtain data from a variety of set-ups and then carry out analyses relating to various aspect of mechanics. The set-ups offered are:

The bounce of falling balls

The transducer is mounted at the top of a three metre length of 10 cm PVC conduit (drain pipe). Balls can be inserted into a hole in the side, near the top, and their motion recorded as they fall and bounce on the floor at the bottom (see photo 3). A typical graph for a bouncing superball is shown in Figure 6. From these data information about the coefficient of restitution can be obtained, as well as the acceleration of a falling body and, in the case of a table-tennis ball, air resistance. (Note that the slight smoothing applied to Figure 6 makes the bounce in the velocity-time graph appear to take place over a longer time interval than it actually does.)

Figure 6: graphs for a bouncing superball. Note that the transducer was at the top of the fall, hence the distance graph shows the distance fallen. Constant acceleration during falling shows up as equally sloping lines to the right.

Motion with air-resistance

With the transducer mounted at the bottom of a similar tube, but of diameter 15 cm, light objects can be dropped down the tube onto the top of the sensor (protected by a light wire grid). This allows a study of the effects of air resistance on falling objects to be made. Objects such as cardboard cones, balloons, etc., are used and their surface areas or masses changed in order to explore relationships.

Motion of toy cars

"Pull-back" toy cars, which accelerate after being pulled back and released, are ideal objects for the study of linear, non-uniform motion. A track is made from a 6 metre length of 10 cm PVC conduit. The curvature of the conduit serves as a guide to keep the cars travelling straight without making contact with any frictional surface that might affect their motion. Investigations are undertaken of the effects of the mass of the cars, the energy initially stored by the pull-back motors, air-resistance, collisions, slope of track, and so on. Photo 4 shows the start of the conduit with a car ready to start.

Each of these projects provides students with a set of position-time data from which they must calculate whatever other data are useful to them. This involves learning to use a spreadsheet as a calculation tool to carry out simple numerical differentiation to obtain speed and acceleration data, and also to calculate quantities such as momentum, energy, force, etc. The computer provides the raw data, but the students control the analysis.

The students are placed in a position of obtaining and measuring real data - not data obtained from equipment designed to remove real-world effects such as air resistance, non-uniformity, irregularities, etc. They are encouraged to design their own experiments and ask the appropriate 'what-if' questions. Having been supplied data from the computer, they then have to make decisions about what are acceptable variations in the data, how to smooth out random errors (either using the computer, or by hand), what quantities to select, graph and include in a report, and so on. The total process is one of doing some real experimental investigation.


Discussion and Conclusion

The system described opens up a range of measurement and analysis activities involving moving objects. The data produced, whether students moving their own bodies or projecting other objects, are real and encourage careful interpretation.

We have found that when moving their own bodies, students relate well to the graphs produced. They are prepared to make predictions about the expected graphs and then argue the interpretation when the actual results differ from that expected. Even the best students show confusion between velocity and acceleration - especially when predicting the acceleration of a ball when it reaches the very top of a slope!

The project work gives students an opportunity to apply their physics knowledge in a context more real than traditional problem solving. For example, some elect to measure the initial acceleration of a pull-back car as it speeds up along a track in order to compare it with their speed-time data. This they can do by using a ramp and finding at what slope the car will only just move up the slope. They then use their knowledge of components of forces, ask questions about friction, driving forces, etc. in order to complete the analysis.

The data obtained is far too extensive for manual analysis. The computer is appropriately used to aid analysis, but the students must make sensible decisions about when their own skills outperform those of the computer. For example, smoothing a ragged acceleration-time graph by eye, and then drawing in the best curve by hand, is usually a much quicker and better process than spending hours trying to develop a suitable spreadsheet technique (unless much data is to be treated this way). The delineation between the computer as a helper and the computer as a hindrance is an important one for students to learn.

The equipment has performed well for a variety of tasks and adds life to an otherwise dry topic!



The layout, construction and testing of the ultrasonic interface was expertly carried out by Mr Russel Walsh, Physics Technical Officer.



Duchesne, B., Fischer, C. & Gray, C. (1991). Inexpensive and Accurate Position tracking with an Ultrasonic Ranging Module and a Personal Computer, American Journal of Physics, 59 (11), 998-1002.

Microsoft (1986), Microsoft Works, Microsoft Corporation, USA.

Microsoft (1988), Microsoft QuickBasic, Microsoft Corporation, USA.

Microsoft (1991), Microsoft Excel 3.0, Microsoft Corporation, USA.

Pearce, J. M. (1988). Measuring Speed Using a Computer: Several Techniques, Physics Education, 23, 291-296.

Thornton, R. K. & Sokoloff, D. R. (1990). Learning Motion Concepts Using real-Time Microcomputer-based Laboratory Tools, American Journal of Physics, 58 (9), 858-867.

[Back to J Pearce Home Page]

These pages are maintained by Jon Pearce ( jonmp@unimelb.edu.au), Department of Information Systems. The opinoins on them do not necessarily reflect those of the University of Melbourne. Tel: (613) 8344 1495 Fax: (613) 9349 4596. Last update: September 16, 2003 .