REQUIREMENTS:
- Cube relay (for dealing with 220v A.C.)
- AT89S52 (8051 microcontroller by Atmel Corp.)
- DTMF decoder module
- 7805 voltage regulator
- 11.0592 MHz crystal
- L293D(I have discussed its use below )
Fig. 1: Prototype of 8051 Microcontroller based Mobile operated Home Automation System
This project uses DTMF technology to control home appliances. DTMF stands for Dual Tone Multi Frequency.This DTMF based system can control home appliances via mobile phone communication from anywhere around the world.
This facilitates the user to operate anything on his fingertips.
It requires two cell phones to operate properly; one of them will always remain in touch with the circuit and another to place a call on that phone.
In this circuit Relay-1 will work if we press “123”, “456” for Relay-2 and “789” for Relay-3.
Now pressing the digits in reverse order will switch off the corresponding relay i.e. “321”, “654” and”987” will switch off Relay-1,2,3 respectively.
In case we need to switch off all of them at same time then pressing “0” will accomplish the task.
Now comes the most interesting part; why interfacing L293D with such a circuit? Here’s your answer, 8051 chips, especially AT89S52’s are not capable of delivering that much current which is required by the relay module to work. Thus I got an idea of using L293D which will enhance the current value as well as the voltage part because my relays work on 12 v DC.
Thus using this circuit one can control at most 4 relays at a time by using single L293D.
By pressing “#” you will accomplish the entering task. What I mean by this is, every time you want your microcontroller to read any DTMF value you’ll need to press “#”.
I have connected my L293D’s input pins to P2^0, 1, 2, 3 while output pins are connected to the positive terminal of individual relay. I have grounded them commonly.
The DTMF module is connected with the upper half of PORT 3 i.e. P3^0, 1, 2, 3.
The receiving mobile phone is connected to DTMF module with a 3.5 mm jack cable.
Since I am inputting these values in Char data type therefore I have to use #include<string.h> in order to compare their values, using strcmp().
Strcmp() inputs two char values, compares them and returns -1,0 or 1. In our case we just need to focus on the “0” one. If strcmp() returns 0 value, this shows that there is no difference in between the values entered or they are same. This statement will help us to match the codes required for operating each relay uniquely.
APPLICATIONS:
There are moments in our lives where we are in doubt, whether we have closed the lights/fans/appliances or not. This system will help you resolve your worry, simply give a call to the phone connected and press the corresponding digits.
It can also serve for the purpose of switching on A.C’s to cool down your room on a hot-sunny day, before you reach your house.
There is no end to the number of applications this system can perform, you just need to have an idea!
ADD ONS:
You can make use of strcmp() to make your whole system password protected and safe.
Project Source Code
###
#include<reg51.h>
#include<string.h>
sbit relay1=P2^0;
sbit relay2=P2^1;
sbit relay3=P2^3;
void main()
{
int i=0;
char arr[16];
relay1=relay2=relay3=0;
P3=0xff;
while(1)
{
while(P3!=0xfc)
{
if(P3==0xf1)
{
arr[i++]='1';
while(P3==0xf1);
}
else if(P3==0xf2)
{
arr[i++]='2';
while(P3==0xf2);
}
else if(P3==0xf3)
{
arr[i++]='3';
while(P3==0xf3);
}
else if(P3==0xf4)
{
arr[i++]='4';
while(P3==0xf4);
}
else if(P3==0xf5)
{
arr[i++]='5';
while(P3==0xf5);
}
else if(P3==0xf6)
{
arr[i++]='6';
while(P3==0xf6);
}
else if(P3==0xf7)
{
arr[i++]='7';
while(P3==0xf7);
}
else if(P3==0xf8)
{
arr[i++]='8';
while(P3==0xf8);
}
else if(P3==0xf9)
{
arr[i++]='9';
while(P3==0xf9);
}
else if(P3==0xfa)
{
arr[i++]='0';
while(P3==0xfa);
}
arr[i]='