# Simple Home Automation System Circuit

In this post we learn how to make a simple home automation system circuit using DTMF technology.
Most of the electronic appliances that we use in home are usually operated from traditional switch. However, with the course of time resulting to myriad of innovative standards, the role of switch is slowly getting replaced with one new technology called DTMF [Dual Tone Multi-Frequency].

Using DTMF to control home appliances make managing things more simple. You do not need to reach a switch to turn on the fan, instead you can just turn it on from a single key-touch in your mobile phone.
DTMF mainly runs on two frequencies – Row Frequency and Column Frequency.These two are often referred as low frequency and high frequency respectively.

The frequencies used in DTMF are used in such a way to avoid harmonic relation among each other so as not to produce similar tones. Unlike row frequency the column frequencies is comparatively louder in order to enable hi-frequency voice audio system.
As the button pressed on a keypad produces different tones, these tones are used to manage different appliances in your household. To design the appliance, we primarily need a DTMF encoder, which is there on a mobile phone and a DTMF decoder IC HT9107B to convert the tone from keypad in digital form.
The following section explains they way this home automation system circuit needs to be designed:
As stated previously, to design the system we need an encoder and a decoder. The mobile jack which is connected to Capacitor 1nf has two wires – red and black.

The red wire is connected to the IC decoder while the black wire is left grounded. When a button is pressed in the mobile phone a tone generates, which gets decoded by the IC decoder and further moved to the controller ATMEGA8.

The controller further checks the status of the input, further producing the final output using the following code:
#include <avr/io.h>
#include <util/delay.h>

int main(void)
{
DDRB=0x00;
DDRC=0xff;
while(1)
{
if((PINB&0x0f)==0x01)
{
PORTC=0x01;
}

else if((PINB&0x0f)==0x02)
{
PORTC=0x02;
}

else if((PINB&0x0f)==0x03)
{
PORTC=0x03;
}

else if((PINB&0x0f)==0x04)
{
PORTC=0x00;
}
}
}

The following Figure is of a home automation circuit design using DTMF:

Designing the Circuit
An operational amplifier comes integrated with the IC decoder. The op-amp which generates output goes to the pre-filters in order to separate high and low frequencies. The output us further goes via frequency and code generation circuits, which enables 4-bits binary code.
The tone generated from the mobile phone is passed to op-amp via a series of 100 kilo-Ohm resistor and Capacitor 1nf. In the DTMF IC, the Pin 1, which is an inverted pin is connected to Pin 4.

This implies that the Pin 3 Vref is the operational amplifier’s output with further feedback to Pin 2 by the resistors. The crystal oscillator is connected to Pin 7 and Pin 8 on a frequency of 3.579545 MHz.

The Pin 15 is th data valid pin usually remains low, but goes high upon detection of a DTMF tone. From detection of frequency to digitally convert the data, this entire process is managed steering circuit, which consists of RT/GT, EST, Capacitor and 10K Resistors. Pin 11 and Pin 14 helps to produce the output.

These two pins are also connected to PBo – PB3 of the controller. PDo and PD1– the output pins of the controller are connected to relay, and the relay output is further connected the main source i.e. the appliances.
It is vital to note that relay essentially works as a switch, which generates isolation from different circuit parts.

However, in this project the relay used is the magnetic relay to enable AC load of 5 Volts, which is the maximum voltage derived from a controller.
Operating the Circuit
The controller constantly checks for the input after the circuit receives the power. Now if we press 1 on the mobile keypad, the IC decoder decodes the tone to output the value 0001.

The decoded output is further passed to a microcontroller generating higher output at Pin PDo, which is connected to relay.

As the relay used here is to switch the circuit, the appliance will then turn ON. And if the input received by the relay is 2, the appliance that you are trying to turn ON will go OFF. Similar idea goes with pressing other values in the mobile keypad.
Requirements
Following are the components that you need to design the circuit:
1. Microcontroller U1 – Atmega8
2. IC HT9107B