DIY GPS Tracked Bike Lock using Arduino

Bike Lock

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:

  • The device has to be Arduino based so that if I run into trouble I can easily search the forums for help
  • Whatever I make has to be able to fit into a small bag that goes under my seat
  • The battery must last for a very long time, at least a few weeks. I don’t want to have to plan my bike rides around my lock being charged or not.

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.

Bike Lock



  • 2S Li-Po Battery Charger
  • Soldering Iron
  • Wire Strippers
  • Philips Head Screwdriver
  • Flat head screwdriver (or some other good prying tool)
  • Digital Multimeter

Step 1: PNP Transistor Circuit

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.

Step 2: Modifying the Retractable Lock

We need the retractable lock to serve as an electrical connection from the positive side of the battery to the base of the transistor. This way when the lock is cut, the electrical connection is cut as well and the Arduino will boot up.

Assuming that you have the lock that I recommended in the intro, the first thing is to remove the screw that connects the two halves of the plastic case. The use a wedge to pry open the edges and separate the two halves.

At this point it is a good idea to take a picture of the inside of the lock so that if any pieces fall out you can put them back later. I forgot to do this which resulted in a lot of wasted time studying the mechanism.

Time to get out the soldering iron. Make one connection for a wire on the brass ending of the steel cable. It is located on the spool the the cable wraps on when inside the lock. Make the second connection on the spring that holds the pin that the cable makes contact with when you insert it into the lock. Use your DMM to check for conductivity when the cable is inserted into it’s hole and that there is no conductivity when it’s lose. A lose cable is the same effect as cutting the lock.

Make one hole in the plastic case near your spring connection. The other hole should be made halfway between the centre of the spool at the bottom and the outer edge of the spool. I found that making a connection in the centre of the spool would twist the wire so much that it would break.

Congratulations if you’ve made it this far the hardest part it over! Lastly just run your two wires through the holes you’ve made and close up the case. If you’re finding that the screw is not enough to hold the two halves together anymore a generous coating of epoxy resin is recommended. Also, depending on what type of bag you will use for the electronics it may be useful to put the screw through a zap strap so that you have a way of securing it to the bag. Put some epoxy on the zap strap as well. Just don’t be too generous or you may gum up some of the important mechanisms of the lock. During this step I managed to glue the retracting mechanism of my lock so be very careful. Clamp your lock together and leave it for at least an hour.

Arduino diagram (1)

Step 3: Add GPS

The ultimate GPS breakout from adafruit works well in this application. Hooking it up couldn’t be easier. Find a good place for it on your pro to shield and then just connect the Vin to 5V, GND to GND, Rx to digital 9, and Tx to digital 8.

This is all you need to get the GPS working however adafruit has nicely broken out Vbat so you can supply 3.3V to the GPS’s internal clock when the power is off. This will give you quicker startup times. I used one of my LiPo cells to supply this with 3.7V. This can in theory discharge both LiPo’s unevenly and be dangerous, however considering the power used it very small I think the uneven discharge rate will not be a problem. And so far so good, if i have a spectacular problem with respect to this I will be sure to post it here.

Step 4: Add Battery Connection

Its useful to find some sort of connector so that when your batteries do finally die it will be easy enough to remove them and recharge them without bringing out the soldering iron. Epoxy your connector of choice to a good spot on the pro to shield (make sure it doesn’t contact anything on the arduino when it is connected!) and connect one side to ground and the other to the emitter on the transistor.

In the photo you can also see a connector with only one wire which is the 3.7V used for the GPS clock described in the last step. The connector in the photo with 3 wires is the balance connector that my LiPo charger needs to make sure both cells are charged evenly. See your specific LiPo charger’s docs for details on this.


Read more: DIY GPS Tracked Bike Lock using Arduino

Leave a Comment

Your email address will not be published. Required fields are marked *