I've been wanting to build some kind of speed trap experiment for ages, and today I finally built it, and it worked out great - total component costs less than $1 to answer the question that every five year old boy, and everyone who's ever been a five year old boy wants answered: Could Lightning McQueen beat the Batmobile in a straight race?
To answer this, we need to build a speed trap to measure their top speed. As speed is just distance divided by time, the easiest way to do that is to trigger something at one point on the track to start a timer, and then trigger further along the track to stop the timer. We can measure the distance, divide it by the measured time and we've got our answer!
There are bunch of different triggers we could use but by far the best is a light dependant resistor. These cost pennies, and I had a bag of 20 or so, so I melted a couple of holes at each end of a piece of hot wheels track and put an LDR in each.
The LDR has a low resistance when there's light shining on it, and a higher resistance when not. The ones I had measured around 10Kohms so I wired the LDR at the top of the track between 5V and Arduino A0, and a 10K resistor from A0 to 0V. I repeated this at the other end of the track with Arduino A1 to stop stop the measurement.
I also used an LCD Shield for display and a Sensor Shield to make hooking this up easier, but they're strictly optional.
make lcd device
make message string
make startTrigger analog input A0
make endTrigger analog input A1
make startTime number
make recordedTime number
make recordedSpeed number
make distance number
when start
.set distance to 0.3
.
.forever
..tell lcd to "clear"
..set message to "Hot Wheels Speed Trap"
..tell lcd to "show"
..set message to "ready..."
..tell lcd to "show"
..wait until startTrigger < 0.5
..set startTime to timer
..wait until endTrigger < 0.5
We could use the same code to wait for the timer to end, but if you're timing over a longer piece of track you might like to use:
..repeat until endTrigger < 0.5
...tell lcd to "clear"
...set message to [timer - startTime ]
...tell lcd to "show"
..set recordedTime to timer - startTime
..set recordedSpeed to distance/recordedTime
..
..set message to "time :"
..set message to join message [ recordedTime ]
..tell lcd to "show"
..set message to "speed (m/s):"
..set message to join message [ recordedSpeed ]
..tell lcd to "show"
..wait 5 secs
..set recordedSpeed to recordedSpeed*3600/1000
..set message to "speed (kph):"
..set message to join message [ recordedSpeed ]
..tell lcd to "show"
..wait 5 secs
So what to the results tell us? Well both cars clocked in at 0.10 seconds for the 30cm distance, giving a speed of 3m/s or around 11km/h when run down a ramp about 1m high.
That's a potential energy (mgh) of 10m (where m is the mass of the car, h is the height and g is gravity which I'm calling 10 cause its close enough). That gets turned into kinetic energy(1/2 mv^2) or about 5m (1/2m*3*3 - I'm rounding up again!). That's actually pretty good as there's a lot of friction to be dealt with and we're turning the car through 90 degrees as it wants to drop down, but we push it forwards, so 50% efficient isn't at all bad. The best we could hope for on this track is about 4.5m/s or 16km/h.
There's lots more you can do with this - different cars, different heights, different shapes of tracks.
That's a potential energy (mgh) of 10m (where m is the mass of the car, h is the height and g is gravity which I'm calling 10 cause its close enough). That gets turned into kinetic energy(1/2 mv^2) or about 5m (1/2m*3*3 - I'm rounding up again!). That's actually pretty good as there's a lot of friction to be dealt with and we're turning the car through 90 degrees as it wants to drop down, but we push it forwards, so 50% efficient isn't at all bad. The best we could hope for on this track is about 4.5m/s or 16km/h.
There's lots more you can do with this - different cars, different heights, different shapes of tracks.
No comments:
Post a Comment