Help with Arduino controlled "car alarm"

Yeah, sorry, that's what I meant. So no brain huh? Would I need Arduino if I wanted to use some sort of vibration sensor?

I guess but could you go into more detail?

I was just thinking that if for some reason the dome light switch didn't work, then I would need a back up trigger. So like one of those magnetic switches or the hall effect sensor.

You would need one on every door and a 4 input NAND gate. If a door is opened, the alarm is triggered.

Yeah, makes sense. I just don't know what I'm going to do with my Arduino now.

You can do custom tones if you can find an alarm that can double as a loud speaker.

I might just return it to RadioShack.

Sorry for such a long time between posts. But! I remembered why I bought the arduino to use as a car alarm in the first place. I know I can use a relay to set up an "alarm" using the dome light switch, but if I did it that way, it would just shut off if they shut the door. So, I bought arduino to use the dome light switch as a trigger that arduino would use to set the alarm off and it would continue to go off even if they shut the door.

No, the Arduino is powered from the same circuit as the domelight. It also is connected to the domelight switches so that it knows when a door is opened.

If a door is opened and shut, then the Arduino can detect that and sound the alarm.

I want to power the arduino from the battery and use a wireless relay to "activate"/"deactivate" it. Then use whatever triggers I want to tell the arduino to sound the siren, and to keep sounding it until I "deactivate" it with the wireless relay.

Anybody?

Did you a question?

I want to power the arduino from the battery and use a wireless relay to "activate"/"deactivate" it. Then use whatever triggers I want to tell the arduino to sound the siren, and to keep sounding it until I "deactivate" it with the wireless relay.

I want the alarm to sound continuously even if the door is shut. That's why I bought the Arduino. If I don't use Arduino and use the other suggested method, the alarm will only sound with the door open.

(This has got to be the shortest thread to reach its second birthday with the OP still actively posting.)

The Arduino should be powered from the battery side of the ignition switch. That way it is powered all the time. For a typical car battery, the power drain of the Arduino should be negligible, although if this car is normally left un-used for more than a month, it may be worthwhile doing the power calculations to ensure the Arduino won't flatten the battery.

Once the Arduino has reliable power, then your program code can be used to do useful things. It can detect doors opening or closing, the wireless 'arm' switch or whatever you require.

Consult the wiring diagram for your vehicle. Identify one of the circuits which is powered all the time. If you can, pick one that has a fuse so that you can attach to the 'protected' side of the fuse. The wiring diagram doesn't tell you where to find the wires, so often it's best to identify the fuse and then trace the wire coming out of the fuse box. Maybe even patch in your wire inside the fuse box if there's space.

If you can't find a suitable circuit, then buy an "inline" fuseholder from your local auto parts store. Attach it to the positive terminal of the battery and use that as your Arduino power. Ground can be any convenient screw or bolt on the chassis or body.

For an alarm, you want to make sure that none of the power and siren wiring are accessible from outside the vehicle. A determined thief will be able to cut the wire quickly enough that you and your neighbors think it was just a false alarm.

Sorry. I forget about this idea and this thread until I remember I have an Arduino that I want to use.

I know how to install everything. I just need help coding it. I can wire everything up no problem. I know not to make wires accessible and all that too. That's why I'm also going to build a hood lock.

I'd like to make it where when the door opens, the alarm sounds continuously whether the door is shut or not, until I "deactivate" it. Maybe use a magnetic reed switch or something like that too.

mattdalley1:
I'd like to make it where when the door opens, the alarm sounds continuously whether the door is shut or not, until I "deactivate" it. Maybe use a magnetic reed switch or something like that too.

So do you want help with the magnetic reed switch or the code? If you have the wiring sorted out, post a schematic (please, not the F**zing breadboard view) and whatever code you have done so far. If you have some code, tell us what it does and what you would like it to do differently.

I haven't written any code. I haven't looked at code in a long time. So, I wouldn't even know where to begin. Any help would be appreciated.

Well, it's often difficult to start from a blank page. One of the good things about Arduino is the useful examples that come with it. Look at the examples in the File-Examples menu. Start with something simple like Blink, just to see that you can upload code to your board and blink the LED.

There's also lots of online tutorials. A quick Google search should find at least two different ones that are close to what you need. Read them and understand them. Run them on your Arduino to see how they perform. Then add what you need.

Would something like this be good?
I got it from an app on my phone.

State change detection (edge detection)

Often, you don't need to know the state of a digital input all the time,
but you just need to know when the input changes from one state to another.
For example, you want to know when a button goes from OFF to ON. This is called
state change detection, or edge detection.

This example shows how to detect when a button or button changes from off to on
and on to off.

The circuit:

  • pushbutton attached to pin 2 from +5V
  • 10K resistor attached to pin 2 from ground
  • LED attached from pin 13 to ground (or use the built-in LED on
    most Arduino boards)

created 27 Sep 2005
modified 30 Aug 2011
by Tom Igoe

This example code is in the public domain.

*/

// this constant won't change:
const int buttonPin = 2; // the pin that the pushbutton is attached to
const int ledPin = 13; // the pin that the LED is attached to

// Variables will change:
int buttonPushCounter = 0; // counter for the number of button presses
int buttonState = 0; // current state of the button
int lastButtonState = 0; // previous state of the button

void setup() {
// initialize the button pin as a input:
pinMode(buttonPin, INPUT);
// initialize the LED as an output:
pinMode(ledPin, OUTPUT);
// initialize serial communication:
Serial.begin(9600);
}

void loop() {
// read the pushbutton input pin:
buttonState = digitalRead(buttonPin);

// compare the buttonState to its previous state
if (buttonState != lastButtonState) {
// if the state has changed, increment the counter
if (buttonState == HIGH) {
// if the current state is HIGH then the button
// wend from off to on:
buttonPushCounter++;
Serial.println("on");
Serial.print("number of button pushes: ");
Serial.println(buttonPushCounter);
} else {
// if the current state is LOW then the button
// wend from on to off:
Serial.println("off");
}
// Delay a little bit to avoid bouncing
delay(50);
}
// save the current state as the last state,
//for next time through the loop
lastButtonState = buttonState;

// turns on the LED every four button pushes by
// checking the modulo of the button push counter.
// the modulo function gives you the remainder of
// the division of two numbers:
if (buttonPushCounter % 4 == 0) {
digitalWrite(ledPin, HIGH);
} else {
digitalWrite(ledPin, LOW);
}

}