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.
Interfacing of Flame Sensor with Arduino
Hello friends, I hope you all are fine and having fun with your lives. Today, I am going to share a new tutorial which is Interfacing of Flame Sensor with Arduino. I have recently posted a tutorial in which I have shared the Flame Sensor Library for Proteus. Now in this tutorial, I am gonna use that Flame Sensor Library and will interface this Flame Sensor with Arduino. So, if you haven't downloaded this file then I suggest you to download this Flame Sensor Library so that you can easily simulate this flame Sensor in Proteus.
I am sharing interfacing of this Flame Sensor with Arduino today, but soon I will also post a tutorial on Interfacing of Flame Sensor with PIC Microcontroller. If you guys have any questions then ask in comments. I have also given the Simulation file and the Programming code below to download. But I would recommend you to design this proejct on your own so that you make mistakes and then learn from them. So, let's get started with Interfacing of Flame Sensor with Arduino:
Interfacing of Flame Sensor with Arduino
- You can download the complete Proteus Simulation along with Arduino programming code from the below button:
Download the Simulation
- Now design a small Arduino code as given below:
#include <LiquidCrystal.h>
LiquidCrystal lcd(13, 12, 11, 10, 9, 8);
int Flame = 7;
void setup() {
Serial.begin(9600);
pinMode(Flame, INPUT_PULLUP);
lcd.begin(20, 4);
lcd.setCursor(0,0);
lcd.print("Flame : ");
lcd.setCursor(1,2);
lcd.print("www.TheEngineering");
lcd.setCursor(4,3);
lcd.print("Projects.com");
}
void loop() {
if(digitalRead(Flame) == HIGH){lcd.setCursor(8,0);lcd.print("Detected ");}
if(digitalRead(Flame) == LOW ){lcd.setCursor(8,0);lcd.print("Not Detected");}
}
- Add this code in your Arduino software and compile it to get the Hex File from Arduino Software.
- Upload this hex file in your simulation and then run your simulation and if everything goes fine then you will get something as shown in below figure:
- In the above figure, you can see the sensor is off that's why in the LCD its written that no smoke detected.
- Now, let's bring some Flame by clicking the Logic State on Flame Sensor and you will see the below results:
- Now you can see in the above figure that when the Flame is detected then the LCD indicated that Flame has detected.
- That's how we can easily simulate the Flame Sensor with Arduino.
- I have explained this project in detail in the below video:
That's all for today. I hope you have enjoyed this project and now you can easily interface your Flame Sensor with Arduino in Proteus ISIS.
How to Measure Frequency using Arduino
Hello friends, hope you all are fine and having fun with your lives. Today, I am going to share on How to measure Frequency using Arduino board. Its quite a simple tutorial but is an essential one especially when you are working on some power related project. Because in Power projects, you have to measure the frequency of AC voltages. I was working on a project in which I have to do dimming of AC Lamp so in that project I have to measure the frequency of AC signal.
I have designed this project using Arduino UNO and have simulated in the Proteus software, which you all know is my favorite simulating software. :) The code is also quite simple which I have given below for download. The simulation is also included in download package but again I suggest you to design it on your own. If you got into any trouble then ask in comments and I will try to resolve them. Anyways let's get started with How to measure frequency using Arduino.
How to Measure Frequency using Arduino ???
- You can download the simulation for this frequency measuring by clicking the below button:
Download Project Files
- Now let's design this project in Proteus. So, first of all, design a simulation as shown in below figure:
- The small block attached with the pin # 2 of Arduino is a frequency meter.
- We can create any kind of frequency signal using this component.
- If you double click it then its properties will open up where you can change the frequency as shown in below figure:
- You can see in the above figure that I have setted the Clock Frequency to 2000 Hz.
- Now, let's design the programming code for this project. So, paste the below code in your Arduino software:
#include <LiquidCrystal.h>
LiquidCrystal lcd(13,12,11,10,9,8);
long freq, tempo;
int pulsos;
boolean pulso;
void setup() {
pulso=HIGH;
pinMode(2,INPUT);
lcd.begin(20, 4);
lcd.setCursor(0,0);
lcd.print("Frequency =");
lcd.setCursor(1,2);
lcd.print("www.TheEngineering");
lcd.setCursor(4,3);
lcd.print("Projects.com");
}
void loop() {
tempo = millis();
if(digitalRead(2)==HIGH)
{
if(pulso==HIGH)
{
pulsos = pulsos + 1;
}
pulso=LOW;
}
else{
pulso=HIGH;
}
if(tempo%2000==0){
freq = pulsos/2;
lcd.setCursor(12,0);
lcd.print(freq);
lcd.print("Hz");
pulsos=0;
}
}
- Now using the above code, get your hex file from Arduino software and upload it in your Proteus software.
- Now once you are done then run your simulation and if everything goes fine then you will get results as shown in below figure:
- Now you can see the LCD is showing the same frequency as we set in the properties of the frequency meter.
- The code is quite simple, I don't think it needs any explanation but if you get into sme trouble then ask in comments.
- The below video will show you this project in detail:
So, that's all for today. I hope now you know How to measure frequency using Arduino. So, will meet you guys in the next tutorial. Till then take care !!! :)
Arduino Pro Mini Library for Proteus
Update: We have created a new version of this library, which you can check here:
Arduino Pro Mini Library for Proteus V2.0.
Hello friends, hope you all are fine and having fun with your lives. In today's post, I am gonna share Arduino Pro Mini Library for Proteus. Recently, I have shared
Arduino Nano Library for Proteus, and before that I have also posted
Arduino UNO Library for Proteus as well as
Arduino Mega 2560 Library for Proteus, and now I am gonna share Arduino Pro Mini Library for Proteus. Arduino Pro Mini is another Arduino board which also uses the same Atmega328 Microcontroller and has almost the same number of pins as Arduino UNO and Arduino Nano. Arduino Pro Mini is even more smaller than Arduino Nano board. It doesn't have the programmer on it so if you need to program it you have to use some TTL to Serial converter or you can also use Arduino UNO board in order to burn programming code in it.
So, in today's tutorial, I am gonna share the Arduino Pro Mini Library for Proteus, which is the first library ever made for this board. You won't find the Arduino Pro Mini Library for Proteus anywhere. I am quite proud that our blog is sharing this library for the first time. You can download this library freely from the link below and can now simulate your circuits quite easily. So, now let's get started with this new Arduino Pro Mini Library for Proteus.
I have added all the Arduino boards in a single library. This library contains six Arduino boards which are Arduino UNO, Arduino Mega 2560, Arduino Mega 1280, Arduino Nano, Arduino Mini and Arduino Pro Mini. You can download this complete Arduino Library by checking
Arduino Library for Proteus.
Arduino Pro Mini Library for Proteus
- First of all, download the Arduino Pro Mini Library for Proteus by clicking the below button.
Arduino Pro Mini Library for Proteus
- Now when you click it, you will get a zip file so extract this zip file and you will get two files named as ArduinoProMiniTEP.LIB and ArduinoProMiniTEP.IDX.
- So download these two files and place it in the libraries folder of your Proteus software.
Note:
- Now, after getting the Arduino Pro Mini Library for Proteus files and placing it properly in your Proteus software. Open your Proteus software and make a search for Arduino Pro Mini.
- Once you get this board, place it in your Proteus workspace and it will look like something as shown in below figure:
- Now next thing you need to do is to read How to get hex Fie from Arduino, so that you can get the hex file, which we are gonna upload in this Arduino Pro Mini board.
- So, once you get the link for your hex file, simply double click this board to open its properties.
- Now place this hex file in the Program File section of its Properties section as we have seen in Arduino Nano Library for Proteus tutorial.
- That's all, now using this Arduino Pro Mini Library for Proteus, you can easily simulate your circuits in Proteus and can test your codes.
- Now, let's design a simple blinking example as we have done for previous libraries.
- So, in order to dos so, design a simple circuit in Proteus as shown in below figure:
- So, now as usual, use the blink example from the Arduino software and get your hex file as described in How to get hex file from Arduino.
- So, after uploading the hex file, run your simulation. If everything goes fine then you will get results as shown in below figure:
- So, now that's how you can simulate Arduino Pro Mini in Proteus using Arduino Pro Mini Library for Proteus.
Arduino Mega 2560 Library for Proteus
Update: We have created a new version of this library, which you can check here:
Arduino Mega 2560 Library for Proteus V2.0.
Hello friends, hope you all are fine. In today's post, I am going to share Arduino Mega 2560 Library for Proteus. In the previous post, I have shared the Arduino UNO Library for Proteus and I have mentioned that I am gonna share more Arduino Libraries soon. Actually these days I am quite excited about this Proteus component designing and I am designing the Arduino boards as a starter. So, till now I have designed two Arduino boards in Proteus. First one was Arduino UNO which I have provided for download in previous post and today, I am going to share Arduino Mega 2560 Library for Proteus.
In the coming posts, I am gonna share more exciting libraries for Proteus as I have already started designing the Arduino Nano board in Proteus, which will be the talk of our next tutorial hopefully. We all know about Arduino Mega 2560 board which is quite bigger version of Arduino UNO board and uses Atmega2560 Microcontroller. In the below post, I have first given the link to download Arduino Mega Library and afterwards I have explained How to use Arduino Mega board in Proteus by designing a simple blinking LED circuit as we did for Arduino UNO simulation in Proteus. So, let's get started with it.
I have added all the Arduino boards in a single library. This library contains six Arduino boards which are Arduino UNO, Arduino Mega 2560, Arduino Mega 1280, Arduino Nano, Arduino Mini and Arduino Pro Mini. You can download this complete Arduino Library by checking Arduino Library for Proteus.
Arduino Mega 2560 Library for Proteus
- First of all, click the below button to download the Arduino Mega 2560 Library for Proteus.
Arduino Mega 2560 Library for Proteus
- Now download this library and you will find a zip file.
- Extract this zip file, it will contain two files named as ArduinoUnoTEP.LIB and ArduinoUnoTEP.IDX.
- Place these files in the library folder of your Proteus software.
Note:
- Now we have placed our Arduino Mega 2560 library for Proteus files in the libraries folder of Proteus software. So, now run your Proteus software and search Arduino Mega 2560.
- Place this Arduino board in your workspace and it will look like something as shown in below figure:
- It has become quite big but looking quite attractive and I am feeling kind of proud on my new invention. :)
- Anyways, now next thing we need to do is to upload the hex file in it.
- So, in order to do so, we need to double click the Arduino Mega 2560 board and its properties panel will poop up as shown in below figure:
- Now browse for your hex file in the section PROGRAM FILE or paste the link as we did in previous Arduino UNO post.
- You should read How to get Hex File from Arduino if you don't know already.
- You can also change different options here but my suggestion is to not change anything else if you are not pro.
- So, now we have seen How to get the Arduino Mega 2560 library for Proteus. Now let's design a simple example in which we will show led blinking with Arduino Mega 256 in Proteus software.
- So, design a simple circuit as shown in below figure:
- Now open the blink example from your Arduino software and get the hex file.
- Upload this hex file in your Proteus software and run the simulation.
- If everything goes fine then you will get something as shown in below figure:
- Quite Simple. isn't it. Now below is given the video demonstration for Arduino Mega 2560 Library for Proteus.
So, that's all for today. Till now we have designed two
Arduino boards in Proteus which are Arduino UNO and Arduino Mega 2560. I am planning on designing more Arduino boards and will post them soon.
Interfacing of Keypad with Arduino
Hello friends, hope you all are fine and having fun with your lives. In today's post we will have a look at How to interface keypad with Arduino in Proteus ISIS. Keypad is used almost in every engineering project. If you even look around you will find keypad in many electronic appliances. For example, a simple ATM machine has a keypad on it using which enter our pin code and give commands to the ATM machine. Similarly, calculator also has keypad on it. So, in short there are numerous applications of keypad. You should also read the Real Life examples of Embedded Systems and you will find Keypad in them as well.
Keypad is used where you need to used numerical buttons or you need to use lots of buttons for sending commands so like in some application I need to use 10 buttons so instead of using separate 10 buttons I would prefer to use keypad instead as it will save a lot of time both in hardware as well as programming. So today we will have a detailed look on How keypad works and How we can Interface keypad with Arduino in Proteus ISIS. Proteus also gives keypad component in its database using which we can easily simulate it in Proteus and can save our time. So first simulate it and then design the hardware. After today's post I will also share an Automatic Lock system project using keypad. Anyways let's get started with Interfacing of Arduino with keypad:
How keypad works ??
- Keypad uses matrix system in order to work.
- For example, I am using a keypad which has 12 buttons on it as shown in below figure:
- Now you can see its a 12 button keypad so it has total 3 columns and 4 rows and similarly there are 7 pins to control these 12 buttons.
- So, the simple formula is total number of pins = Number of Rows + Number of Columns.
- Now if we look at the internal circuitry of this 12 button keypad then it will look something as shown in below figure:
- Columns and rows are connected with each other now suppose I press button "1" on the keypad then first row and the first column will get short and I will get to know that button "1" is pressed.
- Same is the case with other buttons, for example I press button "8" then second column and the third row will get short so this code will remain unique for each button.
- In simple words, on each button press different column and row will get short we need to detect which one gets short in order to get the pressed button.
Quite simple, isn't it ?? You should also have a look at these
Arduino Projects for Beginners. So that's how a keypad works, now let's have a look at How to Interface this keypad with Arduino in Proteus ISIS.
Interfacing of Keypad with Arduino in Proteus ISIS
- So, now we are gonna interface this keypad with Arduino in Proteus ISIS which is as always my favorite simulator.
- In Proteus design a circuit as shown in below figure:
- So, we have an Arduino UNO board along with keypad and LCD.
- So I have done the programming in such way that whenever you press any button on the keypad, it will get displayed on the LCD.
Note:
- Now, copy the below code and paste it in your Arduino software and get the hex file from it.
#include <LiquidCrystal.h>
#include <Keypad.h>
const byte ROWS = 4; //four rows
const byte COLS = 3; //three columns
char keys[ROWS][COLS] = {
{'1','2','3'},
{'4','5','6'},
{'7','8','9'},
{'*','0','#'}
};
byte rowPins[ROWS] = {10, 9, 8, 7}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {13, 12, 11}; //connect to the column pinouts of the keypad
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(A0, A1, A2, A3, A4, A5);
Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );
void setup() {
// set up the LCD's number of columns and rows:
lcd.begin(20, 4);
lcd.setCursor(1,2);
lcd.print("www.TheEngineering");
lcd.setCursor(4,3);
lcd.print("Projects.com");
lcd.setCursor(0,0);
}
void loop() {
char key = keypad.getKey();
if (key) {
lcd.print(key);
}
}
- Now upload the hex file in your Arduino UNO in Proteus ISIS and hit the RUN button.
- If everything goes fine then you will get something as shown in below figure:
- Now, when you press any button on the keypad it will also appear on the LCD as shown in below figure:
That's all for today. In the coming post I am gonna share a small project in which we will design a automatic locking system using this keypad. So stay tuned and have fun. :)
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 :)
Display ADC value on LCD using Arduino
Hello friends, hope you all are fine and having good life. In today's project, we will see how to display ADC value on LCD using Arduino in Proteus ISIS. Its quite a simple project in which we are gonna measure the voltage of ADC pins and then will display them over to LCD. The microcontroller I am using in this project is Arduino. The simulation is designed in Proteus ISIS. IF you are working on PIC Microcontroller then you should have a look at How to Display ADC value on LCD using PIC Microcontroller in Proteus ISIS.
Arduino has 10 bit ADC pins so whenever you apply voltage on these pins it will give you a value ranging from 0 to 1023 depending on the voltage provided. One can easily get this value using a simple function in Arduino analogRead(); but the real problem is to convert this analog value into the actual voltage present on the pin. Suppose you are using A0 pin of arduino and you are providing 3.3V over to this pin, now when you use this analoagRead() function then it will give you some value say 543, but you wanna know what's the actual voltage at this pin which is 3.3V so now converting this 543 to 3.3 is a bit tricky part. It's not difficult but involves a little calculations, which I am gonna cover today in detail. Before going any further, make sure you have already installed the Arduino Library For Proteus, if not then first do it because without this library you won't be able to use Arduino board in Proteus. So, let's get started with How to Display ADC value on LCD using Arduino.
Display ADC value on LCD using Arduino in Proteus ISIS
I have divided this tutorial on How to Display ADC value on LCD using Arduino in few steps, follow these steps carefully and if you get into some trouble then ask in comments and I will try my best to resolve them, all the materials are provided at the end of step 1 for download but I suggest that you design your own so that you do mistakes and learn from them. Moreover, you should also have a look at these Arduino Projects for Beginners. Anyways, let get started:
Step1: Circuit Designing in Proteus
- First of all, I have designed a circuit in Proteus for Displaying ADC value on LCD using Arduino.
- In this circuit, I have used two transformers which I have named as Potential Transformer and Current Transformer. I am supplying 220V to these transformers which is then converted into 5V.
- I have set the turn ratio of these transformers such that they give maximum 5V at the output.
- Now,rest of the circuit is simple, I have just connected the LCD with Arduino so that we could display these ADC value over to LCD.
Note:
- Here's the circuit diagram of displaying ADC value on LCD using Arduino in Proteus ISIS:
- You can download the Proteus Simulation and the Arduino hex file for Displaying ADC value on LCD using Arduino by clicking on below button:
Download Proteus Simulation and Arduino Hex File
- It's quite simple and self explanatory. After designing the circuit diagram, now let's move to second step, which is code designing for Displaying ADC value on LCD using Arduino.
Step 2: Arduino Code Designing
- Now copy the below code and paste it into Arduino software. Compile your code and get the Arduino hex file.
- If you dont know How to get the hex file from Arduino then read Arduino Library for Proteus, I have explained it in detail there.
#include <LiquidCrystal.h>
#define NUM_SAMPLES 10
int sum = 0;
unsigned char sample_count = 0;
float voltage = 0.0;
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
const int PT = A0;
const int CT = A1;
float Cur;
float Vol;
float Power;
void setup() {
// set up the LCD's number of columns and rows:
lcd.begin(20, 4);
// Print a message to the LCD.
lcd.setCursor(6,1);
lcd.print("Welcome To");
lcd.setCursor(5,2);
lcd.print("Energy Meter");
//delay(5000);
lcd.clear();
Constants();
}
void loop() {
lcd.setCursor(0, 2);
ShowVoltage(9, 0, PT);
Vol = voltage;
ShowVoltage(9, 1, CT);
Cur = voltage;
Power = Vol * Cur;
lcd.setCursor(7,2);
lcd.print(Power);
}
void Constants()
{
lcd.setCursor(0,0);
lcd.print("Voltage: ");
lcd.setCursor(0,1);
lcd.print("Current: ");
lcd.setCursor(0,2);
lcd.print("Power: ");
lcd.setCursor(14,0);
lcd.print("V");
lcd.setCursor(14,1);
lcd.print("A");
lcd.setCursor(12,2);
lcd.print("W");
}
void ShowVoltage (int x,int y, unsigned int value)
{
while (sample_count < NUM_SAMPLES)
{
sum += analogRead(value);
sample_count++;
delay(10);
}
voltage = ((float)sum / (float)NUM_SAMPLES * 5.015) / 1024.0;
lcd.setCursor(x, y);
lcd.print(voltage);
sample_count = 0;
sum = 0;
}
- The code is quite simple and self explanatory, the only difficulty is in ShowVoltage function. In this function, I have first taken an average of 10 ADC values and after that I have applied a simple formula over it and then it will start start giving the voltage value which I have simply displayed over the LCD.
- Now everything's done, so Get your Hex File from Arduino Software and let's check the results whether it displayed ADC value on LCD using Arduino or not
Step 3: Result
- We have designed the electronic circuit in Proteus and have also designed our code and uploaded the hex file in Arduino.
- Now press start button and you will see something like this:
- Now if you compare the voltages in voltmeter and on LCD, you can see they are exactly the same. You can check the value of variable resistor and the values in LCD will also change as the voltage in voltmeter change.
That's all for today, hope I have conveyed some knowledge today and now you can easily
Display ADC value on LCD using Arduino. In the next post we will explore more Arduino features. Till then take care and have fun !!! :)
Temperature Sensor 18B20 with Arduino
Hello everyone, in today's post we are gonna have a look at how to interface temperature sensor Dallas 18B20 with Arduino. There are many temperature sensors available in market like LM35, DHT11 etc but personally I like Dallas18B20 most of all, as it gives the most accurate result up to four decimal points. It operates on single wire and sends all data through this wire. Another advantage of this wire is you can interface multiple sensors with a single data line. You should also have a look at How to use 18B20 in Proteus ISIS.
In today's post, we are gonna get value from this sensor and then print it over the Serial Terminal as well as LCD. We will get the values in degree centigrade. Its not much difficult to interface 18B20 with arduino and also an Arduino library is also availble, using which you can quite easily interface 18B20 with Arduino. Let's get started with interfacing of 18B20 with Arduino.
Note:
Interfacing of Temperature Sensor 18B20 with Arduino
- As I explained earlier, it works on single wire and hence we are gonna need 1-wire library for Arduino along with 18B20 arduino library.
- Download both of these libraries by clicking on the below buttons:
Download One Wire Library Download Dallas Temperature Library
- After downloading the library, place it in the libraries folder of your Arduino Software.
- Now restart your Arduino software and you will find the Arduino folder in the Examples section.
- Next we need to interface our sensor 18B20 with Arduino so design your circuit as shown in below figure:
- So, connect the sensor 18B20 with Arduino as shown in the above figure, connections are quite simple and are as follows:
- Pin # 1 of 18B20 with GND
- Pin # 2 of 18B20 with Pin # 2 of Arduino.
- Pin # 3 of 18B20 with GND of Arduino.
- Add a pull up resistor of 4.7k ohm at pin # 2 of 18B20.
- Here's the images of hardware, we designed for this project, its a 20 x 4 lcd we have used:
- Below image shows the small 18B20 sensor, used in this project, it looks small but very efficient.
- Here's the image showing the complete project:
- Now, copy below code and upload it in your Arduino board and open your serial terminal.
#include <OneWire.h>
#include <DallasTemperature.h>
#include <LiquidCrystal.h>
#define ONE_WIRE_BUS 2
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
LiquidCrystal lcd(12, 11, 7, 6, 5, 4);
void setup(void)
{
Serial.begin(9600);
Serial.println("Welcome to TEP !!!");
Serial.println("www.TheEngineeringProjects.com");
Serial.println();
sensors.begin();
lcd.begin(20, 4);
lcd.setCursor(5,0);
lcd.print("Welcome to:");
lcd.setCursor(1,2);
lcd.print("www.TheEngineering");
lcd.setCursor(4,3);
lcd.print("Projects.com");
delay(5000);
}
void loop(void)
{
sensors.requestTemperatures();
Serial.print("Temperature : ");
Serial.println(sensors.getTempCByIndex(0));
//lcd.clear();
lcd.setCursor(0,0);
lcd.print("Temperature: ");
lcd.print(sensors.getTempCByIndex(0));
lcd.print("C");
delay(1000);
}
- After uploading the code, when I start the project, it started showing the temperature values as shown below:
- As you can see, its giving the temperature of my room which is 23.56 degree centigrade.
- I have also designed a video for more demonstration which is given below:
- It's quite a simple code and is self explanatory but still if you need help ask in comments and I will help you out.
Arduino Lilypad Library for Proteus
Hello friends, few day ago I have posted a tutorial on how to do Arduino Simulation in Proteus. In that post, we have used an Arduino Library for Proteus but as this library is in its initial phases that's why currently it supports only three basic Arduino boards which are Arduino UNO, Arduino Mega2560 and Arduino Mega1280. But as we know there are numerous Arduino boards which are used these days. So, I searched a little and I came across this amazing Arduino Lilypad Library for Proteus which has the support for few other arduino boards, so I thought to share it with you guys. I have tested this library myself as always and its 100% working. I have tested it on Proteus 7 and I think it will work fine on Proteus 8 as well. As we have the support for above three boards in the previous library so the two new boards here are Arduino Lilypad and Arduino Nano, both of them are quite used these days. I have explained it in detail, step by step below, if you still feel problem in any step then ask in comments.This library has the support for following boards:
- Arduino UNO
- Arduino UNO SMD
- Arduino Mega
- Arduino Nano
- Arduino Lilypad
Note:
- This library isn't designed by our team so all credit goes to its creator, who is blogembarcado. Hats off dude !!!
- We are just spreading the knowledge so that more and more engineers could get benefit out of it.
- I have also posted Ultrasonic Sensor Library for Proteus, which you can download, using this library you can simulate Ultrasonic Sensor in Proteus, moreover you can also download different examples on Ultrasonic Sensor Simulation in Proteus to get a complete grip on this sensor.
Arduino Lilypad Library for Proteus
- First of all, download this new Arduino Lilypad Library for Proteus by clicking on the button below:
Arduino Lilypad Library for Proteus
- Once you downloaded the rar file, extract the file named as "BLOGEMBARCADO.LIB".
- Now place this file in the library folder of Proteus, which, in my case, is "C:\Program Files (x86)\Labcenter Electronics\Proteus 7 Professional\LIBRARY". I hope it will give you the idea where to place the file.
- After placing the file in this folder, now open the Proteus ISIS and click on the component selection button.
- In the search box write "Arduino" and the list of all the arduino boards will be shown immediately as shown in the below figure:
- You can see all the five boards in the above figure and you can select any of them.There's also another components in the list which is ultrasonic sensor. Yes, this library also supports ultrasonic sensor but I haven't tested it yet that's why didn't mentioned it, I will test this sensor soon and then will also explain its working.
- Now you can select any of these boards and can start working on them rite away. All the five boards are shown in the below figure:
- The two new Arduino boards in this library are shown below:
- So, now simply design your circuit and write the code in the Arduino ide. After writing the code, get the hex file from arduino software and upload it to these boards.
Note:
- In order to upload the hex file simply double click it and the properties window will pop up. In the Properties window, there will be an option named Program File. In this Program File, browse for the hex file and upload it.
- Now run your Proteus simulation and it will work like charm.
- I will post few projects on these boards soon as soon as I get time to write them, so stay tuned and have fun.
- I have posted a small project on how to use Arduino Lilypad in Proteus which you can read and download from Arduino Lilypad Simulation in Proteus.