MODERATOR ACTION:
- Added relevant information on title
yes im an idiot. i had resistor connected to pin 1 of the chip not ground. now i have it connected the right way it works as expected
thanks.
yes but have learnt things along the way.this is why I wrote the "P.S." in post#48
... not following this .. wasted 15 hours of your time...
Klaus
not sure yours was quite right for my application, i have 2 inputs, one input goes high temporarily to arm alarm, other input goes high temporarily to disarm alarm.So here is a working version :
Note settings :
Set clk to 1 Mhz, and your programmer to the one you are using.
So when alarm pushed > .5 sec alarm comes on and stays on for min 5 sec. Only when off
pushed > .5 sec is it turned off, and stays off min 5 sec, then can be triggered on again. Is that
what you wanted ?
Note board selection -
Regards, Dana.
--- Updated ---
Trigger -
Note the min pulse is 5.5 sec due to off button delay of .5 sec, so values used for delays could
be fiddled with. But you can see alarm triggered after .5 sec and width is .5 + 5 sec.
Regards, Dana.
not sure yours was quite right for my application, i have 2 inputs, one input goes high temporarily to arm alarm, other input goes high temporarily to disarm alarm.
just spent the last hour coding this one up, what you think of this? it compiles ok. just haven't had time to test it out yet.
just not sure if the variable 'varArmed' used is read within all the functions or need to be changed, been 15+ years since i did coding last.
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
You declared the variable as public so you are all set. All functions have R/W access to it.
Note you have a mix of code struc from my mBlock code and "normal" Arduino code -
Code:void setup() { // put your setup code here, to run once: } void loop() { // put your main code here, to run repeatedly: }
Normally you put one time code in setup(), like pin setup, serial setup...etc., and the runtime main code in loop()
Just a thought, consistent with "normal" pra ctice.
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
it is actually connected to door handles, so if someone tries to open the door when car locked it sets horn off to scare them off.Now I see your desired functionality, one button arms the alarm, and if door open an alarm occurs
for a minimum of 5 secs, and stays in alarm state until door closed OR arm off button pushed ?
OR
One button arms the alarm, and if door open an alarm occurs for 5 secs, and then turns off ?
So where is the reset switch? remote control? and is the output a 10A horn? or a 0.05A relay coil or ??it is actually connected to door handles, so if someone tries to open the door when car locked it sets horn off to scare them off.
its a big issue where i live youth crime, they go around the streets at night into peoples yards trying to find unlocked cars and houses to break into. this is used to scare them off if they try mine. i have rigged a N/C reed switch up to the door handles inside the door.
armed and disarmed from the cars central locking high pulse for lock and unlock. output goes directly to 10A horn from IC, na only joking, i have an ardruino relay board that will trigger another relay that will set horn going.So where is the reset switch? remote control? and is the output a 10A horn? or a 0.05A relay coil or ??
this is the exact relay boardDoes that mean the Output is an Arduino 5V 90 mA coil 10A relay? or what?
What are the reed switches wired to? +12, +5 or gnd? How many? ganged together? twisted pair wires or what? series R or pullup or down?
Normally all remote alarm switches are grounded with remote pullups.
This is pretty trivial without an Arduino.
Then my car would be the first to be found unlocked. I can not remember when I locked it last time.its a big issue where i live youth crime, they go around the streets at night into peoples yards trying to find unlocked cars and houses to break into.
can you find one? i doubt it, never seen one around for this application that connects to the car itself without separate remote, i have to install reed switches on handle mechanism itself to make it work, only other car i can think of is a tesla that may do similar.Hi,
I´m sure there are cheap ready to buy car alarm that do exactly what you want.
I guess you spend more time and money by building it on your own.
Klaus
#include <Arduino.h>
#include <Wire.h>
#include <SoftwareSerial.h>
int varArmed = 0;
int varCount = 0;
int varSMS = 0;
void _delay(float seconds) {
long endTime = millis() + seconds * 80;
while(millis() < endTime) _alarm();
}
void setup() {
pinMode(0,OUTPUT); // pin 5 on IC - alarm output goes to horn relay
pinMode(1,INPUT); //pin 6 on IC - to door handle switches N/C low input
pinMode(2,OUTPUT); //pin 7 on IC - GPS trigger SMS notify
pinMode(3,INPUT); //pin 2 on IC - to door lock High pulse Turn on alarm
pinMode(4,INPUT); //pin 3 on IC - to door unlock High pulse Turn off alarm
digitalWrite(0,0); // Alarm off when powered up
while(varArmed == 0) {
//do nothing but wait until arm and make sure it does not sound alarm
digitalWrite(0,0); //ensure alarm output is off
//digitalWrite(2,0); //armed led off
if(digitalRead(3) == 1){ //when doors lock signal goes high temporarily, arm alarm
varArmed = 1;
}
_loop();
}
while(varArmed == 1) { //alarm armed routine
//digitalWrite(2,1); //armed led on
if(digitalRead(4) == 1){ //when doors unlock signal goes high temporarily, disarm alarm
varArmed = 0;
varSMS = 0;
break;
}
//check to see if alarm is triggered
if(digitalRead(1) == 1){ // N/C switch opens pulling input high
//Alarm triggered routine
varSMS += 1;
digitalWrite(0,1);
if(varSMS < 6){digitalWrite(2,1);}//send SMS notification
delay(20);
digitalWrite(0,0);// turn alarm off when 3 seconds up ready to go again
digitalWrite(2,0);
delay(20);
digitalWrite(0,1);
delay(20);
digitalWrite(0,0);// turn alarm off when 3 seconds up ready to go again
delay(20);
digitalWrite(0,1);
delay(20);
digitalWrite(0,0);// turn alarm off when 3 seconds up ready to go again
delay(20);
}
_loop();
}
setup();
}
void _alarm() { // once alarm triggers, if disarmed it turns off alarm
varCount += 1;
if(digitalRead(4) == 1){ //when doors unlock signal goes high temporarily, disarm alarm instantly
varArmed = 0;
varCount = 0;
digitalWrite(0,0); //turn alarm off
setup();
}else{
//pulse the horn in a sequence so i know its mine
//if(varCount < 15) {
//digitalWrite(0,1);
// }else if(varCount < 20){
// digitalWrite(0,0);
// }else if(varCount < 25){
// digitalWrite(0,1);
// }else if(varCount < 30){
// digitalWrite(0,0);
// }else{
// varCount = 0;
// digitalWrite(0,0);
//}
}
}
void alarm() {
_alarm();
}
void _loop() {
}
void loop() {
_loop();
}
been out of electronics too long and ant work this one out now.
i want to build a circuit, an alarm circuit, that will toggle armed and unarmed with 2 separate high inputs, e.g. one input goes high for half a second to turn it on and another input goes high for half a second that turns it off. no matter how many times a high pulse is sent to the on input, the alarm will remain armed and vica versa.
another n/c input to trigger the alarm out for 5 seconds, so when this input is open circuit it will trigger the alarm output for 5 seconds only when the circuit is armed. after 5 seconds waits for another alarm input.
how can i build something like this easily??
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?