(1x) Arduino Uno REV 3 Radioshack 276-128
(1x) Switch-Magnetic Reed Radioshack 55050593
(1x) 10K Ohm 1/4-Watt Carbon Film Resistor Radioshack #271-1335
(1x) 9V Alkaline Battery Radioshack #23-866
(1x) Heavy-Duty 9V Snap Connectors Radioshack #270-324
(1x) PC Board with Copper Radioshack #276-147
(1x) Parallax 27977-RT Serial Backlit LCD Radioshack 276-120
(x2) SPST PC-Mountable Submini Toggle Switch Radioshack #275-645
(2x) Male Header Pins Jameco 103393
(1x) Female Pin Sockets Jameco 308567
22 Gauge Wire Radioshack #278-1224
Solder Radioshack #64-013
Download Arduino IDE
Step 1: Schematic
It consists of three switches:
-one to connect to a 9V power supply
-one to switch the backlight of the LCD on and off
-a magnetic switch (called a reed switch) which closes each time the wheel completes one full rotation.
The Parallex LCD is designed to connect to the arduino using only three pins (ignore the labels and the other pins int his schematic). One to 5V, one to ground, and a third to serial out (TX)- on the arduino, serial out is digital pin 1.
10kOhm resistors are connected to the reed and backlight switches to prevent excess current between 5V and ground (you should never directly connect 5V and ground on the arduino!)
Step 2: Protoboard
Step 3: Reed Switch
Solder a 10kOhm (current limiting) resistor between A0 and ground on the protoboard. Connect long pieces of stranded wire to A0 and 5V- these wires will wrap around the bike and attach to the reed switch.
Step 4: Mount Reed Switch on Wheel
Use the code below to test your reed switch. When the magnet on the wheel moves past the switch, the arduino should print ~1023, otherwise it will print ~0. Open the serial monitor (Tools>>Serial Monitor) in Arduino IDE to test for your own setup. If the magnet does not seem to be affecting the reed switch, try repositioning it or even adding a stronger magnet if you have one.
Step 5: Test Switch
Step 6: LCD
Step 7: Install Parallax LCD Library
Step 8: Parallax LCD
Step 9: Test LCD
The LCD should display "Hello World" when it is turned on.
Step 10: Backlight Switch
Connect the red wire to Arduino 5V, the other side of the resistor to ground, and the green wire to D2.
Step 11: Final Speedometer Code
Measure the radius of your tire wheel (in inches) and insert it in the line: float radius = ''''';
I used timer interrupts in this piece of code to keep the variable "timer" incrementing at 1kHz. More info about interrupts and an explanation of how I set it up can be found here.
Step 12: Battery
Step 13: Enclosure
I glued the project enclosure together with wood glue and sanded the edges down. I finished the enclosure with some clear polycrylic.
Step 14: Install Components in Enclosure
Fit the Arduino and Protoboard as well as the battery into the enclosure and secure with velcro or glue.
Screw or fasten the enclosure shut.