Having just purchased a half decent bicycle, and living in a city with a bike theft rate almost as high as New York, I wanted to have some peace of mind that if a thief with an angle grinder were to cut through my U-lock I could still catch them.
My main design constraints were as follows:
This project is pretty cheap, especially if you compare it to the cost of replacing your stolen bike! I've outlined the cost of all the components used in my design below. I was able to use some old parts I had lying around and hopefully you will too. If I had bought everything needed brand new this would have cost about $225.
The transistor is a device that is used for switching. A very small input can enable a very large current output. In the case of the TIP127, it can handle 5 amps and has a gain of 1000. Roughly this means that if you were to need to drive 5 amps your effective input would need to be 5/1000 amps.
The PNP transistor is "off" when you connect the base to the positive side of your circuit and on when it is connected to ground.
The way it is used in the bike lock is pretty clever I think, the steel cable of the lock will connect the positive side of the circuit to the base of the transistor. When the lock is cut, the connection is broken and the path of least resistance will be to ground. When the base is grounded like this power is supplied to the Arduino
This is the clever part of this design. It means that we will only be using full power power during the small amount of time it takes to lockup your bike. The rest of the time it will only be using the small amount of power used to supply the transistor.
Test out your transistor circuit on a breadboard before soldering to your Arduino prototyping shield. While testing your circuit use a switch in place of the retractable lock in the next step. With the TIP127 hook the circuit as per the schematic above. If you want to use a different transistor than the TIP127 the only thing that will change is the value for R1.