House alarm calls on mobile
When my old alarm system is triggered, I want it to call my mobile phone without any pre-recorded message, simply to alert me that something is wrong.
Devices & Components
1
Arduino Uno Rev3
1
G6CU-2117P-US OMRON latching relay
Software & Tools
Arduino IDE
Project description
Code
Alarm-to-mobile
cpp
1/* 2 Mobile telephone on alarm 3 */ 4 5 int callbreak = 10; //time break (in secs) between calls 6 int hungupdelay = 12; //time delay (in secs) before hunging up the call 7 int finalhungupdelay = 5; //time delay (in secs) before hunging up the final call 8 int multipl = 1; //initial value of multiplier for callbreak 9 long callmult; //Total time break (in secs) between calls 10 11void setup() { 12 13 Serial.begin(9600); // Start serial communication 14 15 pinMode(10, OUTPUT); //driver for latched relay RL 16 pinMode(11, OUTPUT); //driver for latched relay RL 17 pinMode(2, INPUT); //check for RS (monitor alarm sensor) 18 pinMode(13, OUTPUT); //red led for hung up call 19 pinMode(12, OUTPUT); //green led for call 20 pinMode(7,OUTPUT); //relay for hung up call 21 pinMode(4,OUTPUT); //relay for call 22 23 callbreak=callbreak*1000; //conversion to milliseconds 24 hungupdelay=hungupdelay*1000; //conversion to milliseconds 25 finalhungupdelay=finalhungupdelay*1000; //conversion to milliseconds 26 27} 28 29void loop() { 30 31digitalWrite(11, HIGH); delay(10); digitalWrite(11, LOW); //relay RL ON 32 33digitalWrite(13, HIGH); //red led ON 34 35Alarmcheck: 36 int voltin=digitalRead(2); 37 38 callmult=(long)callbreak*multipl; 39 if(callmult >= (long)15*60*1000){callmult=(long)15*60*1000;}else{callmult=(long)callbreak*multipl;} //calkmult (Total time break) reaches max 15mins 40 41 if(voltin == 1) //RS in ON because ALARM WENT OFF (IT IS ON) 42 { 43 //Serial.println("");Serial.print(voltin); 44 //Serial.println("");Serial.print("ALARM ON"); 45 //Serial.println("");Serial.println(multipl); 46 //Serial.println("");Serial.println(callmult); 47 digitalWrite(7, HIGH); delay(500); digitalWrite(7, LOW);delay(500); //wake up mobile in case of asleep (by hungin up) 48 49 digitalWrite(4, HIGH); delay(500); digitalWrite(4, LOW);delay(500); //1st switching for calling 50 digitalWrite(4, HIGH); delay(500); digitalWrite(4, LOW); //2nd switching for calling: CALL INITIATED 51 digitalWrite(13, LOW);digitalWrite(12, HIGH); //green led ON 52 delay(hungupdelay); 53 digitalWrite(7, HIGH); delay(500); digitalWrite(7, LOW); //CALL ENDED 54 digitalWrite(12, LOW);digitalWrite(13, HIGH); //red led ON 55 delay(callmult); // delay to repeat call 56 multipl=multipl * 2; 57 goto Alarmcheck; 58 } 59 else 60 { // FINAL CALL BECAUSE ALARM IS OFF 61 //Serial.println("");Serial.print(voltin); 62 //Serial.println("");Serial.print("ALARM OFF"); 63 digitalWrite(4, HIGH); delay(500); digitalWrite(4, LOW);delay(500); //1st switching for calling 64 digitalWrite(4, HIGH); delay(500); digitalWrite(4, LOW); //2nd switching for calling: CALL INITIATED 65 digitalWrite(13, LOW);digitalWrite(12, HIGH); //green led ON 66 delay(finalhungupdelay); 67 digitalWrite(7, HIGH); delay(500); digitalWrite(7, LOW); //CALL ENDED 68 digitalWrite(12, LOW);digitalWrite(13, HIGH); //red led ON 69 delay(1000); 70 } 71 72digitalWrite(10, HIGH); delay(10); digitalWrite(10, LOW); //relay RL OFF --> ARDUINO DIES !!! 73 74delay(60*60*1000); //this is to "stop" the loop when running from PC 75 76}
Documentation
Congiguration diagram
congiguration.pdf
Comments
Only logged in users can leave comments