My son wanted me to enter the 'grown-up' category of his Cub Scout pinewood derby competition so i built an Arduino-afied car.
Its a police car with 6 LED's (2x clear headlights, 2x red tail lights, 1x red & 1x blue for the siren), a 3 axis accelerometer to detect movement and a piezo speaker for the sound effects. It's all controlled by an Arduino Pro Mini.
The logic is simple... If the car moves: turn on the lights, flash the police light bar, make the siren noise. If the car stops: do a little disco flash, play a random nerd song, go into 'idle mode' and wait for some motion.
This all works great and (IMHO) is kind of nifty! But...
Its very annoying to carry the car around (the peizo is a little loud). I need a way to control WHEN to start detecting movement. My idea is to find an easy way to detect when the car is on the track/table/ground.
What's the best quick, cheap and easy way to detect that my Pinewood derby car is touching the track/table/ground and not being carried around?
Any ideas would be appreciated!! I'm limited by weight (the car has to be 5oz or under and I'm at an AUW of 4.7oz) and space.
I'll be sitting/standing in the crowed while the boys handle the race... i won't be able to switch it on/off.
I like the idea of the LED's.. one for the undercarriage effects and a photoresistor for the reflection detection? Or is it possible to do it all with one LED (the led is both the light and the detector)?
Now that i think about it... i made the car a little more complex then it needed to be. I should have just mounted an IR reflective sensor in the wheel well and put a bit of reflective coating on the inside edge of the tire. The Accelerometer was probably a bit overkill :
I like the idea of the LED’s… one for the undercarriage effects and a photoresistor for the reflection detection?
That would probably work; what I was trying to say is that if you use a phototransistor (instead of a photoresistor), you would likely only be able to use certain colors of LED, depending on the phototransistor used - most are fairly narrow in bandwidth (concentrated around the IR region).
However, a photoresistor could probably be used with nearly any color LED - since you only need to detect “on/off” surface, it doesn’t need to be that accurate. You’ll likely want to recess at least the detector a bit inside the wood (1/4 inch or so), so that the light from the LED only strikes the sensor when it is on a surface.
Note that this technique will likely have problems with matte black and other non-reflective surfaces (but you are unlikely to come across many of them).
Or is it possible to do it all with one LED (the led is both the light and the detector)?
While it is possible to use an LED as a photodetector of sorts, it can’t be done while operating the LED normally.
Why not use the accelerometer itself? Probably when on the Pinewood Derby track it will be at a very specific incline and not moving for a few seconds. You can calibrate to that gravity vector orientation and if you see it, and it doesn’t change for a few seconds, enable the piezo algorithm.
Consider a small, thin (light) piezo on the bottom. Pulse it ultrasonically and then listen for an echo. You don't have to listen for very long because the reflective surface isn't very far away when it is on the track.
Interesting idea.. It already has a small piezo on the bottom (used for sound). Any sample code on how this would be done?
Why not use the accelerometer itself? Probably when on the Pinewood Derby track it will be at a very specific incline and not moving for a few seconds. You can calibrate to that gravity vector orientation and if you see it, and it doesn't change for a few seconds, enable the piezo algorithm.
That was my first thought... but im worried about getting the angle wrong since i haven't seen the track yet. I'll play around with that idea this weekend.
I did add an on-off 'switch' for the sound last night using the accelerometer... by vigorously shaking the car for 5 seconds it will either turn on or off the sound. My kids thought it was a cool idea and its funny to watch them try to do it.
Thanks for the ideas guys! Hopefully i can implement something before the race.