I therefore decided to create a bicycle alarm to SUPPLEMENT my lock. This alarm in no way keeps people from stealing your bike. It simply draws attention to anyone who messes with your bike without turning off the alarm first. Never use this alarm instead of a lock. Also, I am not responsible for any consequences coming from the reading, construction or use of this Instructable and any materials contained in it.
As far as the lights are concerned, biking at night is dangerous. Legally you must have an approved light system to ride at night. This light set is not approved, so technically you should supplement it with another approved light set. I used only this set for a while and it worked great for me, but you are responsible if you choose to use it. I in no way take any responsibility for your choice to build or use this Instructable.
With that out of the way, let's move on to the construction of the alarm.
Step 1: Things You'll Need
1- Key switch, SPDT, Key removable in both positions, Goldmine Electronics #G8081
1- NC Reed Switch, Digi-Key #CH406-ND
1- SPST NO Pushbutton
1- 6V DC Buzzer, RadioShack #273-054
1- 5x2.5x2" Project Enclosure, RadioShack #270-1803
1- 47 Ohm Resistor
1- MPS6717 or Equivalent NPN Transistor
1- 28 Pin IC Socket, Digi-Key #3M5480-ND
1- 16.00MHz Ceramic Resonator, Digi-Key #X908-ND
1- 5V Voltage Regulator, Digi-Key #MC7805CT-BPMS-ND
1- Arduino Bootloader Loaded Atmega168, Adafruit Industries
1- 4 AA Battery Holder
Cable Zip Ties
Magnet from Bicycle Speedometer
Optional Parts for Adding Night Riding Lights
4- Super Bright White LED's
8- Super Bright Red LED's or Purchased Taillight
1- Toggle or Slide Switch
1- 270 Ohm Resistor
Other Optional Parts
Drill and Bits
Step 2: Arduino Code
Step 3: Schematic
NOTE: Do not solder directly to the Atmega168 if you are not experienced. Instead, solder in the socket and then insert the Atmega168 into the socket.
If you are modifying the schematic and not using an input, be sure and solder it to ground. If you are not using an output, leave it disconnected.
Step 4: Mount Bicycle Alarm in a Case
NOTE: I chose not to use the tamper prevention feature just yet, so there is no wire coming out for it. Should you choose to implement all of the features of this alarm, you will have 7 pairs of wires coming out of your case.
NOTE: The battery connector is in place on my alarm should I choose to ever use a rechargeable battery pack. If you never plan on using a rechargeable battery pack, you can leave it off.
Step 5: Attach to Bicycle
If you have a pouch already attached to the seat post, if you want the alarm more for alert than physical theft prevention, you could consider keeping it in the pouch with one of the tamper prevent loops connected to the bike.
Step 6: Mount It and Use It!
Whether you use the project as an alarm or lights, be sure to test battery operation periodically. While the Atmega168 or lights are running, the battery will drain fairly quickly. To arm the alarm, turn the key switch to the on position. If the tire monitored by the reed switch is turned far enough, the alarm will sound for 30 seconds unless the wheel is turned again, in which it will continue to sound.
When you are using the alarm, turn the wheel so the magnet from the bicycle speedometer is as far as possible from the reed switch. This will help minimize the chance of false alarms.
If you use a rechargeable battery pack, place the key switch in the off position when you want to charge the battery. Then, all you have to do to charge the battery is connect the charger to the plug.
Sorry I don't have a picture or video of the alarm in action, but I ended up getting a different bike since I started the project, so I ended up using just the LED lights because I don't leave the old bike anywhere I would use the alarm. The lights are great though because you never have to worry if you have your lights or if they have batteries.
Step 7: Other Thoughts
1. If you end up using the project as only a bicycle light set, you don't need a micro controller. You only need:
1 Key Switch
1 Battery Connector
2 Cable Zip Ties
12 LED Mounts
8 Red LED's
4 White LED's
1 270 Ohm Resistor, rated at least 7W to be on the safe side.
2. The standalone Arduino can be a bit tricky to get working, but allows for integration into small projects.
3. You don't have to use a key switch for the lights, but it is nice because you don't have to worry about somebody being a jerk and turning on your lights to kill your batteries.
4. Use at your own risk. I cannot be held liable for anything that happens or does not happen that is in any way related to this Instructable. I cannot also guarantee that any of the information in this Instructable is fit for use. I can simply state that it worked for me.
5. Vote for me in the Get the LED Out!contest if you like this Instructable.