Introduction: Protect Your Car With Arduino!

About: Bad at DIY, trying to get better

Note: If you like this project, feel free to vote it for the Arduino Contest and the First Time Authors Contest :)

Why build an Arduino Anti-Theft System? After seeing my friend get his VW Beetle stolen, I decided I needed to protect mine, because my 1966 Volkswagen Beetle did not have any sort of alarm. So I decided to make an Arduino Anti-Theft system that'd protect my car from robbers. And you can't have too much security...right?


I wanted a device that, when the car moved, would sound the horn indefinitely.

So what did we make, a system that when armed, waits for the car to start moving. If the GPS picks up movement, then it honks the horn indefinitely. Unless the car is turned off, then the horn will continuously honk. Even if the car is then turned back on, the horn would still honk.

Essentially, it'd deter any robber who may hot-wire my poor old beetle.

Feel free to re-create this, inspired or not by my design, and let me know if you do!

Special thanks to Paul Nauleau for helping me with parts of this project!

Step 1: The Parts

The Parts:

  • Arduino (Here an Uno)
  • GPS Module (Here the EM-506 GPS)
  • GPS Breakout (if needed - makes for easier connections)
  • Battery Snap Connector
  • 9V Battery
  • 5V Relay
  • Wire & Electrical Tape
  • Switch
  • [optional] Male & Female Terminal Wire Connectors
  • Enclosure

Tools Needed:

  • Drill w/ some drill bits
  • Soldering Iron (no skill needed - this project was the first time I ever solder)
  • Wire Strippers (or a knife)
  • Pliers

Step 2: Understanding the Electrical Concept

Surprisingly, the concept behind it is very simple.

We want to connect an Arduino-controlled relay in parallel to the horn switch on the steering wheel. The relay would only be powered and close the circuit when the GPS module attached to the Arduino detects a speed above 3mph (aka someone is driving off with your car).

But what is a relay you ask? Well, let me tell you. A relay is a switch that open/closes circuits. The special thing with a relay is that a very small amount of power (such as the one emitted by the Arduino) can open close any circuit (including 120V lamps, etc).

Why do you need a relay? Our goal is to have the relay turn the horn on. We can do this by connecting a relay on the negative wire of the horn. The negative wire from the horn would go into the relay. And coming out the relay would be a wire connecting the relay to a ground. Therefore, where the relay is on (and the circuit closes), the horn is connected to a ground. This closes the circuit, and makes the horn go off!

What is COM/NO/NC on a relay? COM stands for common and is where you connect the (usually negative) wire of your circuit. NO stands for Normally Open. This means that the switch would normally be open (and therefore the circuit would not be closed), and would require power to close. NC stands for Normally Closed, as it the opposite as NO, meaning that unless powered, the switch will be closed - the circuit will be complete.

What did you use? I connected the negative wire from the horn into the COM of the relay, and then connected a grounding wire from the NO side of the relay.

Step 3: Figuring Out How to Connect Your Horn.

Because I have a 1966 Volkswagen Beetle, this step was pretty easy. In any modern car, I wouldn't do it. The technology nowadays is very complicated.

The thought process was simple: I was going to run a relay in parallel to the normal horn switch, in order for me to be able to decide when to ground (and therefore activate) the horn.

In my beetle, it was very simple. The horn had a yellow/black wire (positive) that connected the horn to ignition power. It also had a brown wire (negative) that went to the steering wheel, where the center of the steering wheel acted as a big pushbutton switch to ground and close the circuit (and therefore make the horn sound).

  • I cut the brown wire in half, stripped it, ran a third cable off of it.

I now had a third cable that could ground the horn and make it sound. I ran that cable all the way up to the glove box, where I had decided I would put my Arduino.

Step 4: Wiring the Arduino

Here is the process to connect the Arduino:

I couldn't find a good program to make a circuit diagram - if you know of one, let me know and I'll make one!

  • Solder pins onto the GPS Breakout Board, in order to assure you have good connections
  • Since you have the soldering iron out, cut the negative wire in your battery snap connector in half. Solder one side of the wire to a pin of the switch (or wrap with electrical tape), and solder/wrap the other side of the cable on the other pin of the switch. [see little drawing]
  • Cut two jumper wires in half. Make one wire with three connections with your soldering iron, and secure it with electrical tape. (This is only necessary with the Arduino Uno) as it allows you to power two 5V modules with only one 5V pin on the Arduino.
  • Connect everything like the following:
    • Arduino 5V -> Relay VCC & Pin 2 of GPS Breakout
    • Arduino GND -> Relay GND
    • Arduino GND -> Pin 1 or 5 of GPS Breakout
    • Arduino Pin 11 -> IN of Relay
    • Arduino Pin 0 (RX) -> GPS Breakout Pin 4
    • Arduino Pin 1 (TX) -> GPS Breakout Pin 3

Notes:

- You cannot send any code to the Arduino if things are plugged in the RX and TX pins of the Arduino.

- Here is the datasheet of the GPS. The RX Pin of the GPS should be connected to the TX Pin of the Arduino, and vice versa.


Step 5: Coding the Arduino

The code is short and sweet. Check it out:

<p>#include <TinyGPS++.h> //add the Tiny GPS++ library<br></p><p>const int RXPin = 0;
const int TXPin = 1;
const int RELAY = 11;</p><p>TinyGPSPlus gps; //create the gps object, so we can use the TinyGPS++ functions</p><p>void setup() 
{
  pinMode(RELAY, OUTPUT);
  digitalWrite(RELAY, HIGH); //turn relay off (for some reason it's inversed - don't worry though, this works)
  delay(60 000); //make sure the GPS has enough time to get a solid signal
  Serial.begin(4800); //start the serial (information) connection between GPS and Arduino
  
}</p><p>void loop() {
  while (Serial.available() > 0){ //while the GPS has information
    gps.encode(Serial.read() ); //encode it with the TinyGPS library (so we can read it)
    if ((gps.speed.mph()) > 2){ //if the speed of the car exceeds 2mph,
      digitalWrite(RELAY, LOW); //turn relay on 
    }
  }
}</p>

You will need the TinyGPS++ library , and if you're using an Arduino that does not have TX/RX pins, you will need the Software Serial library .

Step 6: Preparing the Enclosure

To make the enclosure, I decided I would put it all in a plastic Tupperware that I could put in the glovebox, which is locked.

Here are the steps I followed:

  • Drilled a hole into the side of the box in order to put my switch. This will be the switch that turns my Arduino on/off and is therefore the switch that determines whether the alarm is on or off.
  • I also drilled two small holes, in order to stick two female terminal wire connectors. This is purely optional, as all it does is allow you to quickly unplug the entire box and take it with you - without having to disconnect everything. If you do not do this, you'd still have to drill two small holes in order to run the wires from the horn into the Relay.
  • Feel free to spray paint/decorate your enclosure - I just did not have the time.

Step 7: Putting It All Together

Now that you've got your Arduino connected, and your enclosure made, it's time to put it all together. I wanted to make the system "secret" and safe, I decided to put it all in the glovebox. Which meant I had to drills holes into the glovebox, since my relay was with my Arduino (and cables needed to go in and out of the relay).

  • Drilled two holes into the glovebox big enough to run two wires.
  • Put the fully connected Arduino in the enclosure, and the finished enclosure in the glovebox.
  • I put the additional wire I had connected to the horn's negative through the glovebox and through the enclosure, and connected it to the COM on my relay. (Horn -> Relay COM)
  • I cut another piece of cable and connected one end to a ground. I connected the other end into my NO connection in the relay. (Relay NO -> ground)
  • Put a battery in the enclosure, and we were done!

Step 8: You're Done!

After you've connected everything, you're done!

Wasn't too bad was it?

Now, there are many ways you can upgrade this. Make your headlights flash, make your Arduino text you the location of the car, the possibilities are endless (and yes, I am working on some of these).

Your car is now secure, and you've created your own anti-theft system!

Arduino Contest 2016

Participated in the
Arduino Contest 2016

First Time Authors Contest 2016

Participated in the
First Time Authors Contest 2016