Smart Home Security System using Arduino
Security systems are widely suggested for homes as well as other locations. Everybody wants to take necessary steps to prevent infiltration at home, thus this security is necessary. Intruders nowadays may take advantage of almost any illegal activity and wreak havoc on a property's security. The security of one's home is a critical concern that everyone faces in the current day.
While there are certain devices on the market that may considerably help protect your house, some of them are excessively costly and need constant maintenance. Many devices regarding smart home security systems are available in the market but these are not user friendly according to the budget, the device we designed provides the user with a better interface with the help of LCD. We have used enough sensors that make sure the security protocol.
So in this way, we designed a reasonable security system that has the features of gas and flame detection with the help of MQ-2 Gas Sensor and flame sensor respectively and also have installed a Motion detector sensor known as PIR sensor to detect the intruder's motion. For a better user interface an LCD and Alarm are installed to alert the user. The whole system is programmed using Arduino UNO. A proteus circuit is designed for this project as shown below:
- You can download the complete project i.e. Proteus Simulation and Arduino Code by clicking the below button:
Smart Home Security System using Arduino
Components Required
For the home security system, we have used 3 sensors which are briefly explained as follows:
Flame Sensor
- The flame sensor is used to detect the fire, it has 3 pins (Ground, VCC, OUTPUT) with operational voltages ranging from 3.3V to 5V.
- This sensor may be constructed using an electrical circuit and a receiver similar to that used for electromagnetic radiation.
- This sensor employs the infrared flame flash technology, which enables it to operate through a layer of oil, dust, water vapor etc.
- There are several wavelengths of flame sensors normally in the range of 700 to 1100 nm from the source.
- Normally flame sensors have an operating temperature ranging from -25? ~ 85? with several features like adjustable sensitivity, fast response time and ease to use.
- Proteus doesn't have a Flame Sensor in its database, so you need to download this Flame Sensor Library for Proteus.
PIR Sensor
- PIR Sensor is used to detect the intruder’s motion.
- There are mainly two kinds of infrared sensors one is active and the other is passive.
- The active infrared sensor emits as well as absorbs the infrared radiations whereas the passive infrared sensor simply absorbs not emit.
- When an object enters or escapes the sensor's range, a passive infrared sensor is employed to detect it.
- For adjusting the sensitivity and delay time, there are two trim pots supplied. You may alter them to meet your requirements.
- The sensor produces a HIGH output when it senses movement within its range; otherwise, it generates a LOW output.
- PIR also has 3 pins like a Flame sensor.
- It has operating voltages of range 5V - 20V with output voltage generation of 0V-3V when the object is detected in the sensing range that is 7 meters.
- Proteus doesn't have a PIR Sensor in its database, so you need to download this PIR Sensor Library for Proteus.
MQ-2 Gas Sensor
- MQ2 gas sensors detect the presence of gases such as LPG, methane, ethanol and carbon monoxide in the air ranging up to 10000 ppm using electricity.
- It is also known as chemiresistor for the MQ2 gas sensor.
- The resistance of the sensing material changes depending on the amount of gas present.
- When it comes to detecting gas, sensors use variations in resistance value that generates the output voltage.
- When a sensor material is heated to a high temperature in the air, oxygen is adsorbed on the surface.
- Because current can flow via the sensor, its analog voltage values may now be read.
- The voltage values reported here may be used to compute the concentration of a gas. When the gas concentration is high, the voltage values are greater.
- Proteus doesn't have a Gass Sensor in its database, so you need to download this Gas Sensor Library for Proteus.
Arduino UNO
- Atmel's ATMega328 is used in the Arduino Uno, an open-source single-board microcontroller.
- Either an external power source or a 5V USB connection may be used to power the device.
- In all, there are 14 digital input/output pins on the board, with 6 of them serving as PWM outputs.
- On the board, you'll find a reset button and six analog input pins. The Arduino software is used to program the board, which is written in C language.
- When it came to controlling the home security system, the Arduino Uno's capabilities were found to be sufficient.
- Arduino Boards are not present in Proteus, so we need to use this Arduino Library for Proteus.
Circuit Designing
- This whole project is designed to provide a security system for the home in which multiple safety sensors can be installed with a Buzzer and LCD for a better user interface.
- We won't design this project in real, instead, we are going to design its Proteus simulation.
- If you are working on an electronics/embedded project, then it's always a best practice to design its simulation first.
- In simulations, it's easy to debug your code and thus you can program quickly.
- Once you are satisfied with your project's working, you can move forward to hardware designing.
So, let's design our Proteus Simulation for Smart Home Security System:
Proteus Simulation
- These are the components, which we are going to use for designing our Proteus Simulation:
- So, select these components from Proteus Components Library and place them in your workspace, as shown in the below figure:
- Next, we need to connect these components' pins to complete our circuit, as shown in the below figure:
- As you can see in the above simulation, we have used three sensors in total, which we have discussed above.
So, now we are going to design the Arduino Code for this simulation:
Arduino Programming Code
We have designed the circuit in our Proteus Simulation and next, we need to design its Arduino Code, in order to make it work.
LCD Initialization Code
- First of all, we are going to interface LCD with Arduino UNO and will display the Project's name on the screen.
- The code is shown in the below figure:
- As you can see in the above figure, we have first initialized the variables.
- Arduino board is programmed using Arduino IDE software which has mainly 2 sections void setup and void loop.
- Before void setup, we have to declare the pins of sensors and actuators that we are using in our project.
- Depending on the nature of sensors (analog or digital) the pins of sensors are connected to Arduino UNO accordingly.
- #define is used to declare the pins of Gas, PIR, FIRE and BUZZER.
- Initially, all the sensors have zero value that is stored by an integer variable.
- In the void setup section, input and output sensors are defined.
- GAS, PIR, and FIRE sensors are employed as input sensors to detect and activate the BUZZER, which is an output component.
- LCD 20×4 is used and lcd.begin is used to initiate the LCD.
- lcd.setCursor is used to cursor position on LCD and the name of the project is displayed on LCD Screen using lcd.print command.
- Now, let's run our simulation to check the results, shown in the figure below:
Sensors Interfacing with Arduino
- In Arduino IDE code execution, void setup runs once while the void loop executes again and again.
- analogRead and digitalRead commands are used to read the value of analog and digital sensors respectively, while analogWrite and digitalWrite commands are used for sending commands or data.
- As shown in the above figure, first, we have read the sensors' data and if all sensors are in LOW state, then have displayed the message "You are safe".
- Let's run the code to check the output:
- As you can see in the above figure, all sensors are at a LOW state and thus LCD is displaying the safe message.
- Next, we have added the if loop for the case where all sensors are giving HIGH value:
- The rest of the code has similar if loops for various conditions of sensors.
- You can download the complete code and Proteus Simulation from the link, given at the start of this tutorial.
- Now, let's run our final simulation and test the sensors and if everything goes fine, you will get results as shown in the below figure:
Future Recommendations
It deters the crime and notifies the user about the gas or fire problem. Home security systems are mostly utilized for safety reasons in residences, businesses, and educational facilities. Another option is to use a mobile device or the internet to send data to a remote location. Other modules, such as a wind sensor or a fire sensor, might be added to the system in the future. Voice alarm modules may also alert you to an intruder or a gas leak if you use them. We can increase the number of sensors to make it better. We can use the latest technology of the Internet of Things that makes our system wireless. A growing number of devices and goods are being connected to the Internet, which is referred to as the Internet of Things by the phrase. We can use the Internet of Things to produce a low-cost security system for residential and industrial applications that is especially useful for home security. When the door is opened or an unauthorized entry is detected, the system will send an alert to the owner. The user may take action after getting the notification. ESP8266 Wi-Fi module will connect to and interact with the Internet, while an Arduino Uno microcontroller keeps track of the system's status, as well as a magnetic Reed sensor for sounding the alarm. The principal advantages of this system are ease of installation, low costs, and low maintenance requirements.
So, that was all for today. I hope you have enjoyed today's project. If you have any questions, ask in the comments. Thanks for reading. Take care !!! :)
Home Security System using Arduino UNO in Proteus
Hello friends, I hope you all are doing well. In today's tutorial, we are going to design a Home Security System using Arduino UNO in Proteus software. It's the most commonly designed engineering project, especially in electrical, electronics and mechatronics engineering. Normally engineering students design it as a semester project during their engineering course.
So, today we will design a home security system from scratch in Proteus software. I have given the complete project below to download but I would suggest you to design it on your own so that you could understand it better. So, let's get started:
Home Security System: Project Description
- Before going into the detail, let's first download the complete Proteus Simulation with Arduino Code, by clicking the below button:
Home Security System using Arduino UNO in Proteus
Let me first give you a detailed project description i.e. what we actually want to design? We want to build a Home Security Project, which should follow these security protocols:
- Fire alarm: It should be able to detect the fire and sound an alarm to alert everyone at home.
- Smoke alarm: It should detect the gas(smoke) and turn on the alarm(if detected).
The above-mentioned security protocols will be followed 24/7. Moreover, there will be two security modes in the project, named:
- Secure Mode.
- Normal Mode.
Let's have a look at both of these modes, one by one:
1. Secure Mode
- This mode should be selected, when owners want to completely secure their home i.e. they are leaving home or while sleeping at night.
- If the Secure Mode is selected, the project should follow the following security protocols:
- Intruder Detection Alarm: It should detect the presence of any human being in the occupied premises.
- Windows Security Alarm: If someone tries to break through the windows, the project should sound an alarm.
- Door Security Alarm: If any intruder tries to break through the main door, it should again sound the alarm to alert everyone.
2. Normal Mode
- This mode should be selected, when owners are at home and just want to take the basic security measures.
- In this mode, only the Fire Alarm & Gas Alarm will work, while all other alarms will remain on standby.
Other Features
- There should be an LCD, to display values of all parameters.
- It should have a buzzer to generate an alarm, in case of emergency.
- There should a Push Button to make switches between these security modes.
Here's the final simulation, which we are going to design in today's lecture:
So, these are our requirements, which we want to achieve in this Home Security Project. Now let's have a look at the components selected for this project:
Home Security System: Components Selected
Now let's have a look at the list of components, which I have selected for this Home Security Project. I will also briefly explain the purpose of using each component.
1. Arduino UNO
- As clearly it's an Embedded Systems Project, so first of all we need to select a Microcontroller for our project.
- As I have mentioned earlier, we will use the Arduino UNO Microcontroller board for designing this project.
- Arduino UNO will act as the brain of the project and will control all sensors and modules.
2. Flame Sensor:
- A flame sensor is used to detects the presence of fire.
- The sensor basically consists of a photo-diode that detects the Infrared rays that emit from the fire. When it detects a fire, its output goes HIGH.
3. Gas Sensor (MQ-6)
- MQ-6 Gas Sensor is used to detect the concentration of gases in the environment.
- The sensor produces a potential difference proportional to the concentration of the particular gases.
- The type of gas that it detects depends upon the material used in the sensor.
- There are many gas sensors available in the market i.e. MQ-2, MQ-3, MQ-4 etc.
- These sensors are available as ready-made modules for easy interfacing with the microcontroller.
4. PIR Sensor(HC-SR501)
- HC-SR501 PIR sensor is used to detect any human being(intruder) in the Secure Mode.
- It detects the IR radiations from the human movement & generates a pulse on its output.
- The time period of the pulse could be varied by using the potentiometer on the sensor.
5. Vibration sensor(SW-420)
- The SW-420 vibration sensor is used to detect any forced entry through windows.
- In Secure Mode, if someone tries to open the window, the sensor will detect vibrations and will send a HIGH signal to the microcontroller.
6. Infrared Sensor
- An infrared sensor will be placed at the door and someone tried to enter through that door, the sensor will detect it.
- It consists of an IR transmitter and a photo-diode that are placed close to each other.
- If any object movement occurs in front of the sensor, the IR rays hit the object and return back with a particular angle called incident angle.
- This pulls the comparator output to ground or logic LOW.
7. LCD 20x4
- LCD 20x4 will be used for displaying the values of all these sensors.
- It will also display useful information i.e. which mode is selected.
8. Buzzer
- A small 5V Buzzer is used to sound the alarm.
9. LM7805
- LM7805 is a voltage regulator and is used to convert voltage from 12V to 5V.
- Power sources(i.e. battery, adapter etc.) available are normally 12V, as it has become a standard.
- Moreover, many components also operate at 12V like a buzzer or DC motor.
- While microcontrollers and sensors work on 5V, so in Embedded projects, it's quite necessary to design a voltage regulator from 12V to 5V and in some cases 3.3V.
- I normally prefer LM7805 for converting voltage from 12V to 5V.
10. Resistances(1kohm)
- We need to use a few resistances of 1kohm.
11. Small LED
- We will also use a small LED for power indication.
12. Capacitors(100uF)
- We will also use few capacitors of 100uF, as it removes any noise/ripples.
So, these are the components, we are going to use for designing Home Security System. Now let's get started with designing the Proteus Simulation:
Proteus Simulation of Home Security System
As I have told you earlier, I am going to use Proteus software for designing this project. Proteus is an excellent simulation tool, where we will not only design the circuit of this project but will also test its output. I always design my programming algorithms on simulations as working on real hardware is too time-consuming. You should remove all your programming bugs in simulation and once confirmed then design your project in real hardware. So, let's start:
Install Proteus Libraries
- Arduino boards & sensors' modules are not available in the Proteus components list.
- So, first of all, we need to install these Proteus libraries:
- Adding these libraries is quite simple, you just need to place their files in the library folder of Proteus software.
- If you got any issues, then read this guide on How to add a Library in Proteus 8.
Once you added all the libraries, now open your Proteus software.
Designing Circuit Diagram in Proteus
- Now we need to design a circuit for our project, so select these components from Proteus Components Search Box.
- First of all, let's design the voltage regulator circuit using LM7805, which will be simply converting the voltage from 12V to 5V.
- As you can see in the above figure, I have used 12V Battery, while the output of LM7805 is showing 5V and I have also placed an LED for power indication.
LCD Interfacing with Arduino:
- Next, we need to interface 20x4 LCD with Arduino UNO, so design the circuit as shown in the below figure:
Next, we need to interface five sensors with Arduino UNO, so let's add them to our Proteus simulation:
Sensors Interfacing with Arduino:
- These are simple digital & analog sensors and are all powered up at 5V.
- So, simply connect them as shown in the below figure:
- The Flame Sensor is connected to pin A0 of Arduino UNO.
- Gas Sensor is connected to pin A1 of Arduino UNO.
- PIR Sensor is connected to pin A2 of Arduino UNO.
- The Vibration Sensor is connected to pin A3 of Arduino UNO.
- The Infrared Sensor is connected to pin A4 of Arduino UNO.
For simulation, ensure all hex files are uploaded to each sensor for proper working. You can upload the source code hex file to the Arduino, by pressing Ctrl+E or by right click --> Edit properties.
Buzzer & Push Button:
- Finally, we need to add the Buzzer to sound the alarm in emergency cases, I have connected it to Pin A5 of Arduino UNO.
- I have also connected a push-button for switching the modes, connected to Pin 7 of Arduino UNO, as shown in the below figure:
- Here's the image of the complete Proteus Simulation for Home Security System:
Now let's design the Arduino programming code for Home Security Project:
Arduino Code for Home Security System
In the previous section, we have designed the Proteus simulation of the project, now let's design its Arduino Code to make it alive. Let's get started:
Initialization LCD Arduino Code
- First of all, we need to define all our variables, as you can see in the code shown in the right figure.
- I have included the Liquid Crystal Library, which is used to operate LCD.
- Next, I have defined all my sensors to the respective pins and then initialized boolean variables for storing the output of sensors.
- In the Setup loop, I have made the sensors' pins input pullup using the pinMode Arduino command.
- Finally, displayed an initialization message on the LCD screen i.e. "Home Security System using Arduino UNO By TEP".
- The message will display for around 1 second and then LCD will be cleared and the SensorDisplay function will be called, which will simply write sensors' names on the LCD screen.
- Now compile your code and add the hex file in Arduino UNO and run your PRoteus simulation.
- If everything goes fine, you will get results as shown in the below figure:
So far, we have just displayed the sensor's names, now let's read the sensors' data in the loop section:
Reading Sensors' Data
- In the loop section, first of all, we need to read the sensors' data using the digitalRead command, as shown in the code.
- After reading the sensor's data, I have called the SensorValues function, in which I have placed a check on each sensor's value and updated it on LCD.
- It's quite straightforward code, if the sensor is giving HIGH output, I am displaying Yes on LCD and if it's LOW, I am simply printing No.
- We haven't yet defined the modes, so the project will keep on reading the sensors and will display their respective value in the LCD.
- As you can see in the below figure, if the TestPin of the sensor is HIGH, its respective value on LCD is showing "Yes" and if it's LOW then "No" is written.
- Now, if you change any sensor's value, its respective value on LCD will be updated.
So, we have successfully interfaced our sensors with Arduino UNO and now it's time to add operational modes to our project.
Two Operational Modes
- As I mentioned earlier, we need to add two operational modes in our project, and the push button will be used for conversion from one mode to another.
- So, I have simply added an If loop in my code, as shown in the figure on the right side.
- In normal mode, I have simply displayed the name of the mode at the first line of LCD.
- While in secure mode, I am checking if either of the sensors goes HIGH, simply turn ON the Buzzer.
- Although, you won't be able to hear the Buzzer sound in the below figure, but you can see Buzzer's Pin is HIGH because two of the sensors are giving a response. Check the video for Buzzer working.
- We normally need to use an optocoupler or relay driver in between the buzzer and microcontroller as buzzers normally operate at 12V, but 5V buzzers are also available.
- Here's the complete Arduino Code:
/*
* All rights reserved to TEP www.TheEngineeringProjects.com
*/
#include
const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
#define Flame A0
#define Gas A1
#define Pir A2
#define Vib A3
#define Ir A4
#define Buzzer A5
#define Switch 7
boolean Fire, Smoke, Intruder, Window, Door;
boolean Mode = false;
void setup() {
pinMode(Flame,INPUT_PULLUP);
pinMode(Gas,INPUT_PULLUP);
pinMode(Pir,INPUT_PULLUP);
pinMode(Vib,INPUT_PULLUP);
pinMode(Ir,INPUT_PULLUP);
pinMode(Switch,INPUT_PULLUP);
pinMode(Buzzer,OUTPUT);
lcd.begin(20,4);
pinMode(Buzzer, OUTPUT);
lcd.setCursor(0,1);
lcd.print("HOME SECURITY SYSTEM");
lcd.setCursor(0,2);
lcd.print(" USING ARDUINO UNO ");
lcd.setCursor(7,3);
lcd.print("By TEP ");
//delay(700);
lcd.clear();
SensorDisplay();
}
void loop()
{
Fire = digitalRead(Flame);
Smoke = digitalRead(Gas);
Intruder = digitalRead(Pir);
Window = digitalRead(Vib);
Door = digitalRead(Ir);
Mode = digitalRead(Switch);
SensorValues();
if(Mode==false) // Normal mode
{
lcd.setCursor(4,0);
lcd.print("Normal Mode");
}
else // Secure Mode
{
lcd.setCursor(4,0);
lcd.print("Secure Mode");
if((Fire == HIGH) || (Smoke == HIGH) || (Intruder == HIGH) || (Window == HIGH) || (Door == HIGH)){
digitalWrite(Buzzer, HIGH);
}else{
digitalWrite(Buzzer, LOW);
}
}
}
void SensorDisplay()
{
lcd.setCursor(0,1);
lcd.print("Fire:");
lcd.setCursor(10,1);
lcd.print("Smoke:");
lcd.setCursor(0,2);
lcd.print("Door:");
lcd.setCursor(10,2);
lcd.print("Window:");
lcd.setCursor(0,3);
lcd.print("Intruder:");
}
void SensorValues()
{
if(Fire == true){ lcd.setCursor(6,1); lcd.print("Yes");}
else{ lcd.setCursor(6,1); lcd.print("No ");}
if(Smoke == true){lcd.setCursor(17,1); lcd.print("Yes");}
else{lcd.setCursor(17,1); lcd.print("No ");}
if(Intruder == true){lcd.setCursor(11,3); lcd.print("Yes");}
else{lcd.setCursor(11,3); lcd.print("No ");}
if(Window == true){lcd.setCursor(17,2); lcd.print("Yes");}
else{lcd.setCursor(17,2); lcd.print("No ");}
if(Door == true){lcd.setCursor(6,2); lcd.print("Yes");}
else{lcd.setCursor(6,2); lcd.print("No ");}
}
Future Scope of Home Security System
- Embedded has taken over the whole world because of its user-friendliness and low cost.
- Instead of hiring security guards(which is quite expensive), now smart homes in modern societies are equipped with such home security systems.
- Modern Home Security systems are even linked with local police or security agencies for emergency help.
- Moreover, these security systems are not bound to homes only, nowadays offices, banks, shopping malls etc. are all equipped with such smart security systems.
Future Work on Home Security System
- Today, we have designed a very simple Home Security System, where we interfaced few sensors and have only placed a Buzzer.
- We will continue this project and will add smart features to it.
- Let's have a look at few features, which we can add to this project:
- We can interface the GSM module to send messages, in case of emergency.
- We can add more sensors i.e. ultrasonic sensors, different types of Gas sensors in it.
- We can also improve our code by using interrupts instead of polling.
- We can also add a camera for facial recognition.
- To improve the security, we can add a keypad and only authorized persons will have the access to enter.
- The fingerprint sensor can also be used for identification purposes.
No matter what happens, you should put safety first. Even a great security system won’t ensure full protection, which is why you might want to consider secondary measures. Hiring fire watch security will assist you on a daily basis, performing tasks that machines cannot. These veterans will protect your home or office, addressing potential hazards as they appear.
So, that was all for today. I hope you guys have enjoyed today's project. If you have any questions/queries, please ask in the comments and I will try my best to resolve them asap. Thanks for reading, take care. Bye :)
Smoke Detector with Arduino & MQ2 Sensor
Hello everyone, I hope you all are doing great. In today's tutorial, we are gonna have a look at How to design a
Smoke Detector with Arduino. Its quite a simple project but if you are working on any security project then you must add this feature in it. You should also download this
Gas Sensor Library for Proteus, and design its simulation.
I will use gas sensor MQ2 for this project. I have purchased MQ2 Gas Sensor module as its quite easy to interface with Arduino. Arduino board I'm using is Arduino UNO. I have also designed an
LPG Gas Leak Detect using Arduino using this MQ2 Sensor. So, let's get started with How to design Smoke Detector with Arduino & MQ2 Sensor.
Smoke Detector with Arduino & MQ2 Sensor
- First of all, we need to connect some jumper wires between Arduino and MQ2 smoke sensor shield.
- Here's the image of our Gas sensor and you can see, it has four pins in total.
- This gas sensor has four pins in total, which are:
- Vcc: We need to provide +5V.
- GND: We need to ground it.
- D0: Digital Output.
- A0: Analog Output.
- So now you will need four male to female jumper wires and connect them as shown in below figure:
- Sensor's pins are labelled on the back side and I have connected these four pins as follows:
- White Wire: Vcc of Sensor connected with +5V of Arduino.
- Black Wire: GND of Sensor connected with GND of Arduino.
- Grey Wire: D0 of Sensor connected with Pin # 8 of Arduino.
- Orange Wire: A0 of Sensor connected with A0 of Arduino.
- So, now let's design our code in Arduino software in which we will detect whether there's smoke around or not.
- I'm gonna use the analog output of our sensor and will first display the analog value in my Serial Monitor.
- I have used the below code, so copy it and upload in your Arduino board:
int Input = A0;
int SensorVal = 0;
void setup() {
Serial.begin(9600);
pinMode(Input, INPUT);
Serial.println("Interfacing of Smoke Sensor with Arduino");
Serial. println("Design by www.TheEngineeringProjects.com");
Serial.println();
}
void loop() {
SensorVal = analogRead(Input);
Serial.println(SensorVal);
delay(500);
}
- Now open the Serial Monitor of Arduino to check the analog values coming from our sensor.
- If everything goes fine then you will get something like this in your Serial Monitor:
- You can see we are getting the values in range of 420 to 450.
- You should read How to do Arduino Serial Communication, if you don't know how to get data serially.
- Now let's place a burning cigarette near it for smoke. (Cigarettes are injurious to health :P )
- When the sensor will sense smoke in its surroundings then its value will start to increase and in my case it reached to around 650.
- So, let's place a check in our Arduino coding to detect whether there's smoke or not.
- So add below code in your Arduino software and upload it to your Arduino board.
int Input = A0;
int SensorVal = 0;
int Check = 0;
void setup() {
Serial.begin(9600);
pinMode(Input, INPUT);
Serial.println("Interfacing of Smoke Sensor with Arduino");
Serial. println("Design by www.TheEngineeringProjects.com");
Serial.println();
}
void loop() {
SensorVal = analogRead(Input);
if((SensorVal > 500) && (Check == 1))
{
Serial.println("Smoke Detected . . .");
Check = 0;
}
if((SensorVal < 500) && (Check == 0))
{
Serial.println("All Clear . . .");
Check = 1;
}
//Serial.println(SensorVal);
delay(500);
}
- After uploading the code to Arduino, open your Serial Monitor.
- If everything goes fine then you will get something as shown in below figure:
- Now let me bring the cigarette close to get some smoke. (Cigarettes are injurious to health :P )
- You will get the warning as soon as it will detect smoke as shown in below figure:
- We got the detection of smoke in our Serial Terminal.
So, that's how we can easily design a Smoke Detector with Arduino & MQ2 Sensor. I think now you can quite easily design this smoke detector project at home. I hope you will enjoy it. Will meet you guys in next tutorial. Till then take care and have fun !!! :)
Real Time Security Control System using XBee and GSM
Hello everyone, I hope you all are doing great. In today's post, I am going to share a Final Year Project in detail, named as Real Time Security Control System using XBee and GSM. I will give you all the details so that you can easily design it on your own. I've given the Proteus Simulation to download below. In that zip file, you will get both the Arduino codes and Proteus Simulations.
I have divided this whole project design into four parts. If you got into any trouble in your project, then ask in comments and I will try my best to resolve them. So, today we are gonna have a look at the basics of this Security project. There are a lot of systems introduced in the market these days that are used to transfer sensor data from one node to another either wirelessly or through some wired connection. The proposed technique also works on this same principle. But a lot of modifications are intended to introduce in order to enhance this technique.
Real Time Security Control System
- You can download this Project by clicking the below button:
Real Time Security Control System using XBee and GSM
Now let's have a look at the project description:
Project Description
In this project, I have designed a real-time security system, which consists of two wireless nodes named as
So, first of all, let's have a look at these two nodes one by one. First, I am going to discuss Sensor Node:
Sensor Node
The sensor node is placed in that building which is needed to be secured. Sensor node consists of three different sensors and two modules used for security purposes named as:
- Sensors:
- Smoke Sensor: To detect Smoke.
- Flame Sensor: Used for Fire Detection.
- Temperature Sensor: Measuring Temperature of surroundings.
- Modules:
- GSM module: is used to deliver the notification message if any fault occurs in the system.
- GPS module: is used to locate the exact position of the fault that occurred.
Below two modules are used for controlling purposes:
- Modules:
- Arduino UNO: All these Sensors and modules are connected to Arduino UNO.
- XBee Module: To send sensors' data & GPS Location to Base Node.
Block Diagram for the Sensor Unit of Real Time Security Control System using XBee and GSM is shown in below figure:
Now let's have a look at the Base Unit of Real Time Security Control System using XBee and GSM.
Base Unit:
- The base node will be placed in the Control Department. It could be your security guard's room or the nearby police station.
- This node will receive the data from the sensor node via XBee module.
- So, in total it will have three modules on it which are:
- XBee Module: It is used to maintain wireless communication between the sensor node and base node.
- LCD 20x4: It is used to display real-time conditions like sensors' values & GPS Location.
- Arduino Mega 2560: It is used to control both of these modules.
- Here's the block diagram of Base Unit for Real Time Security Control System using XBee and GSM:
Components Selected
In the previous section, we have had a look at the basic Introduction of our Real Time Security Control System using
XBee and GSM. This section will elaborate on the selection of the components which is the most important factor before designing any project/product. This is basically a simulation based project so there is no hardware involved in this project. The proposed technique is designed in
Proteus ISIS. All of the components are taken from the Proteus library.
Flame Sensor
- The flame sensor is an electronic device usually used for fire detection purposes.
- It can be used in homes, industries, offices, schools etc.
- A certain threshold is adjusted while designing the algorithm.
- When the fire flames cross that particular threshold, the flame sensor will send a signal to Arduino which will send that signal through Xbee to Base Unit immediately.
- As soon as the signal will be received on the Base Unit, the alarm will turn ON and hence guards will come to know that this area has become dangerous now.
- Immediate precautions must be taken in this case.
- Flame Sensor is not available in Proteus so we have designed its library.
- You should download this Flame Sensor Library for Proteus.
Smoke Sensor
- A smoke sensor is used to detect a certain level of smoke within the desired region.
- It is usually used in homes and organizations for the detection of fire or internal burns.
- It is a low-cost and very sensitive sensor that also beeps if someone is smoking in its coverage area.
- This Smoke Sensor will detect any smoke in the area then it will warn the Arduino board which will, in turn, send a signal via XBee to Base Unit.
- Proteus software doesn't have a smoke sensor in it so you should download this Smoke Sensor Library for Proteus.
Temperature Sensor
- The temperature sensor is an electronic sensor used to estimate the temperature in the surroundings.
- The temperature range can be adjusted while designing its algorithm.
- When the temperature in the surroundings reaches the adjusted threshold, it generates a notification.
- Most of the time an alarm is attached to the temperature sensor. The alarm starts to beep when the desired temperature is reached. It can be used in homes, offices and organizations to maintain the temperature of a certain area according to the desired requirements.
- But in our project we want to send a signal to the base unit, so that's why this sensor will send a signal to the base unit.
XBee Module
- XBee is selected as a wireless module. The proposed technique consists of two XBee modules.
- One is attached to the base unit and the other is attached to the sensor unit.
- The data is transmitted by the sensor unit via XBee module.
- And the XBee module attached to the base unit receives that data from the sensor unit and sends it to the microcontroller to manipulate it.
- There are many wireless modules available in the market these days e.g. Radio Frequency (RF) module.
- Some of them are not used commonly due to their shorter ranges e.g. Bluetooth module.
- XBee module is far better as compared to the Bluetooth module and provides a larger coverage area in comparison to similar wireless modules.
- So, XBee is used in this project. XBee module is not available in Proteus so that's why you should download XBee Library for Proteus.
Arduino UNO
- The microcontroller plays a vital role in any project and is like a backbone of a particular project.
- Arduino UNO and Mega 2560 both are selected as a microcontroller.
- Arduino UNO is attached to the sensor unit and Arduino Mega 2560 is attached to the base unit.
- Arduino is an open-source device. Students can take online help in almost every task. Online source codes are also available for different tasks.
- So, a student can easily perform them with a proper understanding.
- Arduino boards are also not available in Proteus so you should download this Arduino Library for Proteus.
GPS Module
- GPS module is used to locate the exact location of the fault.
- GPS module will be attached to Sensor Unit, so if anything goes wrong then we can also get the GPS location via SMS.
- It will provide us the longitude and latitude of the fault that occurred on the sensor unit.
- So, now if any of these sensors goes wrong then you can easily get the location of your sensor node via SMS.
- Proteus doesn't have GPS Module in it so you should download this GPS Library for Proteus.
GSM Module
- GSM module is used for security purposes.
- If a fault occurs at any position within the network, a notification message will be generated and sent towards the base unit from the sensor unit.
- We can also generate a call using this GSM which will be a much better way.
- This GSM module will also send the location via SMS. We have received this location from GPS in the form of longitude and latitude.
- Proteus doesn't have GSM Module in it so you should download this GSM Library for Proteus.
So, these are all the components/modules, which I have used in this project. So, in the first part, have seen the basic Introduction of the project and then in the second section, we have had a detailed overview of all the modules used. So, now in the next section which is the third part I am gonna show you How to design these Proteus Simulations.
Proteus Simulation of Security Control System
In this section, we are gonna have a look at how to design these Proteus Simulations for Real Time Security Control System using XBee and GSM. As you know, I have used Arduino so we also need to discuss the code in order to run these simulations. So, first, we will design the proteus simulations and then we will write its code.
Proteus Simulations
- I have designed two simulations for this project.
- First of all, what you need to do is to download all those above Proteus Libraries and add them properly.
- I have given detailed instructions in each post about How to use them.
- After adding all these Libraries, now restart your Proteus software and design a circuit for the Sensor Unit.
- Proteus Simulation of Sensor Unit is shown in the below figure:
- As you can see in the above figure, the Sensor unit consists of three different sensor modules, which are:
- Temperature sensor.
- Smoke sensor.
- Flame sensor.
- In this unit, Arduino UNO is used as a microcontroller to get data from all the sensors and this data will be transmitted wirelessly towards the base unit for proper monitoring.
- XBee module is used for wireless communication between the sensor unit and the base unit.
- GPS module is interfaced in order to locate the exact position of the fault that occurred in the system.
- Now we are gonna design our second simulation for the Base Unit.
- The Proteus Simulation of Base Unit is shown in the below figure:
- The base unit is basically a monitoring end of the system.
- All the data obtained from the sensors is transmitted by the sensor unit towards the base unit.
- The base unit has an Arduino Mega 2560 as a micro-processing unit.
- Just like the sensor unit, an XBee module is also attached to the base unit in order to receive the data wirelessly sent by the base unit.
- There is an LCD on the base unit. It is used to visualize the obtained results. It displays different messages e.g. fault detection, sensors data etc.
- GSM module is used in the base unit to send the notification if a fault occurs in the system or the system is showing some abnormal behavior even for an instance.
- This GSM module will also send the location in SMS. You have to enter the number of recipients in the programming code.
Arduino Code of Security Control System
- When you download this project, you will get a .rar file and within that file, you will find two folders.
- One of them will have the Arduino Codes and the other one will have Proteus Simulations.
- I have already added all the hex files so you just need to run these simulations.
- If you got into any trouble then use our Contact Form and our team will help you out.
- You should also need to read How to Get the hex file from your Arduino Software.
Proteus Simulation Results
- Now coming towards the last section of this project, now I am gonna show you the results of these simulations.
- So, I have run both of these Simulations and here's the first look at Base Unit:
- The LCD on the base unit is displaying the title of our project.
- Virtual Terminal is connected with Arduino so that we could also have a look at incoming or outgoing data.
- After that first of all, Arduino will communicate with the GSM module and will set its settings, as shown in the below figure:
- Now our GSM module has configured, so the next screen of the base unit is shown below:
- As you can see in the above figure that LCD is displaying the values of all three sensors and because all are normal that's why the Alarm is OFF.
- The temp value is 0 because we haven't yet received the data from the sensor unit.
- Now let's run our Sensor Unit and make our Fire Sensor HIGH, then you will get results as shown in the below figure:
- The alarm is also ON in the above figure and SMS has also been sent which is shown in Virtual Terminal.
- In case, when both fire and smoke are detected, LCD will display smoke as well as fire detection messages.
- SMS will also be sent as you can see in the Virtual Terminal. GSM has sent the message indicating Fire Detected and GPS Location.
- Base Unit Proteus Simulation is shown in the below figure:
- So, whenever you change any of these sensors' values in the Sensor Unit then the respective value will change in the Base Unit.
So, that was all about Real Time Security Control System using XBee and GSM. If you got into any trouble then ask in the comments and I will help you out. Thanks for reading, take care and have fun !!! :)
LPG Gas Leak Detector using Arduino
Hello friends, hope you all are fine and having fun with your lives. Today, I am going to share a new project named LPG Gas Leak Detector using Arduino in Proteus ISIS. Before reading this tutorial, you must first download the Gas Sensor Library for Proteus because we are gonna use that Library and will simulate the Gas Sensor in Proteus.
In this library you will find eight sensors and all of them works exactly the same so that's why we are gonna use one of them. For LPG Gas Leak Detector Project I have used MQ-2 sensor which is used for detection of LPG gas. I have also used Arduino UNO board which you can simulate in Proteus using Arduino Library for Proteus. Moreover, I have also placed an LCD which will display either LPG gas Leak Detected or not. So, let's get started with LPG Gas Leak Detector using Arduino in Proteus ISIS.
LPG Gas Leak Detector using Arduino in Proteus ISIS
- First of all, download the Gas Sensor Library for Proteus and install it in your Proteus software so that you can it in Proteus.
- After installing the Gas Sensor Library, now download the LPG Gas Leak Detector Project's simulation and programming code by clicking the below button:
Download Proteus Simulation & Code
- Now, let's design this project so that you can get a better idea of how it works.
- First of all, design a small circuit in your Proteus software as shown in below figure:
- Now you can see in the above figure that I have used Arduino UNO board along with 20 x 4 LCD and Gas Sensor MQ-2.
- You can use this LCD by download this New LCD Library for Proteus.
- Next thing you need to do is to download the below code and get your hex file.
#include <LiquidCrystal.h>
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(13, 12, 11, 10, 9, 8);
int Gas = 7;
void setup() {
// set up the LCD's number of columns and rows:
lcd.begin(20, 4);
// Print a message to the LCD.
lcd.setCursor(0,0);
lcd.print("Gas Detected :");
lcd.setCursor(1,2);
lcd.print("www.TheEngineering");
lcd.setCursor(4,3);
lcd.print("Projects.com");
pinMode(Gas , INPUT);
}
void loop() {
if(digitalRead(Gas) == HIGH){lcd.setCursor(14,0);lcd.print(" Yes");}
if(digitalRead(Gas) == LOW){lcd.setCursor(14,0);lcd.print(" No ");}
}
- If you don't know about Hex file then read How to Get Hex file from Arduino Software.
- Upload this Hex File in your Proteus Arduino software and then run your simulation.
- If everything goes fine then you will get results as shown in below figure:
- So, you can see in the above figure that when Gas Sensor is HIGH then its written on the LCD that Gas Detected: Yes.
- Here's a video which will explain this LPG Gas Leak Detection using Arduino in Proteus ISIS:
So, that's all for today. I hope you have enjoyed this project named LPG Gas Leak Detection using Arduino in Proteus ISIS. Will meet you guys in the next tutorial. Till then take care and have fun !!! :)
GSM Based Home Security System
Hello friends, I hope you all are fine and having fun with your lives. Today, I am going to share a complete project named as GSM Based Home Security System. I have designed its complete working simulation in Proteus and have used different libraries which you can also download from our blog. In the previous post, I have posted Home Automation Project using XBee & Arduino and today we are gonna work on Home Security System.
We have designed this simulation after a lot of efforts that's why we have placed a very small amount of $50 on it so that engineering students can download it and get knowledge from it. Moreover, as its a complex project so when you buy it then there's a chance that you can't run it by yourself so we also offer a free service. If you got into any trouble while running this simulation then use our Contact Form we will help you out personally within 24 hours.
GSM based Home Security System
- You can buy this complete project by clicking the below button:
Buy This Project
- When you will click the above button, you will be taken to the sale page for this project and you can buy this project using PayPal.
- When you buy it you will get the complete code along with working Proteus simulation.
- So, let's have an overview of this GSM Based Home Security System.
- This GSM based Home Security System contains seven sensors which will be installed theoretically in your home. :)
- These seven sensors are:
- PIR Sensor: For Motion Detection.
- Smoke Sensor: For Smoke Detection.
- Flame Sensor: For Fire Detection.
- Vibration Sensor for Window: For Detection of vibrations on Window.
- Vibration Sensor for Door: For Detection of vibrations on Door.
- Ultrasonic Sensor for Window: For intruder Detection on Window.
- Ultrasonic Sensor for Door: For intruder Detection on Door.
- When we are talking about security then we have to take care of door and windows.
- That's why I have placed two sensors on each of them. If someone tries to break the window then the vibration sensor will sense it and if someone tries to open the window then ultrasonic sensor will detect it.
- The same will happen for the door.
- So, whenever any of these seven sensors will get activated then the buzzer will go on and at the same time the user will receive a warning message.
- Moreover, I have also placed an LCD which will display the sensors' condition.
- Here's the Proteus Simulation for this GSM based Home Security System:
- You can see in the above figure that I have used all these seven sensors mentioned above.
- Moreover, I have used the GSM module, you can read more about it on GSM Library for Proteus.
- Moreover, we have the Power circuit and the Buzzer Driver Circuit at the bottom.
- Arduino UNO acting as the brain of this GSM Based Home Security System.
- Now, let's run this simulation and if everything goes fine then you will get something as shown in below figure:
- First of all, the system will configure the GSM module and then it will display two screens on LCD side by side.
- First LCD screen is shown in below figure:
- The first screen will show the status of first three sensors.
- Now here's the screenshot of second screen showing the status for next four sensors:
- That's how this project is working, now when any of these sensors got HIGH then buzzer will go ON and a message will be sent to the given number:
- Now, you can see when I click the Smoke Sensor HIGH, it got detected immediately and a warning message is sent to my number.
- I have explained this GSM based Home Security System in detail in the below video:
So, that's all for today. I hope you guys have enjoyed this awesome project. Before buying it, you must read it completely and also watch the video so that you are sure about what you are buying.
Home Automation Project using XBee & Arduino
Hello friends, I hope you all are fine and having fun with your lives. Today, I am going to share a new Home Automation Project using XBee & Arduino. Home Automation Project is a most commonly designed project by the engineering students. So, that's why I have thought to create a complete Home Automation Project so that engineering students can get benefit out of it.
We all know about automation which is originated from automate or automatic. In automation the task is done automatically and you don't need to control it. In normal Home automation project, there are few sensors which are displayed wirelessly to user and there are few controls like user can ON or OFF Lights, Fans etc via remote or mobile App.
In this Project, I have used Arduino UNO board and I have designed its complete working simulation in Proteus software, so that users got sure that its working perfectly. Because we have to work a lot in designing this complete working simulation of home Automation Project that's why its not free but you can buy it for a small price of $50. In this price, you will get the compelte Arduino code along with the working Proteus Simulation. But before buying this project, must have a look at the details below so that you are sure what you are buying. So, let's get started with Home Automation Project using XBee & Arduino.
Home Automation Project using XBee & Arduino
- You can buy the complete working Proteus Simulation along with the Arduino Programming Code by clicking the below button.
- You can pay via Paypal and the download link will be instantly available to you and if you don't have the PayPal account then use our Contact Us Form and we will find some other way for you.
Buy This Project
1: Overview
- First of all, let's have an overview of this Home Automation Project.
- In this Project, I have designed two simulations, one simulation is for Remote using which we are gonna control our appliances and the second simulation is for the controlling of these appliances.
- So, when you press buttons from your remote section, a wireless command will be sent to the control board and it will turn ON or OFF the respective load.
- Moreover, there's an LCD on the Remote on which you will also check the values of the sensors.
- So, in simple words, the remote will be in your hand and using this remote you can easily turn ON or OFF your appliances and can also check the status of your different sensors wirelessly.
- Let's first have a look at the remote section:
Remote Control:
- In Remote Control Section, I have used the below main modules:
- Arduino UNO: Microcontroller Board.
- KeyPad: Commands will be sent by clicking this Keypad's buttons.
- LCD (20 x 4): For Displaying Sensor's Data & Commands.
- XBee Module: It's an RF Module used for sending wireless commands.
- Now when you click any button on your Keypad, a command is sent from Arduino to XBee Module and the XBee module then forwards that command to other XBee on the Control Unit.
- Moreover, when the Control Unit sends the Sensors' data on xbee then Arduino receives that data and then displayed that data on LCD.
- Here's the block diagram of Remote control section which will give you a better idea of its working:
- Here's the Proteus Diagram of our Remote Section:
- In the above Proteus Simulation of Remote Control, you can see that we have Arduino UNO board which is connected with LCD, KeyPad and XBee Module.
- Working of this Remote section will be discussed in the later section.
- Now let's have a look at the Control Unit Side of Home Automation Project.
Note:You must also have a look at below tutorials because I have interfaced these modules separately with Arduino as well:
Control Unit:
- In the previous section, we had an overview of the Remote section, now let's have a look at the Control Unit.
- The Control Unit is the Unit which is being controlled by the Remote Control.
- The Main components of Control Unit are:
- Arduino UNO: Microcontroller Board.
- Relays: Used to control the appliances. I have added eight relays so you can control eight appliances.
- Lamps: Indicating the Bulbs.
- DC Motors: Indicating the Fans.
- Smoke Sensor: Used to detect the Smoke.
- Flame Sensor: Used for Fire detection.
- DS18B20: Used to measure atmospheric temperature.
Note:
- On this Control unit, the Arduino UNO is getting the data from the smoke sensors and then sending this data via XBee to Remote Control.
- We have seen in the previous section that this data is then displayed over LCD.
- Moreover, when any button is pressed from the Remote Control, the command is received by this Arduino via XBee.
- On receiving this command, Arduino UNO then turns ON or OFF the respective relay which in turn ON or OFF the respective appliance.
- Here's the block diagram of this control unit:
- You can see in the above block diagram that I have connected three sensors with Arduino and Arduino is receving their values and then sending these values to the remote control via XBee.
- Moreover Relays are also connected to Arduino and then loads are further connected to these Relays.
- So, Arduino is controlling these Relays which in turn are controlling the loads.
- I have used eight relays and hence eight loads.
- The Loads I have used are all DC loads because Proteus doesn't have AC active loads in it but you can place AC loads as well.
- Here's the Proteus Simulation of Control Unit:
- You can see all the modules are present in it.
- Eight relays are present on the right side and their outputs are going into the loads.
- I have used four lamps and four DC Motors.
- Now let's have a look at their operation.
Note:You should also have a look at below tutorials in which I have interfaced these sensors separately with Arduino:
2: Operation
- I have already mentioned their operation in above section so I am not gonna discuss it in detail.
- But let's have a little talk about their operation.
- First I am gonna discuss the operation of Remote Control:
Remote Control:
- The remote Control has an XBee module which is used for wireless communication.
- The Keypad has buttons on it so now when you press button "1" on the keypad then the Signal is sent via XBee to Control Unit.
- The control unit will automatically turn on the first load when it will receive the command from button "1" of Remote Control.
- When you press "1" for the first time then the first load will turn ON but when you press button "1" again then the first load will go off.
- So, its like if you want to turn it ON then press it and if you want to turn it OFF then press again. (Quite simple :P)
- As there are eigth loads, so button "1" to "8" are working for loads "1" to "8" respectively.
- Moreover, when sensor's data come from control unit then it is updated in the LCD of Remote Control.
- Now let's have a look at the operation of Control Unit:
Control Unit:
- As the Control Unit is concerned, it keeps on waiting for the command from remote and whenever a command is received from the Remote Control, it turns ON or OFF the respective load.
- Moreover, it also sends the data of sensors continuously to the Remote Control.
- For this wireless communication, XBee is used here.
3: Working
- This is the last section of this project where will will have a look at the working of the project.
- I haven't divided this section in parts instead I have create a video which will explain the working in detail.
- Here's the First look of Remote section image while working:
- Now when the Sensor's data come from the remote Section then it will be displayed in the LCD as shown in below figure:
- You can see in the above figure that both sensors are detecting and the temperature is also displayed in the LCD.
- Now the complete working of this project is shown in the below video which will give you complete idea of this project:
Note:
- If you buy this project and you are unable to run it properly then we will provide you free service and will make it work on your laptop perfectly. :)
So, that's all for today. I hope you have liked this Home Automation Project and are gonna buy this one. But again before buying it must read this tutorial and also watch the video so that you get complete understanding of this project.