This project is based on the Arduino like development boards, known as Pinguino. It has an PIC 18F4550 microcontroller with Pinguino v.2 Bootloader.
The circuit is very simple since it has to survey only one area. It uses a common PIR motion detector, a siren and a GSM phone to comunicate if there is any event taking place.
The circuit is diveded in two sections: core and alarm. The core section is intended to be an universal plug-in so it can be used on various projects. It contains the 18F4550 with it's very necessary XTAL and power supply links.
The alarm section contains the part of the power supply (voltage regulators), output relays with attached transistors, indicator led and some wire connectors. You can look at this site as a "shield".
For the GSM section, I used a Nokia 6131 with the call button attached to K3 relay.
The program:
/*-----------------------------------------------------
Author: --<HCR>--
Date: Thu Jun 20 23:15:09 2013
Description:
-----------------------------------------------------*/
#define PIC18F4550
float Ub;
void setup()
{
pinMode(21, INPUT); //sensor
pinMode(27, OUTPUT); //siren
pinMode(2, OUTPUT); //phone call
pinMode(3, OUTPUT); //status led
pinMode(10, OUTPUT); //buzzer
pinMode(5, OUTPUT); //battery charge
pinMode(6, INPUT); //activated - deactivated
}
void loop()
{
if (digitalRead(21) && digitalRead(6) == LOW) // if sensor activated and alarm activated, start siren and make phone call
{
digitalWrite(10,HIGH);
digitalWrite(27, HIGH);
digitalWrite(2, HIGH);
delay(500);
digitalWrite(2, LOW);
delay(1000);
digitalWrite(2, HIGH);
delay(500);
digitalWrite(2, LOW);
delay(15000);
}
else
{
digitalWrite(27 , LOW);
digitalWrite(10 , LOW);
digitalWrite(2 , LOW);
}
if (digitalRead(6)) // if alarm activated, blink status led
{
digitalWrite(3, HIGH);
}
else
{
digitalWrite(3, HIGH);
delay(500);
digitalWrite(3, LOW);
delay(500);
}
Ub = analogRead(13)*(20 / 1023.0); // monitor battery voltage
if (Ub < 12) // if voltage < 12V start charging
{
digitalWrite(5, HIGH);
}
if (Ub > 13.8) // if voltage > 13.8V stop charging
{
digitalWrite(5, LOW);
}
}
The structure is very simple, it hasn't been optimized so if you have any questions or sugestions reffering to it feel free to send a comment.
In the future I intend to develop this project as a SMS remote control and multizone alarm system also with SMS capability. Until then stay tuned, and happy coding :).
The circuit is very simple since it has to survey only one area. It uses a common PIR motion detector, a siren and a GSM phone to comunicate if there is any event taking place.
The circuit is diveded in two sections: core and alarm. The core section is intended to be an universal plug-in so it can be used on various projects. It contains the 18F4550 with it's very necessary XTAL and power supply links.
The alarm section contains the part of the power supply (voltage regulators), output relays with attached transistors, indicator led and some wire connectors. You can look at this site as a "shield".
For the GSM section, I used a Nokia 6131 with the call button attached to K3 relay.
The program:
/*-----------------------------------------------------
Author: --<HCR>--
Date: Thu Jun 20 23:15:09 2013
Description:
-----------------------------------------------------*/
#define PIC18F4550
float Ub;
void setup()
{
pinMode(21, INPUT); //sensor
pinMode(27, OUTPUT); //siren
pinMode(2, OUTPUT); //phone call
pinMode(3, OUTPUT); //status led
pinMode(10, OUTPUT); //buzzer
pinMode(5, OUTPUT); //battery charge
pinMode(6, INPUT); //activated - deactivated
}
void loop()
{
if (digitalRead(21) && digitalRead(6) == LOW) // if sensor activated and alarm activated, start siren and make phone call
{
digitalWrite(10,HIGH);
digitalWrite(27, HIGH);
digitalWrite(2, HIGH);
delay(500);
digitalWrite(2, LOW);
delay(1000);
digitalWrite(2, HIGH);
delay(500);
digitalWrite(2, LOW);
delay(15000);
}
else
{
digitalWrite(27 , LOW);
digitalWrite(10 , LOW);
digitalWrite(2 , LOW);
}
if (digitalRead(6)) // if alarm activated, blink status led
{
digitalWrite(3, HIGH);
}
else
{
digitalWrite(3, HIGH);
delay(500);
digitalWrite(3, LOW);
delay(500);
}
Ub = analogRead(13)*(20 / 1023.0); // monitor battery voltage
if (Ub < 12) // if voltage < 12V start charging
{
digitalWrite(5, HIGH);
}
if (Ub > 13.8) // if voltage > 13.8V stop charging
{
digitalWrite(5, LOW);
}
}
The structure is very simple, it hasn't been optimized so if you have any questions or sugestions reffering to it feel free to send a comment.
In the future I intend to develop this project as a SMS remote control and multizone alarm system also with SMS capability. Until then stay tuned, and happy coding :).
Niciun comentariu:
Trimiteți un comentariu