You are on page 1of 37

# Wireless Remote Operated Mains Switch

ABSTRACT This system is a wireless remote switch for operating the mains voltage. This report details the circuit design, operation, major components information. This works on RF communication principle. Data is transmitted to the receiver through RF modules. In this design we have successfully implemented the RF communication, data encoding and decoding. A micro control receives the information from the data lines, process the same as per the requirement. All these details are presented in this report

1. INTRODUCTION

Electricity plays an important role in our everyday life. A lot of emphasis is placed on power save as thedemand is high and the production is low for it. We use electricity at our homes and offices for several purposes including lighting, fans, and electrical appliances so on. If we consider an example at our homes, for lighting, we turn the switches on at dusk at several places. Some of the lights are intended to be switched off after some time, for instance veranda. But due to laziness, we ignore it and switch them off only at late night. We have designed and developed a system so that the electrical switches can be operated remotely. A person doesnt need to reach the physical location of the switch, they can accomplish the task remotely. i.e. a light switch in veranda can be controlled from the bed room itself.The application for this type of system is numerous and is limited to only ones imagination. Block Diagram for Remote Controlled Mains Switch is

2.Design Procedure: Power supply circuit: Transformer:- Which transforms energy from primary side to secondary side or from one circuit to other circuit. Input to the transformer is 230v R.M.S voltage. The required input to the LM7812 regulator is 14v . 230v R.M.S voltage is not a constant value. It may varies i.e. It may be less than 14v or greater than 14v. for our requirements the transformer output must be 15v at the secondary side. Depending on these primary and secondary voltages we can calculate turns ratio using following formula V1/V2=N1/N2=I2/I1 i.e. 230/15=N1/N2 N1:N2=16:1 N1:N2

Bridge Rectifier:- presently most of the electronic devices are semiconductor devices. These semiconductor devices are low power devices. these devices will not work under zero average voltage . since A.C supply having zero average voltage these devices cant work. D.C voltages having at least average voltage. The bridge rectifier is used to convert these a.c supply to d.c supply. It has many advantages than full wave rectifier. It consist of 4 diodes. Since the power dissipation in our project is less than 50watts we can use 1N4001 diodes.

## Fig2. Bridge Rectifier

The construction of the bridge rectifier is shown in above Fig2. Operation:Case1: when the +ve cycle is present at port 1 and ve cycle is present at port2 the diodes D2 and D3 will be in forward biased condition and conducts while D1 and D4 will be in reverse biased conditon and doesnt conduct. The rectifier operation is shown in below fig3.

## Fig.3 +ve half cycle operation

Case2: when ve cycle is present at port1 and +ve cycle is present at port2 the diodes D1 and D4 will be in forward biased condition and conducts while D2 and D3 are in reverse biased condition and doesnt conduts. The circuit operation is shown in below fig4.

Fig.4 -ve half cycle operation The output voltage of the bridge rectifier is unidirectional voltage i.e. pulsating d.c voltage this is because the current in the bridge rectifier is unidirectional flow of current. The bridge rectifier waveforms in the case of +Ve half cycle and ve half cycle are shown in the below Fig.5

## Fig.5 Bridge rectifier waveforms

Filter circuit:-

The voltage at the output of bridge rectifier is not a pure d.c it is a pulsating d.c. the filter can remove ripple from the pulsating d.c. since the capacitor allows only a.c supply and stops d.c supply we can use it as filter. The charging and discharging time of the capacitor is depends on the time constant T=Rc. The time constant should be large then it can charge and discharge slowly then the waveform gets smoothen. Basically the time constant should be 5 time constant i.e. T=5*RC . The filter capacitor is shown in the below fig.6

Fig.6 capacitive filter The filter input and output waveforms are shown in below fig.7

Fig.7 filter waveforms The ripple voltage can be calculated by the following formula

Vr=Vmax-Vd.c Regulator:The filter output is not a pure d.c and it is not a constant d.c voltage it varies with the fluctuations in the main power supply. But our requirement is to get constant d.c power supply. The regulator can give constant d.c power supply. These are two types ve power supply and +ve power supply. The 78xx series gives +ve power supply (78 indicates +ve and xx indicates any voltage value). The LM79xx series gives ve power supply ( 79 indicates ve and xx indicates any voltage value). In our project ATmega8, HT12E and HT12D needs +5v power supply and SPDT Relays needs +12v power supply. LM7805 and LM7812 gives +5v and +12v constant power supply respectively. LM7812 regulator pin diagram is shown in below fig.8

## Fig.8(a) LM7812. LM7805 regulator pin diagram is shown in below fig.8(b)

Fig.8(b) LM7805

Current Limiting Resistor for LED A suitable value for a current limiting resistor is calculated as follows.

+5v

1.5v I=5mA

V=IR

0v The supply voltage is 5 volts. The current that we want to flow through the LED is 5mA. Assume that the forward voltage drop will be 1.5 V. BY KVL, the voltage drop across the resistor must be 5 -1.5=3V. By Ohms Law, this voltage drop equals iR. Therefore: 5- 1.5 = R*5mA Rearranging terms gives: R = (5- 1.5)/5mA R = 3.5/5mA = 0.7 K = 700 . So, if we select R value as 700 , then the current flowing through the LED is limited to 5 mA. .

+12v power supply circuit:+12v power supply with LM7812 Is shown in below fig.9

## Fig.9 +12v power supply with LM7812

Calculations:Backward Analysis:Output of the LM7812 is 12v/1A and from the datasheet the input voltage and current to the LM7812 are 14v/1.5A.

1). Power dissipation Pd=Pin-Pout Pin=Vin x I=14x1.5=21 W Pout=Vout x I out= 12x1= 12 W Pd=21-12=9 watts 2). Capacitor value: We know that quality factor Q=CxV And Q=TxI From these two equations CxV=TxI C= (TxI)/V But T=1/(2fc) Fc=2xf Hz But f=50hz Fc=100hz T=1/(2 x100) T=1.59x10^-3 sec But our requirement is 5 time constant T=5x1.59x10^-3 Substitute T,I and v values in C C=(5x1.59x10^-3x1.5)/14 C=850f 3). Rectifier input values: We know that Vdc=2Vm/ and Idc=2Im/ But Vm=2xVrms Im=2xIrms Then Vrms=(Vdcx)/22 Vrms=(14x)/22= 15.55v Irms=(Idcx)/22=1.66A 4). Turns ratio: Vp/Vs=Np/Ns 230/15.55=Np/Ns Np:Ns=15:1

5) primary current Is: Vp/Vs=Is/Ip 230/15.5=1.66/Ip Ip=112mA. Forward circuit Analysis:1). Turns ratio: Np/Ns=Vp/Vs Np/Ns=230/15 Np:Ns=16:1 2). Secondary current Is: Vp/Vs=Is/Ip 230/15=Is/0.112 Is=1.7A 3). Rectifier O/P: Vdc=2xVm/=22xVrms/ Vdc=22x15/ Vdc=13.5v Idc=2xIm/ Idc=22xIrms/=22x1.7/ Idc=1.5A 4). Capacitor value: We know that C=Tx I/V C=5x1.59x10^-3x1.53/13.5 C=901uf1000uf 5). Power dissipation: Pd=Pin-Pout Pd=(13.5x1.5)-(12x1) Pd=8.25watts. +5v power supply :-

shown

LM7805 gives +5v volts from +12v. the circuit diagram of +5v power supply from +12v is in below fig.10

Fig.10

## +5v power supply

3.CIRCUIT DESCRIPTION The following Hardware and software is used in this system. Detailed explanation of these components follow in the later sections. 3.1 Hardware 1) Micro controller 2) Wireless Transmitter and Wireless Receiver 3) Encoder and Decoder 4) Power Supply 5V 5) Relays 6) Diodes 3.2 Software Tools 1) AVR Compiler 2) Express PCB/Pads

## Fig.Main Circuit diagram

Circuit Description The remote consits of a transmitter, an encoder and four buttons. The four butons control the ON/OFF of four stations independently. The transmitter is a RF tranmsitter which works at 433MHz. This transmitter takes input from an encoder. The encoder has address lines and data lines. The data presented on the data lines is encoded and transmitted The receiver consists of a 433 MHz RF receiver. It receives the data wirelessly from the transmitter. The received data is given to the decoder. The decoder decodes the data. This decoded data is passed to the micro controller. The micro controller takes action depending on which switch pressed. Accordingly the micro sends output signal to the concerned transistor. The transistor used here is a NPN type. The transistor functions as a driver for the relay. It takes input from the micro in the form of high or low, i.e. 5V or 0V. When it receives 5V the transistor is ON and inturn the relay is ON, since the relay is connected to between the supply and the collector terminal The relay is ON when the transistor is ON and is OFF when the transistor is OFF. The relay is operated with 12V. This is the reason why we have built a 12V regulated power supply. There is a free wheel diode provided across the relay terminals. The

purpose of this diode is when the relay is off it provides a path for the energy which is stored in the coil. For example, Assume button A is pressed. This data is transmitted to the micro through RF and encoder and decoder. The micro now turns on the switch A. The switch is now in ON position. Now button A is pressed at a later point of time. The micro receives this informationa and accordingly switch A is now OFF.This toggling action continues whenever swicth A is pressed. Transmitter Part:Remote controlled mains switch is used to control our home appliances with remote access from few meters distance. It is a wireless communication based project. Operation:In this transmitter part the push button switches are used to control the main loads. These buttons are i/ps to the encoder. When we press a button the diode connected to it will be in forward biased and conducts at the same time transmitter enable (TE) also conducts. Since we are using HT12E encoder it has 8 address lines and 4 address+data line multiplexed. Initially we need to set these 8 address lines to Ground or Vcc. To set and reset these address lines we use 8 pin DIP switch and 10kohm SIP resisor. These 8 lines are connected to the 8 address lines of HT12E encoder. For our convenience 8 address lines are connected to ground line then all the address lines are reset to 0. Then the address generated by the encoder is 00000000. When we press a button the respective data will be sent with 00000000 address i.e. 00000000 XXXX. Here XXXX may be any data. The total 12 bits can be transmits by the RF transmitter. UAK R433A is used in RF transmitter. It is a SAW( surface acoustic wave) resonator. It increases the signal strength. Then we can cover up to 15-20mtrs distance around the RF transmitter. The power supply to the encoder, RF transmitter and etc. can be provided by the LM7805 regulator. Case1: when the 1st push button is pressed AD8 pin will be set. Then the corresponding 12 bit data 00000000XXX1 will be send to receiver part. If press the same button again then AD8 pin will be reset. Then the corresponding 12 bit data 00000000XXX0 will be send by the transmitter. Case2: when the 2st push button is pressed AD9 pin will be set. Then the corresponding 12 bit data 00000000XX1X will be send to receiver part. If press the same button again then AD9 pin will be reset. Then the corresponding 12 bit data 00000000XX0X will be send by the transmitter. Case3: when the 3st push button is pressed AD10 pin will be set. Then the corresponding 12 bit data 00000000X1XX will be send to receiver part. If press the same button again then AD10 pin will be reset. Then the corresponding 12 bit data 00000000X0XX will be send by the transmitter. Case4: when the 4st push button is pressed AD11 pin will be set. Then the corresponding 12 bit data 000000001XXX will be send to receiver part. If press the same button again then AD11 pin will be reset. Then the corresponding 12 bit data 000000000XXX will be send by the transmitter. The modulation technique used in the transmission section is ASK signaling technique.

Receiver part:Receiver section consist of two voltage regulators to give +5v and +12v power supply. +5v is connected to Atmega8, RF receiver, HT12D decoder and etc., and +12v is connected to SPDT Relays. Operation:- The RF receiver receives the 12 bit data which is transmitted by the RF transmitter. RF receiver will demodulates the received ASK signal and then it sends the demodulated 12bit data to DIN pin of the HT12D decoder. The decoder will decodes the 12bit data and it sends the parallel data to address and data pins. If the address of the received data is matched with decoder address the valid transmission in set to one. The green LED is connected to the VT pin of the decoder. When the transmission is valid the green LED will glows. The received 4 bit data is send to ATmega8 microcontroller when the data pins of the decoder are connected to ATmega8. The pins AD8-AD11 are connected to PD0,PD1,PD2 and PD3 pins of the ATmega8 microcontroller. When the microcontroller receives the 4bit data it performs the operation depending on the program stored in its internal memory. PORTB= 0xFF will set the portB as output port. The four pins of the port B are connected to four BC548 transistors with base resistances. The transistors are connected in CE configuration. The collector output of each transistor is connected to one Q3F 1z Relay. Thus the relay operation is depends on the output of transistor. The relay armature is initially connected to N/O (normally opened) contact when there is no power supply. When the armature gets required current then it connects to N/C(normally closed) pin of relay. The relay acts as a switch here. The load can be connected to relay. One of the wire of the load is cut in the middle and then connect the two ends of the wire to input and output pins of the relay. Case1: when we press the 1st button 1st time in the transmitter the microcontroller will generate XX00001X code and sends it to PORT B. Then the PB6 pin will be in high state these will set the transistor to ON condition and this transistor o/p will switch ON the 1st Relay. if we press the same button again microcontroller will sends XX00000X to PORT B. The PB6 pin is low in this condition this will switch OFF the transistor and 1st Relay. Case2: when we press the 2nd button 1st time in the transmitter the microcontroller will generate XX0000X1 code and sends it to PORT B. Then the PB7 pin will be in high state these will set the transistor to ON condition and this transistor o/p will switch ON the 2nd Relay. If we press the same button again microcontroller will sends XX0000X0 to PORT B. The PB7 pin is low in this condition this will switch OFF the transistor and 2nd Relay. Case3: when we press the 3rd button 1st time in the transmitter the microcontroller will generate 1X0000XX code and sends it to PORT B. Then the PB0 pin will be in high state these will set the transistor to ON condition and this transistor o/p will switch ON the 3rd Relay. If we press the same button again microcontroller will sends 0X0000XX to PORT B. The PB0 pin is low in this condition this will switch OFF the transistor and 3rd Relay. Case4: when we press the 4th button 1st time in the transmitter the microcontroller will generate X10000XX code and sends it to PORT B. Then the PB1 pin will be in high state these will set the transistor to ON condition and this transistor o/p will switch ON the 4th Relay. If we press the same button again microcontroller will sends X00000XX to PORT B. The PB1 pin is low in this condition this will switch OFF the transistor and 4th Relay. The loads connected to the relays must be smaller loads i.e. 250v loads. Since these relays can handle 250v/5A power supply loads it cant operate heavy loads and it may damage with heavy loads.

4. MAJOR COMPONENTS INFORMATION In this section we present detailed information on the major components that we have used in our system 4.1 AVR Micro Controller A quick look on the market reveals there are tons of micros available. Some of them which we have narrowed down are 1) AVR ATMega microcontroller Series 2) 8051 Series 3) PIC microcontroller Series 4) ARM Series AVR has got advanced features combined with rich instructions and architecture. Hence we have used AVR as the controller.There are minimum six requirements for proper operation of microcontroller. Those are: 1) power supply section 2) ports 3) Reset circuit 4) Crystal circuit 5) ISP circuit (for program dumping) For this project we are using AVR microcontroller. we can use transistors instead of microcontroller and even transistors are cheap also in comparison to microcontroller but the reason behind using the microcontroller is we are in learning phase. One reason also stand for using microcontroller is that if we have used transistor, circuit would have been very complexed. This is because we prefer to use microcontroller. 4.1.1 I/O Port Microcontrollers usually have special hardware for dealing with outside world. These are called I\O ports. We normally use I\O ports to interface the microcontrollers to sensors, actuators etc. Microcontroller input\output is always logic high or logic low in terms of voltage. If logic high, it means +5 V and if logic low, it means 0 V. All AVR ports have true Read-ModifyWrite functionality when used as general digital I/O ports. This means that the direction of one port pin can be changed without unintentionally changing direction of any other pins. Each output buffer has symmetrical drive characteristics with both high sink and source capability. The pin driver is strong enough to drive LED displays directly. All port pins have individually selectable pull-up resistors with a supply-voltage invariant resistance

In AVR microcontroller there are three I\O ports named B, C & D. The port B & D has 8 pins or bits and the port C has 7 pins. All the bits of any these said ports, we can use as both I\O port. In this above said system well use port D as input and port B as output. This is shown in the circuit diagram. 4.1.2 Block Diagram for AVR Micro Controller

## AVR Micro Block Diagram

The AVR core combines a rich instruction set with 32 general purpose working registers. All the 32 registers are directly connected to the Arithmetic Logic Unit (ALU), allowing two independent registers to be accessed in one single instruction executed in one clock cycle. The resulting architecture is more code efficient while achieving throughputs up to ten times faster than conventional CISC Microcontrollers The ATmega8 provides the following features: 8K bytes of In-System Programmable Flash with Read- While-Write capabilities, 512 bytes of EEPROM, 1K byte of SRAM, 23 general purpose I/O lines, 32 general purpose working registers, three flexible Timer/Counters with compare modes, internal and external interrupts, a serial programmable USART, a byte oriented Two wire Serial Interface, a 6-channel ADC (eight channels in TQFP and QFN/MLF packages) with 10-bit accuracy, a programmable Watchdog Timer with Internal Oscillator, an SPI serial port, and five software selectable power saving modes. The Idle mode stops the CPU while allowing the SRAM, Timer/Counters, SPI port, and interrupt system to continue functioning. The Power down mode saves the register contents but freezes the Oscillator, disabling all other chip functions until the next Interrupt or Hardware Reset. In Power-save mode, the asynchronous timer continues to run, allowing the user to maintain a timer base while the rest of the device is sleeping The ADC Noise Reduction mode stops the CPU and all I/O modules except asynchronous timer and ADC, to minimize switching noise during ADC conversions. In Standby mode, the crystal/resonator Oscillator is running while the rest of the device is sleeping. This allows very fast start-up combined with low-power consumption. The device is manufactured using Atmels high density non-volatile memory technology. The Flash Program memory can be reprogrammed In-System through an SPI serial interface, by a conventional non-volatile memory programmer, or by an On-chip boot program running on the AVR core. The boot program can use any interface to download the application program in the Application Flash memory. Software in the Boot Flash Section will continue to run while the Application Flash Section is updated, providing true Read-While-Write operation. By combining an 8-bit RISC CPU with InSystem Self-Programmable Flash on a monolithic chip, the atmel ATmega8 is a powerful microcontroller that provides a highly-flexible and cost-effective solution to many embedded control applications. The ATmega8 AVR is supported with a full suite of program and system development tools, including C compilers, macro assemblers, program debugger/simulators, In-Circuit

## Emulators,and evaluation kits. 4.1.3 AVR Micro Controller Internal Architecture

AVR Micro Controller Internal Architecture 4.1.4 Pin Descriptions VCC Digital supply voltage. GND Ground Port B (PB7..PB0) XTAL1/XTAL2/TOSC1/TOSC2 Port B is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for each bit). The Port B output buffers have symmetrical drive characteristics with both high sink and source capability. As

inputs, Port B pins that are externally pulled low will source current if the pull-up resistors are activated. The Port B pins are tri-stated when a reset condition becomes active, even if the clock is not running. Depending on the clock selection fuse settings, PB6 can be used as input to the inverting Oscillator amplifier and input to the internal clock operating circuit Depending on the clock selection fuse settings, PB7 can be used as output from the inverting Oscillator amplifier If the Internal Calibrated RC Oscillator is used as chip clock source, PB7..6 is used as TOSC2..1 input for the Asynchronous Timer/Counter2 if the AS2 bit in ASSR is set. Port C (PC5..PC0) Port C is an 7-bit bi-directional I/O port with internal pull-up resistors (selected for each bit). The Port C output buffers have symmetrical drive characteristics with both high sink and source capability. As inputs, Port C pins that are externally pulled low will source current if the pull-up resistors are activated. The Port C pins are tri-stated when a reset condition becomes active, even if the clock is not running. PC6/RESET If the RSTDISBL Fuse is programmed, PC6 is used as an I/O pin. Note that the electrical characteristics of PC6 differ from those of the other pins of Port C. If the RSTDISBL Fuse is unprogrammed, PC6 is used as a Reset input. A low level on this pin for longer than the minimum pulse length will generate a Reset, even if the clock is not running. Shorter pulses are not guaranteed to generate a Reset. Port D (PD7..PD0) Port D is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for each bit). The Port D output buffers have symmetrical drive characteristics with both high sink and source capability. As inputs, Port D pins that are externally pulled low will source current if the pull-up resistors are activated. The Port D pins are tri-stated when a reset condition becomes active, even if the clock is not running. Port D also serves the functions of various special features of the ATmega8. RESET Reset input. A low level on this pin for longer than the minimum pulse length will generate a reset, even if the clock is not running. Shorter pulses are not guaranteed to generate a reset AVCC AVCC is the supply voltage pin for the A/D Converter, Port C (3..0), and ADC (7..6). It should be externally connected to VCC, even if the ADC is not used. If the ADC is used, it should be connected to VCC through a low-pass filter. Note that Port C (5..4) use digital supply voltage, VCC.

AREF AREF is the analog reference pin for the A/D Converter Configuring the Pin Each port pin consists of 3 Register bits: DDxn, PORTxn, and PINxn.The DDxn bits are accessed at the DDRx I/O address, the PORTxn bits at the PORTx I/O address, and the PINxn bits at the PINx I/O

address The DDxn bit in the DDRx Register selects the direction of this pin. If DDxn is written logic one, Pxn is configured as an output pin. If DDxn is written logic zero, Pxn is configured as an input pin If PORTxn is written logic one when the pin is configured as an input pin, the pull-up resistor is activated. To switch the pull-up resistor off, PORTxn has to be written logic zero or the pin has to be configured as an output pin. The port pins are tri-stated when a reset condition becomes active, even if no clocks are running. If PORTxn is written logic one when the pin is configured as an output pin, the port pin is driven high (one). If PORTxn is written logic zero when the pin is configured as an output pin, the port pin is driven low (zero). When switching between tri-state ({DDxn, PORTxn} = 0b00) and output high ({DDxn, PORTxn} = 0b11), an intermediate state with either pull-up enabled ({DDxn, PORTxn} = 0b01) or output low ({DDxn, PORTxn} = 0b10) must occur. Normally, the pull-up enabled state is fully acceptable, as a high-impedant environment will not notice the difference between a strong high driver Reading the Pin Value Independent of the setting of Data Direction bit DDxn, the port pin can be read through the PINxn Register Bit. Tthe PINxn Register bit and the preceding latch constitute a synchronizer. This is needed to avoid metastability if the physical pin changes value near the edge of the internal clock, but it also introduces a delay.

## OSCILLATOR CONNECTIONS: Note: C1, C2 = 30 pF 10 pF for Crystals = 40 pF 10 pF for Ceramic Resonators

External Clock driver Configuration. 4.2 Encoder Encoder is used to convert parallel data to serial data. We use HT12E encoder in our design. These encoders are a series of CMOS LSIs for remote control system applications. They are capable of encoding information which consists of N address bits and 12_N data bits. Each address/data input can be set to one of the two logic states. The programmed addresses/data are transmitted together with the header bits via an RF or an infrared transmission medium upon receipt of a trigger signal. The capability to select a TE trigger on the HT12E or a DATA trigger on the HT12A further enhances the application flexibility of these encoders FEATURES OF HT12E: Operating voltage 2.4V-12V Low power and high noise immunity CMOS technology Low standby current: 0.1_A (typ) at Vdd=5V Minimum transmission word (four words) Built in oscillator needs only 5% resistor Data code has positive polarity Minimal external components 18 pin DIP,20 pin SOP package At VDD=5V its low standby current is 0.1uA. So, we supply 5V to encoder. In this there are 8 address lines and 4 data lines. These address lines are connected to dual in line package (DIP) through SIP (which contains 10 resistors) foraddress synchronization between transmitter and receiver and data lines are used for data transmission When the address in the transmitter section and receiver section matches then the address synchronization takes place. The transmission of the data takes place only when the address is synchronized between the transmitter and the receiver.

PIN DIAGRAM:

The 4 data lines from switches are connected to AD8, AD9, AD10, AD11 and 8 address lines A0A7 are connected to t DIP switch through SIP.

DIP

SIP A0 A1 A2

HT12E

A3 A4 A5 A6 A7

Connection of encoder lines to the DIP switch When 5V supply is given to the encoder, the address lines of encoder are connected to DIP address lines and when there is no supply the address lines of encoder are grounded through resistors present in the SIP to avoid floating state.

4.3 RF Transmitter: In our design we use RF 434 MHz transmitter to transmit the data wirelessly. This is an ASK transmitter module i.e, the modulation technique used is ASK modulation with an output of up to 8mw,depending on the power supply voltage Features: 434 z Transmitter Operation 500 . Range - Dependent on Transmitter Power Supply 2400 or 4800bps transfer rate Low cost and Extremely small and light weight Pin diagram:

RF Transmitter

Vcc

GND

Data

Antenna

Pin diagram of RF transmitter The above figure shows the pin diagram for RF transmitter. RF 434 MHz transmitter has 4 pins. VCC pin is connected to the power supply 5V and GND pin is grounded. DOUT of the encoder which contains the serial output data is connected to the DATA pin so that the data is transmitted to the receiver wirelessly. ANTENNA pin is connected to the antenna. 4.4 RF Receiver We use RF 434 MHz receiver similar to the RF transmitter. It receives the data from RF transmitter by using wireless communication. Ithas 8 pins and the features are similar to the RF transmitter. The output data of this receiver is connected to decoder.

## PIN DIAGRAM: RF receiver

Vcc

Vcc GND

Vcc

Antenna

Data Pin diagram of receiver The above figure shows the pin diagram for RF receiver. Vcc pins are connected to supply. 2 data lines are shorted and they are connected to decoder. Receiver allows the data serially to the decoder. And 1pin is connected to antenna to receive the data sent by the transmitter and the other pins are grounded. 4.5 Decoder This is used to convert serial data received from the receiver to parallel data. For proper operation, a pair of encoder/decoder with the same number of addresses and data format should be chosen. In this design we opt for HT12D which has 8 address lines and 4 data lines same as encoder (HT12E). These decoders are a series of CMOS LSIs for remote control system applications. They are paired with encoders . For proper operation, a pair of encoder/decoder with the same number of addresses and data format should be chosen. The decoders receive serial addresses and data from a programmed encoders that are transmitted by a carrier using an RF or an IR transmission medium. They compare the serial input data three times continuously with their local addresses. If no error or unmatched codes are found, the input data codes are decoded and then transferred to the output pins. The VT pin also goes high to indicate a valid transmission. The decoders are capable of decoding informations that consist of N bits of address and 12_N bits of data. Of this series, the HT12D is arranged to provide 8 address bits and 4 data bits, and HT12F is used to decode 12 bits of address information. This 8 address lines are used for address synchronization between transmitter and receiver and 4 data linesare used for data transmission.

FEATURES: Operating voltage 2.4V to 12 V Low stand by current Cable of decoding 12 bits of information Binary address setting Received codes are checked 3 times Built in oscillator needs only 5% resistor Easy interface with RF or infrared transmission medium 18 pin DIP, 20 pin SOP package. PIN DIAGRAM OF HT12D:

HT12D VDD A0 A1 A2 A3 A4 A5 A6 A7 Vss 18 pin DIP. The above figure shows the pin diagram for HT12D decoder. The address lines A0-A7 are connected to DIP switch through SIP and data lines D8-D11 are connected to one of the port of micro controller. A0 A1 A2 A3 A4 A5 A6 A7 DIP SIP HT12D D10 D9 D8 VT OSC1 OSC2 DIN D11

4.6 Relay The relay is an automatic control element whose output variable undergoes a change by leaps and bounds when its input variable (electric, magnetic, sound, light) reaches a set point. INTRODUCTION: The relay is a device that acts upon the same fundamental principle as the solenoid. The difference between a relay and a solenoid is that a relay does not have a movable core (plunger) while the solenoid does. Where multiple relays are used, several circuits may be controlled once. Relays are electrically operated control switches, and are classified according to their use as POWER RELAYS or CONTROL RELAYS. Power relays are called CONTACTORS; control relays are usually known simply as relays. The function of a contactor is to use a relatively small amount of electrical power to control the switching of a large amount of power. The contactor permits you to control power at other locations in the equipment, and the heavy power cables need be run only through the power relay contacts. Only lightweight control wires are connected from the control switches to relay coil. Safety is also an important reason for using power relays, since high power circuits can be switched remotely without danger to the operator. Control relays, as their name implies, are frequently used in the control of low power circuits or other relays, although they also have many other uses. In automatic relay circuits, a small electric signal may set off a chain reaction of successively acting relays, which then perform various functions. Anytime you want to switch a device which draws more current than is provided by an output of a switch or component you'll need to use a relay. The coil of an SPDT or an SPST relay that we most commonly use draws very little current (less than 200 milliamps) and the amount of current that you can pass through a relay's common, normally closed, and normally open contacts will handle up to 30 or 40 amps. This allows you to switch devices such as headlights, parking lights, horns, etc., with low amperage outputs such as those found on keyless entry and alarm systems, and other components. In some cases you may need to switch multiple things at the same time using one output.. A single output connected to multiple relays will allow you to open continuity and/or close continuity simultaneously on multiple wires. A relay is an electrically operated switch. Current flowing through the coil of the relay creates a magnetic field which attracts a lever and changes the switch contacts The coil current can be on or off so relays have two switch positions and most have double throw (changeover) switch contacts as shown in the diagram.

Relays allow one circuit to switch a second circuit which can be completely separate from the first. For example a low voltage battery circuit can use a relay to switch a 230V AC mains circuit There is no electrical connection inside the relay between the two circuits; the link is magnetic and mechanical The coil of a relay passes a relatively large current, typically 30mA for a 12V relay, but it can be as much as 100mA for relays designed to operate from lower voltages Most ICs (chips) cannot provide this current and a transistor is usually used to amplify the small IC current to the larger value required for the relay coil The maximum output current for the popular 555 timer IC is 200mA so these devices can supply relay coils directly without amplification. RELAY SELECTING AS A SWITCH:

There are three important features to consider when selecting a switch: Contacts (e.g. single pole, double throw) Ratings (maximum voltage and current) Method of Operation (toggle, slide, key etc.)

SWITCH CONTACTS: Several terms are used to describe switch contacts Pole - number of switch contact sets. Throw - number of conducting positions, single or double. Way - number of conducting positions, three or more. Momentary - switch returns to its normal position when released. Open - off position, contacts not conducting. Closed - on position, contacts conducting, there may be several on positions

For example: the simplest on-off switch has one set of contacts (single pole) and one switching position which conducts (single throw). The switch mechanism has two positions: open (off) and closed (on), but it is called 'single throw' because only one position conducts SWICH CONTACTS RATINGS: Switch contacts are rated with a maximum voltage and current, and there may be different ratings for AC and DC. The AC values are higher because the current falls to zero many times each second and an arc is less likely to form across the switch contacts. For low voltage electronics projects the voltage rating will not matter, but you may need to check the current rating.

the maximum current is less for inductive loads (coils and motors) because they cause more sparking at the contacts when switched off.

STANDARD SWITCHES:

(ON-OFF Single Pole, Single Throw = SPST) A simple on-off switch. This type can be used to switch the power supply to a circuit.When used with mains electricity this type of switch must be inthe live wire, but it is better to use a DPST switch to isolate both live and neutral. (ON-OFF Push-to-make = SPST Momentary) A push-to-make switch returns to its normally open (off) position when you release the button, this is shown by the brackets around ON. This is the standard doorbell switch ON-(OFF) Push-to-break = SPST Momentary A push-to-break switch returns to its normally closed (on) position when you release the button

(ON-ON Single Pole, Double Throw = SPDT) This switch can be on in both positions, switching on a separate device in each case. It is often called a changeover switch. For example, a SPDT switch can be used to switch on a red lamp in

one position and a green lamp in the other position. A SPDT toggle switch may be used as a simple on-off switch by

connecting to COM and one of the A or B terminals shown in the diagram. A and B are interchangeable so switches are usually not labeled. (ON-OFF-ON SPDT Centre Off) A special version of the standard SPDT switch. It has a third switching position in the centre which is off. Momentary (ON)-OFF-(ON) versions are also available where the switch returns to the central off position when released. (Dual ON-OFF Double Pole, Single Throw = DPST) A pair of on-off switches which operate together (shown by the dotted line in the circuit symbol). A DPST switch is often used to switch mains electricity because it can isolate both the live and neutral connections (Dual ON-ON Double Pole, Double Throw = DPDT) A pair of on-on switches which operate together (shown by the dotted line in the circuit symbol). A DPDT switch can be wired up as a reversing switch for a motor as shown in the diagram. (ON-OFF-ON DPDT Centre Off) A special version of the standard SPDT switch. It has a third switching position in the centre which is off. This can be very useful for motor control because you have forward, off and reverse positions. Momentary (ON)-OFF-(ON)

versions are also available where the switch returns to the central off position when released.

TYPES OF SWITCHS: Push-Push Switch (e.g. SPST = ON-OFF) This looks like a momentary action push switch but it is a standard on-off switch: push once to switch on, push again to switch off. This is called a latching action. Micro switch (usually SPDT = ON-ON) Micro switches are designed to switch fully open or closed in response to small movements. They are available with levers and rollers attached Keyswitch A key operated switch. The example shown is SPST. Tilt Switch (SPST) Tilt switches contain a conductive liquid and when tilted this bridges the contacts inside, closing the switch. They can be used as a sensor to detect the position of an object. Some tilt switches contain mercury which is poisonous. Reed Switch (usually SPST) The contacts of a reed switch are closed by bringing a small magnet near the switch. They are used in security circuits, for example to check that doors are closed. Standard reed switches are SPST (simple on-off) but SPDT (changeover) versions are also available. Choosing a relay You need to consider several features when choosing a relay:

1.Physical size and pin arrangement If you are choosing a relay for an existing PCB you will need to ensure that its dimensions arrangement are suitable. You should find this information in the supplier's catalogue and pin 2.Coil voltage

The relay's coil voltage rating and resistance must suit the circuit powering the relay coil. Many relays have a coil rated for a 12V supply but 5V and 24V relays are also readily available. Some relays operate perfectly well with a supply voltage which is a little lower than their rated value. 3.Coil resistance The circuit must be able to supply the current required by the relay coil. You can use Ohm's law to calculate the current: Relay coil current =supply voltage /coil resistance For example: A 12V supply relay with a coil resistance of 400 passes a current of 30mA. This is OK for a 555 timer IC (maximum output current 200mA), but it

is too much for most ICs and they will require a transistor to amplify the current. 4.Switch ratings (voltage and current) The relay's switch contacts must be suitable for the circuit they are to control. You will need to check the voltage and current ratings. Note that the voltage rating is usually higher for AC, for example: "5A at 24V DC or 125V AC". 5.Switch contact arrangement (SPDT, DPDT etc Most relays are SPDT or DPDT which are often described as "single pole changeover" (SPCO) or "double pole changeover" (DPCO). For further information please see the page on switches. Relays and transistors compared Like relays, transistors can be used as an electrically operated switch. For switching small DC currents (< 1A) at low voltage they are usually a better choice than a relay. transistors cannot switch AC (such as mains electricity) and in simple circuits they are not usually a good choice for switching large currents (> 5A). In these cases a relay will be needed, but note that a low power transistor may still be needed to switch the current for the relay's coil! The main advantages and disadvantages of relays are listed below: Advantages of relays: Relays can switch AC and DC, transistors can only switch DC. Relays can switch higher voltages than standard transistors. Relays are often a better choice for switching large currents (> 5A). Relays can switch many contacts at once

Disadvantages of relays: Relays are bulkier than transistors for switching small currents. Relays cannot switch rapidly (except reed relays), transistors can switch many times per second. Relays use more power due to the current flowing through their coil. Relays require more current than many ICs can provide, so a low power transistor may be needed to switch the current for the relay's coil. 4.7 Light Emitting Diode (LED) A light-emitting diode (LED) is a semiconductor diode that emits incoherent narrow spectrum light when electrically biased in the forward direction of the pn-junction, as in the common LED circuit. This effect is a form of electroluminescence While sending a message in the form of bits such as 1,the data is sent to the receiver side correspondingly the LED glows representing the data is being received simultaneously when we send 8 as a data the LED gets off .

+Ve

-Ve

As in the simple LED circuit, The effect is a form of electroluminescence where incoherent and narrow-spectrum light is emitted from the p-n junction. LEDs are widely used as indicator lights on electronic devices and increasingly in higher power applications such as flashlights and area lighting. An LED is usually a small area (less than 1 mm2) light source, often with optics added to the chip to shape its radiation pattern and assist in reflection. The color of the emitted light depends on the composition and condition of the semi conducting material used, and can be infrared, visible, or ultraviolet. Besides lighting, interesting applications include using UV-LEDs for sterilization of water and disinfection of devices, and as a grow light to enhance photosynthesis in plants.

## COLOR Vs P.D : Color Potential Difference

Infrared - 1.6 V Red Orange Yellow Green Blue White 1.8 V to 2.1 V 2.2 V 2.4v 2.6v 3.0v to 3.5v 3.0v to 3.5v

Ultraviolet 3.5v ADVANTAGES: LEDs have many advantages over other technologies like lasers. As compared to laser diodes or IR sources LEDs are conventional incandescent lamps. For one thing, they don't have a filament that will burn out, so they last much longer. Additionally, their small plastic bulb makes them a lot more durable. They also fit more easily into modern electronic circuits. The main advantage is efficiency. In conventional incandescent bulbs, the light-production process involves generating a lot of heat (the filament must be warmed). Unless you're using the lamp as a heater, because a huge portion of the available electricity isn't going toward producing

visible light. LEDs generate very little heat. A much higher percentage of the electrical power is going directly for generating light, which cuts down the electricity demands considerably.

LEDs offer advantages such as low cost and long service life. Moreover LEDs have very low power consumption and are easy to maintain.

DISADVANTAGES OF LEDS: LEDs performance largely depends on the ambient temperature of the operating environment. LEDs must be supplied with the correct current. LEDs do not approximate a "point source" of light, so cannot be used in applications needing a highly collimated beam. But the disadvantages are quite negligible as the negative properties of LEDs do not apply and the advantages far exceed the limitations. 5. TESTING PROCESS In this section we will check our all components so far used. We will also discuss about it working conditions, problems faced across its testing Testing of Power Supply To Design 5V, 500mA Power supply. 1. TRANSFORMER :

Here, AC mains 230V step down transformer is used. Hence, no. of turns in primary coil is more than in secondary coil. Since, it is step down transformer, so, it will reduce the voltage. Since, we cannot apply ideal transformer in practical uses. So, according to variations in input voltage, output voltage is calculated further. 2. RECTIFIER: Here, full wave bridge rectifier is used to convert AC to DC because four diodes are spent to make full wave bridge rectifier where two conduct on the positive half cycle, and the other two conduct on the negative half cycle. Hence, this said rectifier is used instead of half wave bridge rectifier. 1N4001 features: In our design we require voltage of 5V and current of 500mA, so from the following datasheet we can see that 4001 is giving us 50V as reverse voltage and rest are giving higher voltage which is not required, and also giving us sufficent current(1 amp) required by us.

VRRM=50v

If(AV)=1A Ifsm=30A Tj= -55 to +175c Low forward voltage drop High surge(sudden increment) current capability

3. CAPACITOR: For this design an electrolytic capacitor of value 470 F (calculated) is applied. This capacitor is applied for the smoothing purpose. We can use more than one capacitor but that is optional and based on our requirement. 4. REGULATOR: Voltage regulator is an electrical regulator designed to automatically maintain a constant voltage level.Now from the given datasheet we can see that we are obtaining 5V and current of 500mA fron this regulator. This (LM 7805) is most common voltage regulator that is still used in embedded designs. The features are listed below:Vo=4.8v to 5.2v Iq=5 to 8 mA LM78XX Series: 3-Terminal 1A positive voltage regulators Features: 1. Output current up to 1A 2. Output voltages of 5,6,8,9,10,12,15,18,24 3. Thermal overload protection 4. Short circuit protection 5. Output transistor safe operating area protection 6. Output voltage tolerance = 7. Operating temperature = -40 8. Input voltage range = 7V 20V

7. CONCLUSION We have carried on an investigation before we started the project to fnd out about various components. We have used RF transmitter, receiver in our project. A well regulated power supply was designed. This power supply produces 5V with 1 A current. A micro controller , AVR ATMega 8 was used in the system The operation of the mains switch is achieved with a remote. This micro is the latest and has advanced features. We have gained the design techniques We have developed testing skills We practiced the art of soldering. Finally, we thank the college and the university for providing us an excellent opportunity to transform our theoretical knowledge in to practical application We have gained the confidence to handle similar projects in the future.

8. REFERENCE 1.www.google.com 2.www.wikipedia.com Datasheet we referred: 1.Fairchild semiconductor/1N4001-1N4007 general purpose rectifiers 2.Fairchild semiconductor/LM78XX 3-terminal 1A positive voltage regulator 3.Atmel/ATmega8 Books we referred: 1.Analog Electronics, L.K Maheshwari, M.M.S Anand, Prentice-Hall of india pvt. Ltd., Third edition,. 2. Digital Design, M.Morris Mano, Prentice-Hall of india pvt. Ltd., Third edition. 3. Power Electronics hand book, Rashid, Third Edition.

Source Code:Source Code:#include<reg51.h> sfr rfr=0x90; sbit load1=P3^0; sbit load2=P3^1; sbit load3=P3^2; sbit load4=P3^3; unsigned int i; void main() { rfr=0x0F; // initialising as input port load1=0; // output pin load2=0; load3=0; load4=0; while(1) { if(rfr==0x0E) // checks if switch-1 is pressed or not { load1^='1'; for(i=0;i<50;i++); } else if(rfr==0x0D) { load2^='1'; for(i=0;i<50;i++); } //xor operation // checks if switch-2 is pressed or not //xor operation // output pin // output pin // output pin // super loop

## // checks if switch-3 is pressed or not

//xor operation

for(i=0;i<50;i++); } else if(rfr==0x07) { load4^='1'; for(i=0;i<50;i++); } //xor operation // checks if switch-4 is pressed or not

} }