Looking back, this project combines allmost all of the tutorials that I have read in this short period: blinking LED, push button, piezo and LCD display. A useful project for every beginner!
I have made this device for some of my friends who have a hard time admitting how fast alcohol influences their driving abilities.
It will test you on three levels because they all have to do with driving a car safely:
- DECISION time.
- REACTION time
- Resistance to DISTRACTION.
However, driving has to do with making fast decisions as well. So in random order you can get a green or blue light first (or multiples). You should not react to this and hold down the push button until the red light appears.
Finally, on occasions you will hear a short beep in between lights (just for fun). By now you are so tense to do well, that a simple distraction like a beep can and WILL set you off!!
A fun game with your dinner guests upon arrival and confronting upon leaving!
Step 1: What You Need
- Arduino microcontroller (I have used an Uno).
- 1 RGB LED (you can use 3 separate ones if you like).
- 4 resistors (220 ohm).
- LCD Display
- Piezo speaker
- Push button.
- Ping pong ball (optional).
Step 2: The Hardware.
Drawings were made with software by "Fritzing" (http://fritzing.org).
I have used a RGB Led with a common Anode (3 Cathodes: R, G, B). Therefore the setup may seem a bit ackward. The consequence is that in the sketch (step 3): HIGH=off and LOW=on.
Step 3: The Sketch.
Step 4: The Box.
Picture 1: Drill the pattern in the bottom of the box (to hold the Arduino in place). Hole size 3 mm.
Picture 2: Drill and cut two holes in the side for the USB connection and power supply (if you do not need to program the controller anymore and you have chosen to use batteries, you don't need this step. The Arduino is kept in place with small bolts (remove it prior to painting!).
Picture 3: Cut a slot in the lit of the box for the LCD. Drill another two holes, one for the LED (ping pong ball) and another one for the push button. Make sure that the hole for the ping pong ball has a sloping face.
Picture 4: Take two caps of a Coke bottle and cut the top section of the bottle as well. Glue the bottle top sections to the side of the box (make sure you have a nice and flat face for the glue).
Sand the box with a fine sand paper.
Picture 5: Apply several layers of paint (without the Coke caps).
Picture 6, 7, 8: install the Arduino. I have used a small breadboard for the components (Piezo and Pot. meter of the LCD). The LED was solderd seperately. Since the Arduino is tightly bolted into place, foam blocks can be installed against it and thus providing a tight fit for the LCD.
I didn't have red, blue and black wires so I used purple, green and grey: