This alarm is a good way to alert you if somebody messes with your bike. I had a bicycle stolen a while back and decided there had to be a better way to keep my bike secure. When I searched for bicycle alarms, all I could find were alarms that responded to sudden movement or when a lock was cut. Also, the reviews of these products rated them mediocre at best and said they often did not work or gave a lot of false positives.
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
Parts1- Key switch, SPDT, Key removable in both positions, Goldmine Electronics #G80811- NC Reed Switch, Digi-Key #CH406-ND1- SPST NO Pushbutton1- 6V DC Buzzer, RadioShack #273-0541- 5x2.5x2" Project Enclosure, RadioShack #270-18031- 47 Ohm Resistor1- MPS6717 or Equivalent NPN Transistor1- 28 Pin IC Socket, Digi-Key #3M5480-ND1- 16.00MHz Ceramic Resonator, Digi-Key #X908-ND1- 5V Voltage Regulator, Digi-Key #MC7805CT-BPMS-ND1- Arduino Bootloader Loaded Atmega168, Adafruit Industries1- 4 AA Battery HolderCable Zip TiesVarious WiresPrototyping BoardSolderMagnet from Bicycle SpeedometerOptional Parts for Adding Night Riding Lights4- Super Bright White LED's8- Super Bright Red LED's or Purchased Taillight1- Toggle or Slide Switch1- 270 Ohm ResistorOther Optional PartsBattery ConnectorsSilicone CaulkToolsSoldering IronWire StrippersScrewdriverDrill and BitsArduinoComputer
Step 2: Arduino Code
Attached is the code for the Arduino. Copy and paste the code into the Arduino program and use it to load the program onto your Atmega168. Once the upload to the board is complete, remove the Atmega168 from the Arduino if you want to use it as standalone. If you don't, keep it in the board and just put the board into the project. If you don't use it as standalone, skip the next step.
Step 3: Schematic
Below is a picture of the schematic. If you want to make any modifications, see the program for details of changes already programmed in. Using the parts previously mentioned, build the circuit.
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.
Schematic.PDF(757x590) 146 KB
Step 4: Mount Bicycle Alarm in a Case
Once you build the circuit, it is time to mount it in the project enclosure. I used the drill to make holes for the key lock, push button switch, wires, and the buzzer. The size of each of these holes will depend on your components. Make sure to lay the components out before drilling the holes to make sure everything will fit. Be especially careful about the depth of the larger components. If you want to keep the bicycle where the alarm might get wet, some silicone caulk in all holes would help to keep water out. This alarm is not designed to be totally waterproof however. BE SURE TO PUT THE BATTERIES IN BEFORE SEALING THE BOX. This is especially important if you plan to seal the box with a rechargeable pack inside.
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
Attach the alarm anywhere on your bicycle that you want. I chose to mount mine under the seat for a number of reasons. One, it is not as noticeable. Two, it is protected from contact and water. Three, it was out of the way. I attached mine to the bicycle using a few zip ties. This method holds the alarm on, but makes it relatively easy for a thief remove from the bicycle, so be sure to run one of the tamper prevention loops through the frame in such a way it cannot be removed without being cut.
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!
The next step is to mount the lights. For my lights, I connected the batteries to eight bright red LED's in the tail light. I then attached the super bright white LED's in another small project box to the head tube (the part of the frame directly below the handle bars). If the alarm is set to the off position, when you toggle the switch the lights should come on.
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.