DIY GPS Tracked 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.



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

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

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.

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.

Step 5: SIM Card for the GSM Shield

No matter where you live you must find a cell phone carrier that has a GSM network. This pdf will show you a list of GSM carriers in your area.

For the GSM shield you need a regular SIM card, micro SIM or any other size won't work.

Ideally the only time that the device will send a text message is if your bike is being stolen, and for testing of course. A prepaid phone plan is probably the best for this reason. In Canada the going rate for text messages on a prepaid plan seemed to be 30 cents a text. The catch is that you have to load your account with $10 in credit every month so stay active. So it is basically is a $10 a month cell phone plan. I went with Roger's Wireless since I was already a customer and I managed to get $30 of credit to last for 6 months, talking to the guy at my local Rogers store. Canada is great for many reasons but our cell phone plans definitely are not one of them. Hopefully the cell phone carrier in your area has better prepaid phone deals.

Step 6: Connect and Code

Connect the proto to shield and the GSM shield to the Arduino. Upload the "BikeTheif_V5.ino" sketch with your phone number in the "remote number" variable. Make sure you have the TinyGPS++ and AltSerial libraries installed before hand.

You might be wondering why I used the TinyGPS++, the AltSerial, and Arduino GSM libraries instead of the Adafruit GPS library and the software serial library. It turns out after messing around with the latter for a few hours that the Adafruit GPS and software serial use the same timer (a programming flag the pops up after a specified length of time). I'm no programmer, but from what I understand unless you went into the library and changed all instances of the conflicting timer the sketch will not upload. This post from mallison-electrical led me on the right track and I ended up using their code as a baseline.

When you upload the code the Arduino you should receive a text that says "Your bike has been stolen!" after about 40 seconds. This includes a 15 second delay plus the amount of time to connect to the network, send an sms and receive an ams.

Once your gps gets a signal you will start receiving GPS updates in the decimal degrees format. Just copy and paste this into google maps (you might have to add a space between the "-" and the second coordinate) and you will see the location on a map. For me the GPS could take from 30 seconds to 15 minutes to connect.

Good luck and hopefully you, or the Police can catch the next guy who tried to take off with your bike!

Battery Powered Contest

Participated in the
Battery Powered Contest

Be the First to Share


    • Instrument Contest

      Instrument Contest
    • Make it Glow Contest

      Make it Glow Contest
    • STEM Contest

      STEM Contest

    24 Discussions


    2 years ago

    Why not use a Arduino Pro Mini ? Tout can also recharge your Lipo from dynamo. Interessing project.


    3 years ago

    ya I made it for my scooter....


    4 years ago

    If you were a cyclist in college, then you probably know the pain of a stolen bike. This guide is fantastic! At Bicycle Blue Book, we specialize in getting people an accurate idea of how much their used bike is worth. Keeping your used bike safe is an essential piece of responsible ownership, and this guide makes it easy! Nicely done.

    If you're looking for a used bike to protect with this lock, check us out!


    4 years ago on Introduction

    Hi stbennett, thanks for the posting on this project, I would like to try the similar project on the GPS and GSM tracking project as you have did.

    Found that some one mentioned that the Arduino code you has post not working? can send me the working version to my email at
    I will try to get the HW and the code when have it to test out the project and see what can be modify and improve from there

    2 replies

    Reply 4 years ago on Introduction

    Hey, the code is working fine. People have been confused with the .ino extension on the file (Arduino for mac). You can just change the extension to whatever you want or I uploaded a .txt file so you can copy and paste into Arduino from your favourite text editor.


    4 years ago

    Hi, I was hoping to feature this on another publication. If you're interested in answering some questions, could you message me here? - Thanks!

    mmd yusoff

    4 years ago on Introduction

    Plz send the code to my email...


    4 years ago on Step 6

    Hey can you please send me your biketheif code to my email.. the code you put here its not working..plz its bit urgent.. my email id-

    3 replies

    Reply 5 years ago on Introduction

    The Tiny Tracker is for licensed radio amateurs, as it use an APRS-frequency (144.390 in America, 144.800 in Europe). But it could be used on a freeband frequency from point-to-point (not much distance though).


    5 years ago

    That's a great idea I was thinking of the same thing.
    But its too conspicuous under the seat. Maybe having it within the tubes or something would do.
    btw which bike is it? looks really sexy

    1 reply

    Reply 5 years ago on Introduction

    Maybe for V2 haha. But It would be more difficult to design the electronics to fit in there. Might require a custom PCB. Too work for a weekend project.

    Its a 2012 Focus Variado, just bought it of Jenson USA. I'd defiantly recommend it, super fast.


    5 years ago on Introduction

    Nice project, as an exercise.

    But you can have a decent GPS/GSM tracker for 20-30$, just search on eBay.


    5 years ago

    you could rig it to charge from a wheel mounted turbine, then it would charge while you ride.


    5 years ago on Introduction

    First, let me commend you on a job well done - this definitely looks like a project that is truly the spirit of what Instructables is all about. Working on some Arduino projects myself right now (one of which I have raised money to develop commercially), I have a deep appreciation for all the work that you did here.

    Second, if for some reason you get a second bike, or this unit happens to get damaged (for some reason), there is a company out there that has something that might be a suitable replacement at $129:

    Keep posting!

    Or get the Spybike GPS Tracker for around $150

    Though, very interesting project. I would be a bit worried about the saddle bag getting tampered with before the bike getting stolen though.