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:

Where To Buy?
No.ComponentsDistributorLink To Buy
1Battery 12VAmazonBuy Now
2BuzzerAmazonBuy Now
3LM7805AmazonBuy Now
4OptoCouplerAmazonBuy Now
5RelayAmazonBuy Now
6Keypad 4x3AmazonBuy Now
7LCD 20x4AmazonBuy Now
8Flame SensorsAmazonBuy Now
9MQ-2AmazonBuy Now
10PIR SensorAmazonBuy Now
11Arduino UnoAmazonBuy Now

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

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:
    1. We can interface the GSM module to send messages, in case of emergency.
    2. We can add more sensors i.e. ultrasonic sensors, different types of Gas sensors in it.
    3. We can also improve our code by using interrupts instead of polling.
    4. We can also add a camera for facial recognition.
    5. To improve the security, we can add a keypad and only authorized persons will have the access to enter.
    6. The fingerprint sensor can also be used for identification purposes.

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 :)

Infrared Sensor Library for Proteus

Hello friends, I hope you all are doing great. In today's tutorial, I am going to share a new Infrared Sensor Library for Proteus. This IR sensor is not available in Proteus and we are sharing this library for the first time. I hope it will help in your Embedded Systems Projects particularly related to robotics and automation. So, if you want to work on this IR Sensor then I would suggest you to first design its simulation and then try your luck with hardware. There are different types of Infrared Sensors & modules available in the market. Some of these modules have transmitter & receiver on separate chips and are mostly get activated when someone interrupts the light. The one we have designed has a transmitter & receiver on a single chip. The IR signal transmits from the IR transmitter and if it has some obstacle in front of it then it bounces back and received by the IR receiver. You should also have a look at this list of New Proteus Libraries for Engineering Students. So, let's have a look at How to use this Infrared Sensor Library for Proteus: Note:
Where To Buy?
No.ComponentsDistributorLink To Buy
1Arduino UnoAmazonBuy Now

Infrared Sensor Library for Proteus

  • First of all, download the Library files of this IR Sensor by clicking the below button:
Infrared Sensor Library for Proteus
  • After downloading this file extract it and you will find three Library files in it, named as:
    • InfraredSensorsTEP.IDX
    • InfraredSensorsTEP.LIB
    • InfraredSensorsTEP.HEX
  • Place all these three files in the Library folder of your Proteus software.
Note:
  • Once you have added the files in the Library folder, then restart your Proteus software.
  • In the components section, make a search for Infrared Sensor, as shown in below figure:
  • Now place this IR Obstacle Sensor in your Proteus and if everything goes fine then you will get something as shown in below figure:
  • As you can see in above figure that we have four pins on our Infrared sensor, which are:
    • Vcc => You need to provide +5V to this pin.
    • GND => It should be grounded.
    • OUT => That's output pin and it will get HIGH when this sensor will find some obstacle in front and will remain LOW in normal condition.
    • TestPin => As Proteus is a simulation software so we can't actually place something in front of this sensor. That's why I have used this TestPin. If this Pin is LOW, then sensor will remain normal and if it's HIGH then sensor will behave as it has something in front of it.
  • Now double click this Infrared Sensor and its Properties Panel will open up.
  • In the Program File section, browse to the file InfraredSensorTEP.HEX which you have already downloaded and placed in the Library folder of Proteus.
  • Here's the screenshot of Properties Panel for this Infrared Sensor:
  • I have encircled the Program File in above figure and you can see I have selected the InfraredSensorsTEP.HEX.
  • So, now let's design a simple circuit and have a look at how to use this Infrared Sensor in Proteus.
  • Here's the screenshot of Infrared Sensor Simulation in Proteus:
  • So, now let's run our Proteus simulation and if everything goes fine then you will get results, as shown in the below figure:
  • I will interface this sensor with different Microcontrollers e.g. Arduino, PIC Microcontroller etc. in my coming tutorial.
  • As you can see in the above figure that when TestPin is LOW then OUT Pin is also LOW means there's no obstacle and when TestPin gets 1 then OUT Pin will go HIGH and that means we have some obstacle.
So, that's all for Infrared Sensor Library for Proteus. I hope it will help you guys in your engineering projects. Let me know if you have any suggestions. Take care & have fun !!! :)

Line Following Robot using Arduino

Hello everyone, I hope you all are fine and having fun with your lives. Today, I am going to share a very basic project named as Line Following Robot using Arduino. I have designed a three wheeler robot and have placed IR sensors beneath it to detect the black line and then I have made it move over this Black Line.

This Line Following Robot is not doing any extra feature i.e. turning or rotating back. It will just simply move in the straight line. I have also posted a short video at the botton of this tutorials which will give you better idea of how this robot moves. You should first read this tutorial and design the basic robot and once you are successful in designing the basic Line Following Robot then you should have a look at my recent Project Line following Robotic Waiter in which I have designed a Robotic waiter which follows the line and also take turns on different tables. So, let's get started with Line Following Robot using Arduino.

Line Following Robot using Arduino

  • First of all I have designed the Mechanical model of the robot, which has three wheels on it.
  • Its a triangular method in which the motors were attached to the front two wheels and the back wheel is a caster wheel, which is present in the middle of the robot.
  • Here's the image of front wheel coupled with the DC Gear Motor:
  • Now let's have a look at the rear caster wheels, shown in below image:
  • Finally, I have used Acrylic as the body of the robot.
  • Here's the assembled version of our Line Following Robot:
  • Now that we have the mechanical design of our robot and we have assembled it completely.
  • So, now comes the electronics part where we are gonna place the DC Motor Driver Circuits and will also place the IR sensors.
  • I have used Arduino board for programming of this Line following Robot.
  • First of all, I have designed the 2 relay baord for DC motors.
  • Its circuit diagram is shown in below figure:
  • We also need a voltage divider circuit because we need such a power supply from which we can get 5V, while our source battery is of 12V.
  • So, in order to do that I have used 7805 Regulator IC and have designed a simple circuit as shown in below figure:
  • Now placing all the components over the Line following Robot, it looked like something as shown in below figure:
  • Here's the Arduino code which you need to upload in your Arduino board:
#define motorL1 8
#define motorL2 9
#define motorR1 10
#define motorR2 11

#define PwmLeft 5
#define PwmRight 6

#define SensorR 2
#define SensorL 3
#define Sensor3 A0
#define Sensor4 A1

#define TableA A4
#define TableB A2
#define TableC A5
#define TableD A3

int OriginalSpeed = 200;
int TableCount = 0;
int TableCheck = 0;
int RFCheck = 10;

void setup() 
{
  Serial.begin (9600);
 
  pinMode(motorR1, OUTPUT);
  pinMode(motorR2, OUTPUT);
  pinMode(motorL1, OUTPUT);
  pinMode(motorL2, OUTPUT);
  
  pinMode(PwmLeft, OUTPUT);
  pinMode(PwmRight, OUTPUT);
  
  pinMode(SensorL, INPUT);
  pinMode(SensorR, INPUT);
  pinMode(Sensor3, INPUT);
  pinMode(Sensor4, INPUT);
  
  pinMode(TableA, INPUT);
  pinMode(TableB, INPUT);
  pinMode(TableC, INPUT);
  pinMode(TableD, INPUT);
  
  MotorsStop();
  
  analogWrite(PwmLeft, 0); 
  analogWrite(PwmRight, 0);
  delay(2000); 
 // Serial.println("fghfg");
  
}

void loop() {
  MotorsForward();
  PIDController();
}

void MotorsBackward()
{
    digitalWrite(motorL1, HIGH);
    digitalWrite(motorL2, LOW);
    digitalWrite(motorR1, HIGH);
    digitalWrite(motorR2, LOW);
}

void MotorsForward()
{
    digitalWrite(motorL1, LOW);
    digitalWrite(motorL2, HIGH);
    digitalWrite(motorR1, LOW);
    digitalWrite(motorR2, HIGH);
}

void MotorsStop()
{
    digitalWrite(motorL1, HIGH);
    digitalWrite(motorL2, HIGH);
    digitalWrite(motorR1, HIGH);
    digitalWrite(motorR2, HIGH);
}

void MotorsLeft()
{
    analogWrite(PwmLeft, 0); 
  analogWrite(PwmRight, 0);
    digitalWrite(motorR1, HIGH);
    digitalWrite(motorR2, HIGH);
    digitalWrite(motorL1, LOW);
    digitalWrite(motorL2, HIGH);
}

void MotorsRight()
{
      analogWrite(PwmLeft, 0); 
  analogWrite(PwmRight, 0);
    digitalWrite(motorR1, LOW);
    digitalWrite(motorR2, HIGH);
    digitalWrite(motorL1, HIGH);
    digitalWrite(motorL2, HIGH);
}

void Motors180()
{
    analogWrite(PwmLeft, 0); 
    analogWrite(PwmRight, 0);
    digitalWrite(motorL1, HIGH);
    digitalWrite(motorL2, LOW);
    digitalWrite(motorR1, LOW);
    digitalWrite(motorR2, HIGH);
}

void PIDController()
{
  if(digitalRead(SensorL) == HIGH){analogWrite(PwmRight, 250);analogWrite(PwmLeft, 0);}
  if(digitalRead(SensorR) == HIGH){analogWrite(PwmLeft, 250);analogWrite(PwmRight,0);}
  if((digitalRead(SensorL) == LOW) && (digitalRead(SensorR) == LOW)){analogWrite(PwmRight, 0);analogWrite(PwmLeft, 0);}
}
  • Now that's all, here's the video for Line Following Robot using Arduino which will give you better idea:
That's all for today. I hope you have enjoyed this Line Following Robot using Arduino and are gonna use it in your projects. feel free to ask in comments, if you got into any trouble. Thanks for reading. Take care !!! :)

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:
    1. PIR Sensor: For Motion Detection.
    2. Smoke Sensor: For Smoke Detection.
    3. Flame Sensor: For Fire Detection.
    4. Vibration Sensor for Window: For Detection of vibrations on Window.
    5. Vibration Sensor for Door: For Detection of vibrations on Door.
    6. Ultrasonic Sensor for Window: For intruder Detection on Window.
    7. 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.

Intelligent Energy Saving System

Hello friends, hope you all are fine and having fun with your lives. Today, I am going to share a complete project with you guys. Its an Intelligent Energy Saving System which I designed around two years ago. So, today I thought to share it so that others could also get benefit. In this project, I have used Arduino UNO board for programming purposes. Its not much complicated project but is the basic for many complex projects.

Energy, is a small word, but is the problem of whole world. Particularly when we are talking about electrical energy. IF you consume more electrical energy then you will get quite huge bill at the end of the month. :P So, there's always work done on reducing the consumption of electrical energy and also we compare energy costs from different providers. As a human, suppose you turn ON your room fan, then normally you forget to turn it OFF and thus your bill keeps on increasing. So in order to avoid this, automation is the only tool which comes in handy. Like there must be such system which automatically detects whether someone is still in the room or not and if there's no one then lights got OFF automatically. In this way, you can quite easily reduce your electricity cost. This same concept is presented in this project, let's have a complete look over it. :)

Overview of Intelligent Energy Saving System

  • In this project, we have designed a complete room and used two inductive loads i.e. bulbs and one fan.
  • Now the purpose of this project was to save the energy so we used two IR sensors for counting.
  • Now, if there's no one present in the room then the loads will automatically turn OFF and when someone will enter in the room then the loads will automatically turn ON.
  • Moreover, we have also added a counter functionality in it i.e. the project will also count the number of people present in the room.
  • All these parameters will also display on the LCD attached with Arduino.
Components Used

I am mentioning here the components used in designing this project. I am not giving the exact values as you will get them in the circuit diagrams. Here's the list:

  • Arduino UNO
  • IR Sensors
  • 16 x 2 LCD
  • 100W Bulbs
  • 12V Fan
  • 2 Relay Board
  • 7805 (IC Regulator)
  • LED (Indication)
  • Resistance
  • Capacitors

Circuit Diagrams of Intelligent Energy Saving System

Suppose you are designing this project then the first thing you are gonna need is the circuit diagrams for the project so here I am gonna show you all the circuit diagrams step by step so let's start:

1: Interfacing of Arduino with LCD
  • First thing we are gonna need is the interfacing of Arduino with LCD. LCD used in this project is 16 x 2.
  • I have first designed the simulation in Proteus as its always better to design the simulation before going into real hardware.
  • Now upload the below code into it, just to test that whether its working fine or not:
    #include <LiquidCrystal.h>
    LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

    void setup()
    {

    lcd.begin(16, 2);
    lcd.print("www.TheEngineer");
    lcd.setCursor(0,1);
    lcd.print("ingProjects.com");
    }
    void loop() {}
  • Now run it and if everything's gone fine then you will get something as shown in below figure:
Note:
2: Circuit diagram of 2 Relay Board
  • Next thing we are gonna need is the two relay board. Using these relays we are gonna turn ON or OFF our loads.
  • Here's the circuit diagram for 2 relay board.
  • As you can see in the above figure, I have used two relay board, where both the relays are controlled bt simple logic operators.
  • Now instead of these logic operators, you need to give Arduino Pins here.
  • I have made the first relay ON while the second relay is OFF.
  • In the above figure, relay outputs are open so you can place anything here as its gonna act as switch. So, in our case the loads will be placed after this relay.
3: Circuit Design of Buzzer
  • Next circuit design which we need to understand is the buzzer circuit design.
  • Its quite simple and similar to 2 relay board. I have also published a detailed post on How to Design a Buzzer in Proteus ISIS, which will be quite helpful.
  • Here' I am gonna explain it lightly, so let's have a look at the circuit diagram of buzzer:
  • You can quite easily understand the above figure, where I have shown both the ON and OFF states of buzzer.
4: Circuit Diagram of IR Sensor:
  • In this project, I have used two IR sensors, both are placed on the door one after another. You can read more about the designing of IR Sensor on my post Circuit Diagram of IR Sensor using 555 Timer.
  • I have named them Entering IR Sensor and Leaving IR Sensor.
  • The logic behind these two sensors is that, when someone enters in the room then he will first pass the Entering IR Sensor and then will hit the Leaving IR Sensor and if someone is leaving the room then he will first pass the Leaving IR Sensor and then will cut the Entering.
  • So, in this way I am counting the persons if someone entering in the room I simply increment and if someone's leaving then I decrement.
  • Now, if number of people in the room becomes zero then I turn OFF all the lights and the fan, and if there even one person in the room then I turn ON the lights and fan.
  • Here's the circuit diagram of IR Sensor:
  • IR transmitter and Receiver are not available in Proteus so that's why I have used the button so when you press the button, its like someone cut the beam of IR sensor, and you will get below result:
 
5: Complete Circuit Diagram of Intelligent Energy Saving System
  • Now that we have designed the individual circuit diagrams, next thing we are gonna do is the assembly of complete project.
  • So, here's the complete circuit diagram of this project:
  • As you can see in the above figure, I have used two IR Sensors. The first IR Sensor is for entering in the room while the IR sensor is for leaving the room.
  • Next is the buzzer circuit which is also quite simple and I have explain in detail above.
  • LCD will display the no of people in a room and will also display either the bulb is ON or OFF, and also about Fan status.
  • I haven't shown the relay circuit in above figure as it will not fit in the space and I think you guys can place it easily.

Programming Code for Intelligent Energy Saving System

  • The code designed for this project is developed in Arduino software.
  • Code is as follows:
#include <LiquidCrystal.h>
#include <OneWire.h>
#include <DallasTemperature.h>
 
#define ONE_WIRE_BUS 8
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

float celsius, fahrenheit;

int Sensor1 = A0;
int Sensor2 = A1;

int Bulb = A5;
int Fan = A4;
int Buzzer = A3;

int Counter = 0;
int Sen1Check = 0;
int Sen2Check = 0;

void setup(void) 
{
    Serial.begin(9600);
    digitalWrite(Bulb, HIGH);
    digitalWrite(Fan, HIGH);
    digitalWrite(Buzzer, HIGH);
    pinMode(Sensor1, INPUT);
    pinMode(Sensor2, INPUT);
    pinMode(Bulb, OUTPUT);
    pinMode(Fan, OUTPUT);
    pinMode(Buzzer, OUTPUT);
    
    
    lcd.begin(20, 4);
    lcd.setCursor(0, 1);
    lcd.print("Temp = ");
    lcd.setCursor(0, 0);
    lcd.print("Counter = ");
    lcd.setCursor(12, 0);
    lcd.print("Persons");
}

void loop() 
{
  CheckEntry();
  CheckLeaving();
  lcd.setCursor(7, 1);
  sensors.requestTemperatures();
  lcd.println(sensors.getTempCByIndex(0));
  lcd.setCursor(12, 1);
  lcd.print(" degC");
  lcd.setCursor(10, 0);
  if(Counter >= 0){lcd.print(Counter);}
  if(Counter < 0){Counter = 0;}
  
  if(Counter > 0)
  {
      digitalWrite(Bulb, LOW);
      digitalWrite(Fan, LOW);
      digitalWrite(Buzzer, HIGH);
      lcd.setCursor(0, 2);
      lcd.print("Fan : ON ");
      lcd.setCursor(0, 3);
      lcd.print("Bulb : ON ");
  }
  
  if(Counter < 1)
  {
      digitalWrite(Bulb, HIGH);
      digitalWrite(Fan, HIGH);
      digitalWrite(Buzzer, HIGH);
      lcd.setCursor(0, 2);
      lcd.print("Fan : OFF");
      lcd.setCursor(0, 3);
      lcd.print("Bulb : OFF");
      
  }
  

}


void CheckEntry()
{
    if(((digitalRead(Sensor1) == LOW) || (Sen1Check == 1)) && (Sen2Check == 0))
    {
        while(digitalRead(Sensor1) == LOW);
        Sen1Check = 1;
     
        if(digitalRead(Sensor2) == LOW)
        {
            Counter++;
            Sen1Check = 0;
            while(digitalRead(Sensor2) == LOW);
        }
    } 
}


void CheckLeaving()
{
    if(((digitalRead(Sensor2) == LOW) || (Sen2Check == 1)) && (Sen1Check == 0))
    {
        while(digitalRead(Sensor2) == LOW);
        Sen2Check = 1;
       
        if(digitalRead(Sensor1) == LOW)
        {
            Counter = Counter - 1;
            Sen2Check = 0;
            while(digitalRead(Sensor1) == LOW);
        }
    } 
}
  • Coding isn't much difficult for this project, but still if you get into some trouble ask in comments and I will check it out.
  • Here's the complete video for this Intelligent Energy Saving System, which will explain all about the project.
That's all for today. I hope I have helped you guys in some way. Till next tutorial, take care ALLAH HAFIZ :)
Syed Zain Nasir

I am Syed Zain Nasir, the founder of <a href=https://www.TheEngineeringProjects.com/>The Engineering Projects</a> (TEP). I am a programmer since 2009 before that I just search things, make small projects and now I am sharing my knowledge through this platform.I also work as a freelancer and did many projects related to programming and electrical circuitry. <a href=https://plus.google.com/+SyedZainNasir/>My Google Profile+</a>

Share
Published by
Syed Zain Nasir