Introduction: Barbie Arduino Car Alarm

Background: Barbie had a really nice convertible sports car from her boyfriend Max Steel, but every time she would park it at the beach Ken and his buddies would be messing around with her car. She decided that it was time she had a car alarm installed so that if Ken or anyone messed with her car, EVERYONE would be looking at him, and the Cops would hopefully arrest him as well. My Daughter and I thought we could help Barbie with her problem.


The scope of this project involved all the things an actual car alarm would do.
1) Turn alarm system on and off with a remote
1.1) Beep when the alarm is turned on or off
2) Alarm when on and the vehicle is bumped
3) Run the alarm for a short time before turning it off (unless bumped again)
4) Override for the alarm if accidentally bumped (Alarm system off stops alarm)
And - YES you could use this as a real car alarm with some minor modifications


We used:
1) passiver buzzer (+ - S)**
2) tilt switch (tried ball, but mercury worked better) (+ - S) w/LED
3) button(for tests) (+ S and 10k pull-down)
4) IR detector (+ - S) w/LED
5) remote control
6) 5 AA batteries fed in to GND and VIN pins on sensor board (You could hook to DC port as well)
!!! Do NOT use batteries and your USB for power !!!
7) Arduino Sensor Shield v4.0

** Note: (+ - S) means that the sensor required + (Voltage) - (Ground) and S (Sense/Signal Pin)

Our IR Transmitter is the MakeIt:Robot Remote Control IR transmitter from Radio Shack But with a little testing
you could use any IR transmitter e.g. "extra" buttons on the TV remote. (I promise Barbie won't care.)
This is a great reference for the IR receivers: https://arduino-info.wikispaces.com/IR-RemoteCont...

Some of these parts were from the "37 Sensor Kit" available from various places online

TO DO: Add a two color blinking LED to show when alarm is armed (RED) and not (GREEN)

Written for and tested on Arduino Uno 1.6.4

Step 1: Prepare the Arduino Board

First we need to prepare the Arduino board. On ours we have mounted a Arduino Sensor Shield which allows easy access to all the pins on the Arduino via the center section of the board (sets of 3 pins) and also provides V+ and Gnd with each signal pin which can be used as needed.

You can also load the code on your Arduino at this time.

Available at Github: BARBIE CAR ALARM CODE

Or click the code link below to download it to your PC. After you load it, disconnect power from your Arduino.

Step 2: Attach the Sensor, Beeper and IR Receiver

Next attach the motion sensor switch, the passive beeper and the IR receiver to the board as follows:

The beeper is attached to pin 8 and it needs ground and V+

The motion switch is attached to pin 6 and it needs ground and V+ for the LED

The IR receiver is attached to pin 11 and it needs ground and V+ for the LED and the receiver.

Optional for testing: Push button switch attached one connection to pin 5 with pull-down 10K resistor between Gnd and 5, and other switch wire to V+

Step 3: Test It

1)Connect power to your alarm.

2)Click the upper right button to arm the alarm. (double beep)

3)Wiggle the tilt switch.

  • (If LED light on tilt switch doesn't light up, then you most likely have it wired wrong or tilted the wrong direction. LED on = Not active motion LED off = Motion trigger)

4)Click the upper left button to disarm the alarm. (double beep)

  • (If LED light on IR receiver doesn't flicker, then you most likely have it wired wrong.)
  • If the motion sensor is triggered the system will alarm 10 times (so it's not so annoying.)
  • If the motion sensor is triggered during an alarm the system will reset the alarm beep count and continue beeping 10 more times.
  • If the disarm button is pressed the alarm will stop and the system will disarm.

Note: If the system is armed it will not arm again (no double beep) If it is disarmed it will not disarm again (no double beep)

Step 4: Mount It in the Car

Since this was just a fun project for me an my daughter we didn't go to great lengths to mount it. Eventually it will come out and become some other project somewhere else. That being said, you will notice a lot of blue painters tape. It works great to stick things temporarily and not leave residue behind when you decide to remove it.

You'll need to tape down: Battery Pack, Arduino Board, Beeper, IR Receiver (Outside of car somewhere!) and motion sensor (Someplace you can adjust the tilt until its correct.)

Comments

author
GusitoR made it! (author)2016-08-26

muy bueno!!.....pero ami no me funciona por mando a distancia.....utilizo IR a 9600 baudios y un mando normal (protocolo NEC) sera por eso??

author
Dannlh made it! (author)Dannlh2016-08-26


Tus codigos HEX probablemente no coinciden con los codigos en el programa. Cada control remoto IR envia codigos diferentes.

Use la biblioteca MySensors de GitHub para determinar los codigos que envia cada boton en tu control remoto. Hay un ejemplo de IrSensor en la biblioteca con lo que se puede hacer esto.

Reemplace los codigos HEX en las lineas que se ven asi:

if((String(results.value,HEX)=="962814ca") && (alarm)){ // Check is OFF button and alarm is ON
if((String(results.value,HEX)=="8d2a4baf") && !(alarm)){ // Check is ON button and alarm is OFF

Con los codigos HEX de los botones de tu control remoto que quieras usar para "on" y "off"

Camila

author
GusitoR made it! (author)GusitoR2016-08-26

Hola Camila, gracias por responder!! ....si, ya hice eso que me dices pero......no me funciona......la verdad es que no se porque no me funciona :( .....se le ocurre algo mas??....quizás deba cambiar algo de la programación???.....en cambio, con los pulsadores.....si funciona...

author
GusitoR made it! (author)GusitoR2016-08-27

ya esta solucionado!!....una pregunta mas.....como podria hacer para que desde un boton del mando activase la alarma sin tener que tocar el coche??

author
Dannlh made it! (author)Dannlh2016-08-27

Bravo Gusito!

Cambia el " If/Else " por " If / Else If / Else " para adicionar una tercera opcion para el nuevo boton.

If ..ButtonHexCodeTest.. { //Button1 On

..code}

Else If ..ButtonHexCodeTest..{ //Button2 Off

..code}

Else //Button3 SirenOn

if(String(results.value,HEX)=="ThirdButtonHexCodeHere") { //Check if siren/Panic button pressed

Serial.println("Siren On ");

for (int AlmCount=0; AlmCount <= 10; AlmCount++){//Loop siren 10 times unless another button pressed. Adjust AlmCount if needed, or just remove for continuous

siren(); //TURN ON THE SIREN!!!

delay(1000);//Delay between alarms and also de-bounce the button so we don't read it twice by accident.

//CheckForButtonPressHere

if (irrecv.decode(&results)) AlmCount=10; //If the button was pressed stop the alarm until we check which button it is.

}

}

// NOTA: Buscar aqui el formato de comando If/Else: https://www.arduino.cc/en/Reference/Else

// Por favor entiende que el codigo de arriba es un pseudo codigo incompleto. Vas a necesitar hacer los cambios apropiados para que pueda funcionar, pero te estoy dando una estructura basica.

Camila

author
GusitoR made it! (author)GusitoR2016-08-29

Hola de nuevo Camila.......no tengo éxito con esto......me estanque......no se seguir :(

author
GusitoR made it! (author)GusitoR2016-08-28

Gracias Camila!!...voy a intentarlo!!......

author
tomatoskins made it! (author)2016-02-04

So great! I love modifying things like this!

author
Dannlh made it! (author)Dannlh2016-02-04

Thanks! We had fun building it!