DTMF BASED LOAD CONTROL SYSTEM
ABSTRACT
The project aims at controlling various loads spread over a large area
remotely by using DTMF concept. The DTMF command tone thus received from
the phone causes electrical load switching. The project is useful for managing
industrial, domestic or agricultural loads that extend over a large area.
The project requires a DTMF decoder interfaced to audio output socket of
the cell phone. Whenever a button on the keypad is pressed the frequency thus
generated from it is received by the decoder and it converts the frequency into its
equivalent digital code. A microcontroller of PIC family is used which is interfaced
to relays through relay driver IC. The digital code is then provided to
microcontroller that identifies the phone commands and initiates the relays to
actuate the respective loads by turning them on and off.
CHAPTER-1
1. INTRODUCTION
The project aims at controlling various loads spread over a large area
remotely by using DTMF concept. The DTMF command tone thus received from
the phone causes electrical load switching. The project is useful for managing
industrial, domestic or agricultural loads that extend over a large area.
The project requires a DTMF decoder interfaced to audio output socket of the cell
phone. Whenever a button on the keypad is pressed the frequency thus generated
from it is received by the decoder and it converts the frequency into its equivalent
digital code. A microcontroller of 8051 family is used which is interfaced to relays
through relay driver IC. The digital code is then provided to microcontroller that
identifies the phone commands and initiates the relays to actuate the respective
loads by turning them on and off.
CHAPTER-2
2. BLOCK DIAGRAM
2.1CIRCUIT DIAGRAM
CHAPTER-3
3. MICROCONTROLLER PIC 16A 877A
The microcontroller is the heart of the embedded system. It constantly
monitors the digitized parameters of the various sensors and verifies them with the
predefined threshold values. It checks if any corrective action is to be taken for the
condition at that instant of time. In case such a situation arises, it activates the
actuators to perform a controlled operation
3.1 PIN DIAGRAM
3.2 POWER SUPPLY:
A power supply is an electrical device that supplies electric power to an
electrical load. The primary function of a power supply is to convert electric
current from a source to the correct voltage, current, and frequency to power the
load. As a result, power supplies are sometimes referred to as electric power
converters. Some power supplies are separate standalone pieces of equipment,
while others are built into the load appliances that they power. Examples of the
latter include power supplies found in desktop computers and consumer electronics
devices. Other functions that power supplies may perform include limiting the
current drawn by the load to safe levels, shutting off the current in the event of an
electrical fault, power conditioning to prevent electronic noise or voltage surges on
the input from reaching the load, power-factor correction, and storing energy so it
can continue to power the load in the event of a temporary interruption in the
source power (uninterruptible power supply).
All power supplies have a power input connection, which receives energy in
the form of electric current from a source, and one or more power output
connections that deliver current to the load. The source power may come from the
electric power grid, such as an electrical outlet, energy storage devices such as
batteries or fuel cells, generators or alternators, solar power converters, or another
power supply. The input and output are usually hardwired circuit connections,
though some power supplies employ wireless energy transfer to power their loads
without wired connections. Some power supplies have other types of inputs and
outputs as well, for functions such as external monitoring and control.
DC power supplies use AC mains electricity as an energy source. Such
power supplies will employ a transformer to convert the input voltage to a higher
or lower AC voltage. A rectifier is used to convert the transformer output voltage
to a varying DC voltage, which in turn is passed through an electronic filter to
convert it to an unregulated DC voltage.
The filter removes most, but not all of the AC voltage variations; the
remaining AC voltage is known as ripple. The electric load's tolerance of ripple
dictates the minimum amount of filtering that must be provided by a power supply.
In some applications, high ripple is tolerated and therefore no filtering is required.
For example, in some battery charging applications it is possible to implement a
mains-powered DC power supply with nothing more than a transformer and a
single rectifier diode, with a resistor in series with the output to limit charging
current.
3.3 GSM
GSM/GPRS module is used to establish communication between a
computer and a GSM-GPRS system. Global System for Mobile communication
(GSM) is an architecture used for mobile communication in most of the countries.
Global Packet Radio Service (GPRS) is an extension of GSM that enables higher
data transmission rate. GSM/GPRS module consists of a GSM/GPRS modem
assembled together with power supply circuit and communication interfaces (like
RS-232, USB, etc) for computer. The MODEM is the soul of such modules.
Wireless MODEMs
Wireless MODEMs are the MODEM devices that generate, transmit or decode
data from a cellular network, for establishing communication between the cellular
network and the computer. These are manufactured for specific cellular network
(GSM/UMTS/CDMA) or specific cellular data standard
(GSM/UMTS/GPRS/EDGE/HSDPA) or technology (GPS/SIM). Wireless
MODEMs like other MODEM devices use serial communication to interface with
and need Hayes compatible AT commands for communication with the computer
(any microprocessor or microcontroller system).
3.4 GSM/GPRS MODEM
GSM/GPRS MODEM is a class of wireless MODEM devices that are
designed for communication of a computer with the GSM and GPRS network. It
requires a SIM (Subscriber Identity Module) card just like mobile phones to
activate communication with the network. Also they have IMEI (International
Mobile Equipment Identity) number similar to mobile phones for their
identification. A GSM/GPRS MODEM can perform the following operations:
1. Receive, send or delete SMS messages in a SIM.
2. Read, add, search phonebook entries of the SIM.
3. Make, Receive, or reject a voice call.
The MODEM needs AT commands, for interacting with processor or controller,
which are communicated through serial communication. These commands are sent
by the controller/processor. The MODEM sends back a result after it receives a
command. Different AT commands supported by the MODEM can be sent by the
processor/controller/computer to interact with the GSM and GPRS cellular
network.
CHAPTER-4
4. PLC PROGRAM
#include<htc.h>
#include<pic.h>
// Configuration word for PIC16F877A
__CONFIG( FOSC_HS & WDTE_OFF & PWRTE_ON & CP_OFF & BOREN_ON
& LVP_OFF & CPD_OFF & WRT_OFF & DEBUG_OFF);
// Define CPU Frequency
// This must be defined, if __delay_ms() or
// __delay_us() functions are used in the code
#define _XTAL_FREQ 20000000
// Comm Setup
#define BAUDRATE 9600 //bps
// 8 bit data mode with one stop bit
// No flow control, no parity bit
#define rs RD6
//#define rw RC1
#define en RD7
#define load1 RC1
#define load2 RC2
#define load3 RC3
#define load4 RC4
//lcd init
void lcd_init();
void lcd_data(unsigned char);
void lcd_cmd(unsigned char);
void lcd_data_pointer(unsigned char *);
//Serial init
void InitUsart(void);
void putchar(unsigned char byte);
unsigned char getchar(void);
void serial_data_pointer(unsigned char *ew);
void enter();
void interrupt ISR(void);
//Dtmf fun
void dtmf_checking();
void checking_number();
char a;
void main()
{ //Dir reg
TRISB4= TRISB5= TRISB0= TRISB6= TRISB7=0X00;
TRISD=0X00;
TRISC1=0x00;
TRISC4=0x00;;
InitUsart();
lcd_init();
lcd_cmd(0x01);
lcd_data_pointer("ONE BYTE TECH");
lcd_cmd(0xc0);
lcd_data_pointer("SYSTEM STARTED");
__delay_ms(2000);
checking_number();
void checking_number()
{ lcd_cmd(0x01);
lcd_data_pointer("WAITING FOR");
lcd_cmd(0xc0);
lcd_data_pointer("YOUR CALL");
__delay_ms(2000);
do
a=getchar();
}while(a!='9');
do
{
a=getchar();
}while(a!='5');
do
a=getchar();
}while(a!='9');
do
a=getchar();
}while(a!='7');
do
a=getchar();
}while(a!='8');
do
{
a=getchar();
}while(a!='9');
do
a=getchar();
}while(a!='2');
do
a=getchar();
}while(a!='6');
do
a=getchar();
}while(a!='3');
do
{
a=getchar();
}while(a!='8');
serial_data_pointer("ATA\r");
enter();
enter();
// __delay_ms(500);
lcd_cmd(0x01);
lcd_data_pointer("CALL ATTENDED");
lcd_cmd(0xc0);
lcd_data_pointer("DTMF WAITING");
// __delay_ms(2000);
dtmf_checking();
}
//////SERIAL FUN/////////////
void dtmf_checking()
int i,j,k,l;
i=j=k=l=0;
while(1)
do
a=getchar();
}while(a!='D');
do
a=getchar();
}while(a!='T');
do
a=getchar();
}while(a!='M');
do
a=getchar();
}while(a!='F');
do
a=getchar();
}while(a!=':');
do
a=getchar();
}while(a!=' ');
do
a=getchar();
}while(a!=' ');
a=getchar();
if( (a == '1') && (i == 0) )
lcd_cmd(0x01);
lcd_data_pointer("LOAD ONE ON");
load1=1;
// lcd_cmd(0xc0);
// lcd_data_pointer("ACTIVATED");
// __delay_ms(500);
i++;
}
else if( (a == '1') && (i == 1) )
lcd_cmd(0x01);
lcd_data_pointer("LOAD ONE OFF");
load1=0;
// lcd_cmd(0xc0);
// lcd_data_pointer("DE-ACTIVATED");
// __delay_ms(500);
i=0;
else if( (a == '2') && (j == 0) )
lcd_cmd(0x01);
lcd_data_pointer("LOAD TWO ON");
TRISC2=0X00;
load2=1;
// lcd_cmd(0xc0);
// lcd_data_pointer("DE-ACTIVATED");
// __delay_ms(500);
j++;
else if( (a == '2') && (j == 1) )
lcd_cmd(0x01);
lcd_data_pointer("LOAD TWO OFF");
TRISC2=0X00;
load2=0;
// lcd_cmd(0xc0);
// lcd_data_pointer("DE-ACTIVATED");
// __delay_ms(500);
j=0;
else if( (a == '3') && (k == 0) )
lcd_cmd(0x01);
lcd_data_pointer("LOAD THREE ON");
TRISC3=0X00;
load3=1;
// lcd_cmd(0xc0);
// lcd_data_pointer("ACTIVATED");
// __delay_ms(500);
k++;
}
else if( (a == '3') && (k == 1) )
lcd_cmd(0x01);
lcd_data_pointer("LOAD THREE OFF");
TRISC3=0X00;
load3=0;
// lcd_cmd(0xc0);
// lcd_data_pointer("DE-ACTIVATED");
// __delay_ms(500);
k=0;
else if( (a == '4') && (l == 0) )
lcd_cmd(0x01);
lcd_data_pointer("LOAD FOUR ON");
load4=1;
// lcd_cmd(0xc0);
// lcd_data_pointer("DE-ACTIVATED");
// __delay_ms(500);
l++;
else if( (a == '4') && (l == 1) )
lcd_cmd(0x01);
lcd_data_pointer("LOAD FOUR OFF");
load4=0;
l=0;
else if( (a == '0') )
serial_data_pointer("ATH\r");
enter();
enter();
__delay_ms(50);
lcd_cmd(0x01);
lcd_data_pointer("CALL CANCELLED");
checking_number();
load1=load2=load3=load4=0;
i=0;j=0;k=0;l=0;
else
lcd_cmd(0x01);
lcd_data_pointer("NO SIGNAL");
// lcd_cmd(0xc0);
// lcd_data_pointer("SIGNAL");
// __delay_ms(500);
}
void enter()
putchar(0x0D);
putchar(0x0A);
void InitUsart(void) {
// TX Pin - output
TRISC6 = 0;
// RX Pin - input
TRISC7 = 1;
// RX Setting, 8bit, enable receive,
RCSTA = 0x90;
// TX Setting, 8bit, Asinchronius mode, High speed
TXSTA = 0x24;
// Set Baudrade - 9600 (from datasheet baudrade table)
SPBRG = 129;
void putchar(unsigned char byte) {
// wait until register is empty
while(!TXIF);
// transmite byte
TXREG = byte;
unsigned char getchar(void) // Reads a character from the serial port
if(OERR) // If over run error, then reset the receiver
{
CREN = 0;
CREN = 1;
while(!RCIF); // Wait for transmission to receive
return RCREG;
void serial_data_pointer(unsigned char *ew)
while(*ew)
putchar(*ew++);
////////////LCD FUN/////////////
void lcd_init ()
{
rs=0;
PORTB =0x20;
en=1;
__delay_ms(50);
en=0;
lcd_cmd(0x28); // 4-bit mode - 2 line - 5x7 font.
lcd_cmd(0x0C); // Display no cursor - no blink.
lcd_cmd(0x06); // Automatic Increment - No Display shift.
lcd_cmd(0x80); // Address DDRAM with 0 offset 80h.
void lcd_cmd(unsigned char u)
rs=0;
PORTB = u;
en=1;
__delay_ms(50);
en=0;
PORTB =((u<<4) & 0xF0);
en=1;
__delay_ms(50);
en=0;
void lcd_data(unsigned char y)
rs=1;
PORTB =y;
en=1;
__delay_ms(50);
en=0;
PORTB=((y<<4)&0xF0);
en=1;
__delay_ms(50);
en=0;
void lcd_data_pointer(unsigned char *e)
while(*e)
lcd_data(*e++);
void delay(unsigned int ewq)
int i,j;
for(i=0;i<ewq;i++)
for(j=0;j<1275;j++);
}
///INTERRUPT FUN
4.1 RELAY WITH DRIVER CIRCUIT
This product is a 2-channel relay module board with LED indicators; it can
be controlled by microcontrollers such as Arduino, AVR, PIC, ARM any other
microcontroller operating at 5V.
4.1.1 SPECIFICATIONS
Working voltage: 12V
Channel: 2 channel
This relay module is 5V active low.
It is a 2-channel relay interface board, which can be controlled
directly by a wide range of microcontrollers such as Arduino, AVR,
PIC, ARM, PLC, etc.
It is also able to control various appliances and other equipment
with large current.
Relay output maximum contact is AC250V 7A and DC30V
10A.
Standard interface can be directly connected with
microcontrollers.
Working status indicator lights are conducive to the safe use.
PCB Dimensions (LxWxH in mm): 50.5x1.5x69.4mm
4.1.2 BULB
An incandescent light bulb, incandescent lamp or incandescent light globe is
an electric light with a wire filament heated to such a high temperature that it
glows with visible light (incandescence). The filament, heated by passing an
electric current through it, is protected from oxidation and, to a lesser degree, from
evaporation with a glass or fused quartz bulb that is filled with inert gas or more
rarely is evacuated of all gases, such as those found in air. In a halogen lamp,
filament evaporation is slowed by a chemical process that redeposits metal vapor
onto the filament, thereby extending its life.
The light bulb is supplied with electric current by feed-through terminals or wires
embedded in the glass. Most bulbs are used in a socket which provides mechanical
support and electrical connections
4.1.3 LCD
The liquid-crystal display has the distinct advantage of having a low power
consumption than the LED. It is typically of the order of microwatts for the display
in comparison to the some order of mill watts for LEDs. Low power consumption
requirement has made it compatible with MOS integrated logic circuit. Its other
advantages are its low cost, and good contrast. The main drawbacks of LCDs are
additional requirement of light source, a limited temperature range of operation
(between 0 and 60° C), low reliability, short oper-ating life, poor visibility in low
ambient lighting, slow speed and the need for an ac drive.
Basic structure of an LCD
A liquid crystal cell consists of a thin layer (about 10 u m) of a liquid crystal
sand-wiched between two glass sheets with transparent elec-trodes deposited on
their inside faces. With both glass sheets transparent, the cell is known as
transmissive type cell. When one glass is transparent and the other has a reflective
coating, the cell is called reflective type. The LCD does not produce any
illumination of its own. It, in fact, depends entirely on illumination falling on it
from an external source for its visual effect.
Each pixel of an LCD typically consists of a layer of molecules aligned
between two transparent electrodes, and two polarizing filters (parallel and
perpendicular), the axes of transmission of which are (in most of the cases)
perpendicular to each other. Without the liquid crystal between the polarizing
filters, light passing through the first filter would be blocked by the second
(crossed) polarizer. Before an electric field is applied, the orientation of the liquid-
crystal molecules is determined by the alignment at the surfaces of electrodes. In a
twisted nematic (TN) device, the surface alignment directions at the two electrodes
are perpendicular to each other, and so the molecules arrange themselves in a
helical structure, or twist. This induces the rotation of the polarization of the
incident light, and the device appears gray. If the applied voltage is large enough,
the liquid crystal molecules in the center of the layer are almost completely
untwisted and the polarization of the incident light is not rotated as it passes
through the liquid crystal layer. This light will then be mainly polarized
perpendicular to the second filter, and thus be blocked and the pixel will appear
black. By controlling the voltage applied across the liquid crystal layer in each
pixel, light can be allowed to pass through in varying amounts thus constituting
different levels of gray. Color LCD systems use the same technique, with color
filters used to generate red, green, and blue pixels.[3]
LCD in a Texas Instruments calculator with top polarizer removed from
device and placed on top, such that the top and bottom polarizers are
perpendicular.
The optical effect of a TN device in the voltage-on state is far less dependent
on variations in the device thickness than that in the voltage-off state. Because of
this, TN displays with low information content and no backlighting are usually
operated between crossed polarizer’s such that they appear bright with no voltage
(the eye is much more sensitive to variations in the dark state than the bright state).
As most of 2010-era LCDs are used in television sets, monitors and smart phones,
they have high-resolution matrix arrays of pixels to display arbitrary images using
backlighting with a dark background. When no image is displayed, different
arrangements are used. For this purpose, TN LCDs are operated between parallel
polarizer’s, whereas IPS LCDs feature crossed polarizer’s. In many applications
IPS LCDs have replaced TN LCDs, in particular in smart phones such as phones.
Both the liquid crystal material and the alignment layer material contain ionic
compounds. If an electric field of one particular polarity is applied for a long
period of time, this ionic material is attracted to the surfaces and degrades the
device performance. This is avoided either by applying an alternating current or by
reversing the polarity of the electric field as the device is addressed (the response
of the liquid crystal layer is identical, regardless of the polarity of the applied
field).
Displays for a small number of individual digits or fixed symbols (as in
digital watches and pocket calculators) can be implemented with independent
electrodes for each segment. In contrast, full alphanumeric or variable graphics
displays are usually implemented with pixels arranged as a matrix consisting of
electrically connected rows on one side of the LC layer and columns on the other
side, which makes it possible to address each pixel at the intersections. The general
method of matrix addressing consists of sequentially addressing one side of the
matrix, for example by selecting the rows one-by-one and applying the picture
information on the other side at the columns row-by-row. For details on the various
matrix addressing schemes see passive-matrix and active-matrix addressed LCDs.
CHAPTER-5
5.PCB DESIGN:
A printed circuit board (PCB) mechanically supports and electrically
connects electronic components or electrical components using conductive tracks,
pads and other features etched from one or more sheet layers of copper laminated
onto and/or between sheet layers of a non-conductive substrate. Components are
generally soldered onto the PCB to both electrically connect and mechanically
fasten them to it.Printed circuit boards are used in all but the simplest electronic
products. They are also used in some electrical products, such as passive switch
boxes.
Alternatives to PCBs include wire wrap and point-to-point construction,
both once popular but now rarely used. PCBs require additional design effort to lay
out the circuit, but manufacturing and assembly can be automated. Specialized
CAD software is available to do much of the work of layout. Mass-producing
circuits with PCBs is cheaper and faster than with other wiring methods, as
components are mounted and wired in one operation. Large numbers of PCBs can
be fabricated at the same time, and the layout only has to be done once. PCBs can
also be made manually in small quantities, with reduced benefits.
PCBs can be single-sided (one copper layer), double-sided (two copper
layers on both sides of one substrate layer), or multi-layer (outer and inner layers
of copper, alternating with layers of substrate). Multi-layer PCBs allow for much
higher component density, because circuit traces on the inner layers would
otherwise take up surface space between components. The rise in popularity of
multilayer PCBs with more than two, and especially with more than four, copper
planes was concurrent with the adoption of surface mount technology. However,
multilayer PCBs make repair, analysis, and field modification of circuits much
more difficult and usually impractical.
5.1 ADVANTAGE
One can control home appliances from anywhere. It reduces wastage of
electricity when we forgot to switch off the lights & fans and gone outside. It is
very low cost compared to other technologies like GSM.
CHAPTER-6
6. CONCLUSION
Tone from mobile is sent to op-amp through series of resistor (100 kilo-
Ohm) and capacitor (1nf). Pin1 of DTMF IC i.e. non inverting pin is connected to
pin4 i.e. Vref. Pin3 is the output of operational amplifier which is feedback to pin2
using 100 kilo-Ohm resistor. 7 and 8 pins are connected to crystal oscillator of
frequency 3.579545 MHz 15th pin is data valid pin it becomes high when DTMF
tone is detected else remains low. The process of frequency detection to
digitalization of the signal is done by steering circuit consisting of EST, RT/GT,
and resistor (10k), capacitor. Pins 11 to 14 produce the decoded output. So by this
method , different types of load is controlled using DTMF Decoder.
Reference:
[1]Electric fuses P.G. Newbery, B.Sc, C.Eng., M.I.E.E., and Prof. A. Wright, D.Sc, Ph.D., C.Eng.,
F.I.E.E. http://www.electronicsforu.com/EFYLinux/circuit/January2010
/Blown%20Fuse%20Indicator.pdf
[2] http:// www. slideshare.net/Ecwayt/high-voltage-fuse-blownindicatorwith-voice-based-
announcement-system-29910233
[3] Negative-Sequence Relay Protection for Blown High-Side Transformer Fuse Detection, Alan Hannah
Principles of Power System by V.K. Mehta Reliability concept for electric fuses, X.Z. Meng, J.G.J.Sloot
TO THE ORIGINS OF FUSES, Jean-Louis GELET