This experiment follows Galileo inclined plane experiment investigating speed and acceleration of balls rolling down an inclined plane. Galileo used brass balls and bells mounted on an inclined plane, we can use marbles a little opto-electronics and and arduino.
The basic principle is to roll marbles down a track, and through a pair of gates. Each gate has an LED and a photo-resistor. When the marble passes through the gate it will break the path of light changing the resistance of the photo-resistor. An arduino is then used to measure the time the marble passes through the gate. Knowing the distance between the gate and the distance and the elapse time allows calculation of velocity. Repeated measurements with different positions of the gates allows the acceleration of the marble to be explored.
Some details and pictures of Galileo's original can be found Physics Labs, Galileo Ramps.
Step 1: Materials
For the inclined plane
- Cable tracking, square cross section aprox 18mm
- An 8 foot piece of 2" X 1" wood. (240cm 5cm X 2.5cm)
For the ball
- Bag of regular size marbles
For the measuring gates
- 2 LEDS
- 2 photo-resistors
- 2 100 Ω resistors
- 2 22 kΩ resistors
- 2" X 1"
- 4 metal pins
- An arduino
- LCD display (optional)
- 10m double or triple core wire
- Equipment wire
- screw contact blocks
- Soldering Iron and solder.
- Wire strippers
Step 2: Preparing the Inclined Plane
First ensure that the marbles will sit nicely on the cable tracking. It should just touch either side minimising friction.
The strip of wood needs to be marked up with its center-line and perpendiculars at 10cm intervals. The gates will be positioned on the strip with two pins, mine were 34mm apart so mark two points 17mm from the center-line also mark two points half the width of the tracking of the center-line.
Position the cable tracking along the strip of wood so its as straight as possible down the center line, and fasten in place with screws. Drilling guide holes will help keep the track as straight as possible.
Drill holes for the pins on either side of the track at 10cm intervals.
Step 3: Preparing the Photo-gates
Each gate is made with a piece of wood in a U shape section. I used 2" lengths of 3" by 1". (50mm high, 70mm thick and 20mm thick). The slot needs to be wider than the diameter of the marble and high enough for the marble sitting on top of the tracking. I drilled a 20mm diameter whole with center 25mm from the base, and then cut down to make a u shape.
Next drill a horizontal hole all the way through at about the height of the center of the marble, and wide enough for an led and photo resistor to fit in. I did mine 22mm above the base and 5mm or 6mm holes.
Then we want to fix two pins to the bottom of the gate. I used some blind rivets with 3mm dia sheath but you could sections of a steal rod. These need to be long enough to fit securely in the holes in the track but not too tight that its hard to plug in and pull out of the track.
When the track and gates are complete, test to check they fit nicely and a marble will run down the track without obstruction.
Step 4: Photo-gate Electronics
The photo-gate are relatively simple, a voltage divider for the photo resistor on one side and a resistor with appropriate current limiting.
The actual value for the resistors will depend on the particular photo-resistor used. I used an 27kΩ - 94kΩ LDR together with a 22kΩ resistor. Ideally you want to choose the resistor value to create the greatest difference between the output voltage when there is a clear path and the voltage when the path is blocked by a marble.
For the LED current limiting resistor, will depend on the resistor used. For 5V power something in the range 150Ω to 220Ω. I use 100Ω resistors a bit on the low side and I blew one LED.
Mount a terminal block with three terminals onto the top of the gate. These will be 5V, Ground and output from the voltage divider.
I just soldered the resistors onto the LED/photo-resistor and connected the ends to a terminal block using equipment wire.
Mount the LED and photo-resistor on either side of the hole through the gate. Use tape to hold in place.
Step 5: Connecting the Arduino
Connecting the arduino is quite simple. The 5V and GND outputs need to go to both gates. The outputs from one gate goes to pin A0 and the other to pin A1.
You need 2-3m three core leads to each gate. I used various pieces of two core wire with a third piece of wire taped on.
Optionally an LCD display can be attached following the appropriate instructions.
Step 6: Timing
As the marble passes through a photo-gate there is a spike in the output voltage. These spikes are in the order of 10ms. Spikes are detected using a simple threshold. A threshold value is calculated to be 100 more than the the base level. Both the rising and falling edge of the spike are detected and the time is taken to be the average of the two times.
Step 7: The Code
The code can be used with or without an LCD display, just comment of the #define LCD line.
During initialisation the base levels of both photo-gates are recorded taking the maximum over about 30ms. The two threshold values are then calculated to be a 100 units above these.
In the main loop the times when the inputs change from low to high and from high to low are recorded. The average of these is taken as the time for each gate. The average times and the differences between the times of the two gates is output. As its quite easy to get the two gates mixed up the time differences for passing the gates in either order are displayed. Typically only one of the time values will be of interest.
Step 8: Experiments
Once setup serious marble rolling can begin.
Set the track up at a desired angle. Mount the two photo-gates in position along the track and roll the marble down the track. You should get the time difference between passing the gates.
Two main experiments are possible. The first has one gate at the top of the track and another lower down. This measures the elapsed time between two positions. The experiment can be repeated for each position of the lower gate.
The raw data needs a bit of processing. It records the number of steps between the two gate and the elapse time in milliseconds. The axis are the wrong way round and the scales are off but the familiar parabolic shape is evident.
The missing factors are the time and distance from the release to passing the first gate. The distance can be easily measured, but the time needs to be approximated. I've tried fitting the model dist = 0.5 * acceleration * time^2. Where the time is the measure time plus a constant. This produces a pleasing fit.
The second experiment places the two gates one place apart at different places on the track. The time difference here can be used as an estimate of the speed. The data is a little noisier but you can clearly see the speed increasing the further down the track.
Step 9: Conclusion
The experiment was set up for a science session with a group of 10 home educated kids, two sets of equipment were used with two groups of five. The session proved to be a good hands on session, rolling marbles has an intrinsic fun factor. There was good experimental practice with measuring, recording and plotting of data. There was useful science content on speed and acceleration, although some of the subtitles of relationship might of be beyond them.
The total cost of equipment came to under £20 considerably cheaper than other methods using ticker-tape or air tracks.
Step 10: Interupts
Following a suggestion from rfmdelgado you can also use interrupts on arduino digital pins to record the time the marble passes each gate. This requires a little external circuitry to be able to work with the adjustable threshold values need for of each gate.
The first thing we need is a voltage comparator which can compare two input voltages and output a high or low voltage according to which one is highest. I did not have a purpose built voltage comparator chip but its possible to use an op-amp with no feedback loop instead. I followed the instructions from Voltage Comparator Information And Circuits for using an LM358 dual op-amp. As the arduino input impedance is so high, in the order of 10MΩ, its fine to directly connect the op-amp output directly to the arduino digital pin without using a diode or transistor as suggested in the link.
A simple circuit would just compare the output from the gates with the voltage from a variable resistor used as a voltage divider. This would require manual adjustment each time the equipments used.
A better alternative is to use the PWM output from the arduino analogWrite() to provide an adjustable reference voltage. A low pass filter, consisting of a resistor and a capacitor, is needed to smooth the output, I used the calculator at RC Low-pass Filter Design for PWM to choose the values. Quite a large value of 10μF was used for the capacitor as we want to basically get a steady DC voltage with minimal ripple voltage. The resistor I used was 2.2kΩ. There is quite a flexibility in the values used. The filter output is fed into the non-inverting (+) input of the op-amp inputs and output from the gate input fed into the inverting (-) input. On a Uno pins 5 and 6 are used as these have a high 980 Hz frequency giving more leeway on the RC values.
For the code we again have a quite a long training phase. The PWM output is slowly increased, at each step the voltage comparator is read. This will initially be zero and will switch to 1 when the PWM output exceeds the gate. The value when this happens is recoded. The process is then reversed with the PWM output decreased from maximum to zero, the value where the input changes from 1 to 0 is recorded. Finally the threshold value is taken as the average of the rising and falling values plus a fixed increment. This value is written to the PWM which is used as the long term threshold voltage.
With the threshold set interrupts can then be enabled using AttachInterrupt. We are only interested in the RISING mode when the input goes from low to high. Pins 2 and 3 which are interrupts 0 and 1 were used on a Uno. The actual interrupt code is quite simple the time is recorded and the time difference between the two times is the elapsed time of the marble.
Using interrupts could improve the resolution of the timing potentially better than the roughly 1ms obtained from the basic code. However there is considerable variation in the experiment, especially in the exact position the marble is released so there is not too much to be gained.