www.final-yearproject.com PROJECT REPORT ON ANTISLEEP ALARM

Submitted as partial fulfilment of award of BACHELOR OF TECHNOLOGY DEGREE

Session 2011-2012

In ELECTRICAL AND ELECTRONICS ENGINEERING By ABHISHEK KUMAR 0819421001 KAMLESH KUMAR 0819421020 SATYAVIR SINGH 0719421048

Under guidance of : Miss. Niharika singh H. R. INSTITUTE OF TECHNOLOGY, GHAZIABAD

Estd. 2005 (AICTE Approved)

AFFILATED TO GAUTAM BUDDH TECHNICAL UNIVERSITY, LUCKNOW PROJECT REPORT ON ANTISLEEP ALARM

Submitted as partial fulfilment of award of

BACHELOR OF TECHNOLOGY DEGREE

Session 2011-2012

In ELECTRICAL AND ELECTRONICS ENGINEERING By ABHISHEK KUMAR 0819421001 Under guidance of : Miss. Niharika Singh

H. R. INSTITUTE OF TECHNOLOGY, GHAZIABAD

Estd. 2005 (AICTE Approved)

AFFILATED TO GAUTAM BUDDH TECHNICAL UNIVERSITY, LUCKNOW

DECLARATION

I hereby declare that the work being presented in this report entitled “ANTISLEEP ALARM” is an authentic record of my own work carried out under the supervision of “Miss. NIHARIKA SINGH ”. The matter embodied in this report has not been submitted by us for the award of any other degree.

Signature of student Date:......

(ABHISHEK KUMAR)

This is to certify above statement made by the candidate(s) is correct to the best of my knowledge.

Signature of HOD Signature of Supervisor

Sukhbir singh Niharika

Dept. Of E.N. Dept. Of E.N.

Date......

FRONT PIECE

ACKNOWLEDGEMENT

ACKNOWLEDGEMENT

This is the reflection i am showing to reveal the sense of regard and reverence we are having

for our HOD Mr. Sukhbir singh , for appointing the projectchosen by us and for his

invaluable inspiration and motivation which help us to successfully complete the project.

Our sincere thanks to our project guide Miss. Niharika singh who gave his invaluable

time for selection of project and suggestion for the successful completion of project. Without

his suggestion and motivating ideas it would have been difficult to complete the project.

We would like to give our heartiest gratitude to all the faculty members and staffs who impared us invaluable knowledge till now which helped us to complete our project successfully.

At last but not the least we wouldlike to give our special thanks to our colleagues who helped us and when required . They have given their great support and effort both physically and mentally for the completion of our project.

ABHISHEK KUMAR

TABLE OF CONTENTS

Acknowledgement 1

Abstract 4

Project summary 5

List of Figures 6

1. Introduction 7 2. Review of literature 9 2.1 11 2.1.1 Family of microcontrollers 12 2.1.2 AVR family 13 2.1.3 PIN diagram 14 2.1.4 Data sheetof atmega 16 15 2.1.5 Pin description 18 2.2 Automatic control board 20 2.2.1 LCD 21 2.2.1a Types & characteristics of LCD 23 2.2.1b connections of LCD 25 2.2.1c Syntax of LCD 26

2.2.2 LED 27

2.3 Programming in BASCOM 28

2.3.1 Main syntax 28

2.4 Home Automation using 34

2.4.1 Power supply section 35

2.4.2 Microcontroller supply section 35

2.4.3 IR sensor 36

2.4.4 Home Automation Supply section 37

2.4.4a Darlington Transistor TIP122 37

2.4.4b Optocoupler 817a 39 2.4.4c Relay 40

2.4.4d Transformer 44

2.4.4e capacitors 45

2.4.4f Diode 46

2.4.4gTransistors 48

2.4.4h Resistor 49

3. Methodology of Design 51

3.1 Flow Chart 51

3.2 Block Diagram 53

3.3 Power Supply Circuit Designing 54

3.4 Circuit diagram of Control Board 56

4. Results and Discussion 57

4.1 Result 57

4.2 Analysis 58

5. Application 59

6. Conclusion 60

List of references 61

ABSTRACT

ABSTRACT

This report presents the development of IR SENSOR based control home appliances for smart home system. The main aim of the prototype development is to reduce electricity wastage. IR sensor module was used for receiving singnals regarding entry and exit of persons and automatically enable the controller to take any further action such as to switch ON and OFF the home appliances such as light, air-conditioner etc. The system is integrated with microcontroller, home automation and IR sensor interface using BASIC language. BASSCOM software was utilized to accomplish the integration. The system is activated when user enters the room and IR sensor sends signal to controller at home.

Upon receiving the Sensor command, the microcontro ller unit then au tomatically controls the electrical home appliances by switching ON or OFF the device according to the user order. to the received message. The prototype has been successfully developed and it could provide an effective mechanism in utilizing the energy source efficiently. The

System is basically designed for students in order to make them awake and also if they are slept, than to save energy by automatically closing fans and lights This paper mainly focuses on the controlling of home appliances automattically and providing security when the user is slept or not in the room. This system provides ideal solution to the problems faced by home owners in daily life. The system uses automatic controlling thus providing ubiquitous access to the system for security and automated appliance control.

PROJECT SUMMARY

PROJECT SUMMARY

Organization : H.R.I.T., Ghaziabad

Platform : Windows 7

Language : Basic

Guide : Mr. Kumar Garvit

COO, Nextsapiens, Noida.

Project Co-ordinator : MISS. NIHARIKA SINGH

Lecturer,

H.R.I.T., Ghaziabad

ACRONYMS

LIST OF FIGURES

 Fig a,b, &d Antisleep Alarm Prototype, Microcontroller Board, Atmega16, LCD, Home Automation  Fig. 2.1 Atmega32 Microcontroller (AVR Family)  Fig2.1 .2a Pin Diagram o f Atmega16 Microcontroller  Fig 2.2.1a 16*2 LCD  Fig 2.2.1b Working of an LCD  Fig 2.2.2 Light Emitting Diode  Fig 2.4 A Home Automation using Microcontroller  Fig 2.4.2 an Atmeg16 Microcontroller Board  2.4.3a IR Sensor  2.4.3b Basic design of IR senso  Fig 2.4.4 A Home Automation Board  Fig 2.4.4a Circuit Diagram of Darlington Transistors & TIP122  Fig 2.4.4b 4pin Optocoupler 817 a  Fig2.4.4c Relay  Fig 2.4.4c1 Schematic of types of Relays  Fig.2.4.4d Transforme  Fig.2.4.4e Types of capacitors  Fig. 2.4.4f PN junction diodes  Fig.2.4.4g types of capacitors  Fig.2.4.4h Types of Resistors  Fig 3.1 Flow Chart showing the working of the prototype  Fig 3.2 Block Diagram of the system  Fig3.4: complete controller board ckt diag.

INTRODUCTION

CHAPTER I

INTRODUCTION

The development of digital information has led the rapid change in human lifestyle. The use of electricity is very important as one of the main source of energy that is vital in today modern life. Some kinds of mechanism using available technology could be used to reduce wastage in electricity usage. Thus a prototype based on a microcontroller device using SMS is developed. It can automatically control any electrical equipment at home remotely using sensing of person. Hence the electrical energy saving in daily life can be made more efficient and effective. As the technology grows automatic controlling has been widely accepted as a part of operation. The purpose of using automatic control is to provide widest coverage at minimal cost. Therefore the use of prototype would facilitate in controlling the electrical device at home from without switching on and off of device and low in maintenance and independent from any physical geographical boundary. At the present time, people use electrical energy as one of the main source of power of energy to operate any electrical device or appliance. Most of the people turn on the light and forget to switch off and may go for so many days to out of station. Leaving the light turned on continuously, lead to energy

Waste . Thus this project is proposed to develop a system is to facilitate the home owner to optimize usage of electricity automattically. Light turned on continuously and it leads to energy waste. Thus this research is carried out to provide a mechanism through the development of a prototype to provide a service to the home owner to optimize the usage of electricity through remote control using automatic sensor controlled services. The motivation is to facilitate the users to automate their homes having ubiquitous access. The system provides availability due to development of a low cost system. The home appliances control system with an affordable cost was thought to be built that should be mobile providing remote access to the appliances and allowing home security.

The followings are the objectives of the research project to ensure it meets the aim.

 To design a lamp and extension control system for smart home application using

automatic systems.

 To design a circuit that can automatically switch ON and OFF the home

appliance using Automation Board,

 To write a program that can send the IR sensor signal using in

BASSCOM software.

 Chapter 2 gives a brief about the projects based on IR sensor which have been done in

past and what they comprised of. This chapter also gives a detailed description of the

components used in the projects, their description along with a clear understanding of

the programming commands that have been used.

 Chapter 3 highlights the flowcharts and diagram related to the projects working and

also a view of the systems working.

 Chapter 4 discusses the results & analysis of the project prototype

 Chapter 5 gives you the main conclusion which also includes the drawbacks involved

in the system that can be rectified.

REVIEW OF LITERATURE CHAPTER 2 REVIEW OF LITERATURE

This section provides a previous study of related work regarding the application of

AUTOMATIC control of devices in a various fields. Some previous researches have been studied to gain more information about current existing automatic control system that was previously implemented. It is necessary to know and understand how the software and hardware were used in the automatic controlled system development. This is to ensure that the study that currently being conducted contribute at certain level of application thus it become more efficient and practical. Several smart projects such as Home Security with

System, Security & Control System , water level indicators, electrical panels for motors operation , etc. that were designed using sensors to securely monitor the device when operators or users are not at the place. A system as suggested by prototype is triggered by breaking of IR sensor to serve the facility of appliance if any has entered in the room. The system work accordingly when the sensor actively triggered by any abnormal activity, then the controller circuit also automatically activate the automation to control the lights or fans of the room . Another system of automatic security and control system contains a entry lock at door which contails a card no for all the users of the home or offices . If any one want to enter has to first puch the card and if it matches than only he will be able to enter the room other wise his attempt will be continuously rejected. All the message will be send to server to notify that any unauthorised person is entering the office. Also some systems are used will fingure prints control in which if any unauthorised figure is sensed by the sensor it blows a alarm and security guards cna check the person identity. Another system i.e. water level indicators has magnetic sensors embedded inside the water tank at fixed level and these sensors show the level of water in the system designed and also according to level defined, it switches on the motors when the level goes to minimum and switches off the motor when level is at maximum. Also a system comes for the water supply in which pressure sensors are used to check whether the water is in the supply line or not, if the water is in line it will switch on the motor. As this one is embedded with a manually controlled timer so if water is not coming than it will off the motor and check for water after few minutes or hours as pre- defined. Another system i.e. automatic electrical panels uses several electrical devices like preventor, relay, contactor, MCB, MCCB to control the overcurrents, over voltages etc. In these basic is preventor checks the availability of correct three phase supply and than send the signal to contactor in order to energise its coil and switch on the motor. The contactor checks for the overcurrents with overload relay and break the supply. The MCB or main circuit breaker senses any short circuit and breaks the main supply to the cicuit. Hence ,

Various sensors can be used in several fashions in order to control the operations and make them automatic in order to save energy and save the appliance from any harmful effect.

2.1 MICROCONTROLLER

Fig. 2.1 Atmega32 Microcontroller

A microcontroller (sometimes abbreviated µC, uC or MCU) is a small computer on a single

integrated circuit containing a processor core, memory, and programmable input/output peripherals. Program memory in the form of NOR flash or OTP ROM is also often included on chip, as well as a typically small amount of RAM. Microcontrollers are designed for embedded applications, in contrast to the used in personal computers or other general purpose applications. Microcontrollers are used in automatically controlled products and devices, such as automobile engine control systems, implantable medical devices, remote controls, office machines, appliances, power tools, toys and other embedded systems. By reducing the size and cost compared to a design that uses a separate , memory, and input/output devices, microcontrollers make it economical to digitally control even more devices and processes. Mixed signal microcontrollers are common, integrating analog components needed to control nondigital electronic systems.

2.1.1 Family of Microcontrollers

As of 2008 there are several dozen microcontroller architectures and vendors

including:

 ARM core processors (from many vendors)

 Atmel AVR (8-bit), AVR32 (32-bit), and AT91SAM (32-bit)

 Cypress Semiconductor PSoC (Programmable System-on-Chip)

 Freescale Cold Fire (32-bit) and S08 (8-bit)

 Freescale 68HC11 (8-bit)



 Infineon: 8, 16, 32 Bit microcontrollers

 MIPS

 Microchip Technology PIC, (8-bit PIC16, PIC18, 16-bit dsPIC33 / PIC24),

(32-bit PIC32)

 NXP Semiconductors LPC1000, LPC2000, LPC3000, LPC4000 (32-bit), LPC900,

LPC700 (8-bit)



 PowerPC ISE

 (8-bit)

 Renesas RX, , Hitachi H8, Hitachi SuperH (32-bit), M16C (16-bit), RL78, ,

 78K0/78K0R (8-bit)

 Silicon Laboratories Pipelined 8051 Microcontrollers

 STMicroelectronics ST8 (8-bit), ST10 (16-bit) and STM32 (32-bit)

 Texas Instruments TI MSP430 (16-bit)

 Toshiba TLCS-870 (8-bit/16-bit).

2.1.2 AVR FAMILY

The AVR is a modified Harvard architecture 8-bit RISC single chip microcontroller which was developed by Atmel in 1996. The AVR was one of the first microcontroller families to use onchip for program storage, as opposed to one-time programmable ROM,

EPROM, or EEPROM used by other microcontrollers at the time. ATmega16 is an 8-bit high

performance microcontroller of Atmel’s Mega AVR family with low power consumption.

Atmega16 is based on enhanced RISC (Reduced Instruction Set Computing) architecture with 131 powerful instructions. Most of the instructions execute in one machine cycle.

Atmega16 can work on a maximum frequency of 16MHz. ATmega16 has 16 KB programmable flash memory, static RAM of 1 KB and EEPROM of 512 Bytes. The endurance cycle of flash memory and EEPROM is 10,000 and 100,000, respectively.

ATmega16 is a 40 pin microcontroller. There are 32 I/O (input/output) lines which are divided into four 8-bit ports designated as PORTA, PORTB, PORTC and PORTD.

ATmega16 has various in-built peripherals like USART, ADC, Analog Comparator, SPI,

JTAG etc. Each I/O pin has an alternative task related to inbuilt peripherals. The following table shows the pin description of ATmega16.

2.1.2a Pin Diagram of Atmega16

Fig2.1 .2a Pin Diagram o f Atmega16 Microcontroller

2.1.3 DATA sheet of Atmega16

High-performance, Low-power AVR® 8-bit Microcontroller

• Advanced RISC Architecture

– 131 Powerful Instructions – Most Single-clock Cycle Execution

– 32 x 8 General Purpose Working Registers

– Fully Static Operation

– Up to 16 MIPS Throughput at 16 MHz

– On-chip 2-cycle Multiplier

• Nonvolatile Program and Data Memories

– 16K Bytes of In-System Self-Programmable Flash

Endurance: 10,000 Write/Erase Cycles

– Optional Boot Code Section with Independent Lock Bits

In-System Programming by On-chip Boot Program

True Read-While-Write Operation

– 512 Bytes EEPROM

Endurance: 100,000 Write/Erase Cycles

– 1K Byte Internal SRAM

– Programming Lock for Software Security

• JTAG (IEEE std. 1149.1 Compliant) Interface

– Boundary-scan Capabilities According to the JTAG Standard

– Extensive On-chip Debug Support

– Programming of Flash, EEPROM, Fuses, and Lock Bits through the JTAG Interface

• Peripheral Features

– Two 8-bit Timer/Counters with Separate Prescalers and Compare Modes

– One 16-bit Timer/Counter with Separate Prescaler, Compare Mode, and Capture

Mode

– Real Time Counter with Separate Oscillator

– Four PWM Channels

– 8-channel, 10-bit ADC

8 Single-ended Channels

7 Differential Channels in TQFP Package Only

2 Differential Channels with Programmable Gain at 1x, 10x, or 200x

– Byte-oriented Two-wire Serial Interface

– Programmable Serial USART

– Master/Slave SPI Serial Interface

– Programmable with Separate On-chip Oscillator

– On-chip Analog Comparator

• Special Microcontroller Features

– Power-on Reset and Programmable Brown-out Detection – Internal Calibrated RC Oscillator

– External and Internal Sources

– Six Sleep Modes: Idle, ADC Noise Reduction, Power-save, Power-down, Standby and Extended Standby

• I/O and Packages

– 32 Programmable I/O Lines

– 40-pin PDIP, 44-lead TQFP, and 44-pad QFN/MLF

• Operating Voltages

– 2.7 - 5.5V for ATmega16L

– 4.5 - 5.5V for ATmega16

• Speed Grades

– 0 - 8 MHz for ATmega16L

– 0 - 16 MHz for ATmega16 • Power Consumption @ 1 MHz, 3V, and 25°C for ATmega16L

– Active: 1.1 mA

– Idle Mode: 0.35 mA

– Power-down Mode: < 1 µA

2.1.4 Pin Description of Atmega16

Pin no Pin name Description Alternate function

1 (XCK/T0) I/O PORTB, Pin0 T0: Timer0 External counter input PB0 XCK: USART External clock I/O

2 (TI) PB1 I/O PORTB, PIN1 T1:Timer1 External Counter Input

3 (INT2/AIN0) I/0 PORTB,PIN2 AIN0: Analog Comparator Positive PB2 I/P INT2: External Interrupt 2 Input 4 (OC0/AIN1) I/O PORTB, PIN3 AIN1: Analog Comparator Negative PB3 I/P OC0 : Timer0 Output Compare Match output

5 (SS) PB4 I/O PORTB, PIN4

6 (MOSI) PB5 I/0 PORTB, PIN5 In System Programmer (ISP) 7 (MISO) PB6 I/O PORTB, PIN7 Serial Peripheral Interface (SPI)

8 (SCK) PB7 I/O PORTB,PIN7

9 RESET Reset pin, Active low reset 10 VCC Vcc = +5v

11 GND Ground

12 XTAL2 Output to inverting Oscillating Amplifier

13 XTAL1 Input to inverting oscillating Amplifier

14 (RXD)PD0 I/O PORTD,PIN0 USART Serial Communication 15 (TXD)PD1 I/O PORTD, PIN1 Interface

16 (INT0)PD2 I/O PORTD,PIN2 External Interrupt INT0

17 (INT1)PD1 I/O PORTD,PIN3 External Interrupt INT1

18 (OC1B)PD4 I/O PORTD, PIN4 PWM Channel Outputs

19 (OC1A) PD5 I/O PORTD,PIN5

20 (ICP)PD6 I/O PORTD, Pin 6 Timer/Counter1 Input Capture Pin

21 (OC2)PD7 I/O PORTD, Pin 7 Timer/Counter2 Output Compare Match Output 22 (SCL)PC0 I/O PORTC, Pin 0 TWI Interface 23 (SDA)PC1 I/O PORTC, Pin 1

24 (TCK)PC2 I/O PORTC, Pin 2

25 (TMS)PC3 I/O PORTC, Pin 3

26 (TDO)PC4 I/O PORTC, Pin 4 JTAG Interface

27 (TDI)PC5 I/O PORTC, Pin 5

28 (TOSC1)PC6 I/O PORTC, Pin 6 Timer Oscillator Pin 1

29 PC7(TOSC2) I/O PORTC, Pin 7 Timer Oscillator Pin 2

30 AVcc Voltage Supply = Vcc for ADC

31 GND GROUND

32 AREF Analog Reference Pin for ADC

33 PA7 (ADC7) I/O PORTA, Pin 7 ADC Channel 7

34 PA6 (ADC6) I/O PORTA, Pin 6 ADC Channel 6

35 PA5 (ADC5) I/O PORTA, Pin 5 ADC Channel 5

36 PA4 (ADC4) I/O PORTA, Pin 4 ADC Channel 4

37 PA3 (ADC3) I/O PORTA, Pin 3 ADC Channel 3

38 PA2 (ADC2) I/O PORTA, Pin 2 ADC Channel 2

39 PA1 (ADC1) I/O PORTA, Pin 1 ADC Channel 1

40 PA0 (ADC0) I/O PORTA, Pin 0 ADC Channel 0

2.2 AUTOMATIC CONTROL BOARD

Features:

• 40 Pin Atmel ATmega16microcontroller with internal system clock upto 8 MHz and externally upto 16 MHz

• 16 KB Flash RAM memory for programs

• 1 KB of SRAM

• 512 of EEPROM

• One 6x1 Pin SPI Relimate Header

• Eight 3x1 Pin Relimate header inputs for 8 analog sensors

• One 16 Pin header to connect 16*2 alphanumeric LCD

• Two onboard L293D drivers for motors (upto 600 mA per channel)

• Dual 7805 Voltage regulator

• Dual power input options (Through molex connector or through DC Jack)

• Two programmable Micro-Switches

• Two programmable LEDs

• Two DPDT switches (one for power on/off and one for reset)

• MAX 232 Level shifter for RS232 communication

• One 3x1 Pin relimate header for RS2332 communication

• Four 8 Pin bergistick headers (male) from each port of ATmega16/32

• Wide input power range from 7 volts to 24 volts at 1.5-2 Amps

• Board size of 6 x 3 inches, designed for educational and hobby purpose, on high quality PCB

2.2.1 LCD

Fig 2.2.1a 16*2 LCD

LCD is Liquid Crystal Display that uses the light modulating properties of liquid crystals.

LCD displays utilize two sheets of polarizing material with a liquid crystal solution between them. An electric current passed through the liquid causes the crystals to align so that light cannot pass through them. Each crystal, therefore, is like a shutter, either allowing light to pass through or blocking the light. An LCD monitor consists of five layers: a backlight, a sheet of polarized glass, a "mask" of pixels, a layer of liquid crystal solution responsive to a wired grid of x, y coordinates, and a second polarized sheet of glass. By manipulating the orientations of crystals through precise electrical charges of varying degrees and voltages, the crystals act like tiny shutters, opening orclosing in response to the stimulus, thereby allowing degrees of light that have passed through specific colored pixels to illuminate the screen, creating a picture.Each pixel of an LCD typically consists of a layer of molecules aligned between two transparent electrodes, and two polarizing filters, the axes of transmission of which are (inmost of the cases) perpendicular to each other. With no actual liquid crystal between thepolarizing filters, light passing through the first filter would be blocked by the second (crossed) polarizer. The surface of the electrodes that are in contact with the liquid crystal material are treated so as to align the liquid crystal molecules in a particular direction. This treatment typically consists of a thin polymer layer that is unidirectionally rubbed using, for example, a cloth. The direction of the liquid crystal alignment is then defined by the direction of rubbing. Electrodes are made of a transparent conductor called

Indium (ITO). The Liquid Crystal Display is intrinsically a “passive” device; it is a simple light valve. The managing and control of the data to be displayed is performed by one or more circuits commonly denoted as LCD drivers. [2] Before applying an electric field, the orientation of the liquid crystal molecules is determined by the alignment at the surfaces of electrodes. In a twisted nematic device (still the most common liquid crystal 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 reduces the rotation of the polarization of the incident light, and the device appears grey. 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 appliedacross the liquid crystal layer in each pixel, light can be allowed to pass through in varying amounts thus constituting different levels of gray. The optical effect of a twisted nematic 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, these devices are usually operated between crossed polarizers such that they appear bright with no voltage (the eye is much more sensitive to variations in the dark state than the bright state). These devices can also be operated between parallel polarizers, in which case the bright and dark states are reversed. The voltage-off dark state in this configuration appears blotchy, however, because of small variations of thickness across the device. 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)

Fig 2.2.1b Working of an LCD

2.2.1a TYPES OF LCD’S:

There are mainly two types of LCD • Passive Display

• Active display

Passive Display - Passive displays are widely used with segmented digits and characters for small readouts in devices such as calculators, fax machines and remote controls, most of which are monochrome or have only a few colors

Active Display - Used in all LCD TVs and desktop computer monitors and 99.9% of all laptops, active displays are essentially "active matrix" displays and almost always color. The reason for the 99.9% is that OLED is emerging.

CHARACTERISTICS OF LCD:

Here by 16*2 we mean that there are 16 characters can be displayed in one line and 2 means there are 2 lines in our display.

Features of 16*2 character LCD-

• 5 x 8 dots with cursor

• Built-in controller (KS 0066 or Equivalent)

• + 5V power supply (Also available for + 3V)

• 1/16 duty cycle

• B/L to be driven by pin 1, pin 2 or pin 15, pin 16 or A.K (LED)

• N.V. optional for + 3V power supply

2.2.1b Connections of LCD:

Pin 1 of LCD to ground.

Pin 2 of LCD to Vcc (5V).

Pin 3 of LCD to ground.

Pin 4 of LCD to PortB.2 (2nd pin of port B)

Pin 5 of LCD to ground.

Pin 6 of LCD to PortB.3.

Pin 7-10 are left floating (open).

Pin 11 of LCD to PortB.4.

Pin 12 of LCD to PortB.5.

Pin 13 of LCD to PortB.6.

Pin 14 of LCD to PortB.7.

Pin 15 of LCD to Vcc (5V).

Pin 16 of LCD to ground.

2.2.1c Syntax for Configuring LCD:

CONFIG LCD = LCD_type

CONFIG LCDPIN = PIN, DB4= PN,DB5=PN, DB6=PN, DB7=PN, E=PN,

RS=PN

LCD_type – It is the type of LCD you want to configure. It can be: 40 * 4, 16 *

1, 16 * 2, 16 * 4,16 * 4, 20 * 2 or 20 * 4 or 16 * 1a or 20*4A.

Config Lcdpin - Override the LCD-PIN select options.

Now to configure our 16*2 alphanumeric LCD we use the following command:-

Config LCD = 16*2

Config Lcdpin = Pin, Db4 = PortB.4, Db5 = PortB.5, Db6 = PortB.6,

Db7 = PortB.7, E= PortB.3 , Rs = PortB.2

2.2.2 LED

A light-emitting diode (LED) is a semiconductor light source. When a light forward biased

(switched on), electrons are able to recombine with electron holes within the device, releasing energy in the form of photons.

Fig 2.2.2 Light Emitting Diode

2.3 PROGRAMMING IN BASSCOM

2.3.1 MAIN SYNTAX

• $regfile = "m16def.dat"

(It refers to the name of register file. The register files are stored in the BASCOM-

AVR application directory with .DAT extension.) The register file holds information

about the chip such as the internal registers and addresses. Since we are

using Atmega16 Microcontroller, we

will define $regfile= “m16def.dat”)

• $crystal = 1000000

(1000000 is 1 MHz frequency that a user can set freely for the microcontroller. It

defines the clock speed at which you want to run your microcontroller. )

• Config LCD = 16 * 2

(It is the type of LCD you want to configure. It can be: 40 * 4, 16 * 1, 16 * 2, 16 * 4,

16 * 4, 20 *2 or 20 * 4 or 16 * 1a or 20*4A.16*2 is the LCD type which means this

LCD prints 16 characters per two lines.)

• Config Lcdpin = Pin, Db4 = PortB.4, Db5 = PortB.5, Db6 = PortB.6, Db7 = PortB.7, E = PortB.3, Rs = PortB.2

(This line gives a description about the LCD pin connections with the Microcontroller Ports.)

• Config ADC = Single, Prescaler = Auto, Reference = AVcc

(ADC – It defines the Running mode. Its value is SINGLE.

PRESCALER - A numeric constant for the clock divider. Use AUTO to let the

generate the best value depending on the XTAL.

REFERENCE - Some chips like the M163 have additional reference options. Its

value may be OFF , AVCC or INTERNAL. Single means instructing the ADC to

fetch the value only when its asked to.“Auto” means that the ADC can automatically

set its frequency in regard with the microcontroller frequency in the program.

Reference is set as AVcc because Aref voltage is referred from the voltage supply to

the ADC’s i.e. AVcc. )

• Start ADC

(StartAdc id=s the command given to initialize the ADCs.)

• Config Timer1 = Pwm, Pwm = 8 , Prescale = 1 ,Compare A Pwm = Clear

Down ,Compare B Pwm = Clear Down

(We use PWM to control the motor speed which is of 8 bit that is why we

set PWM= 8, PWMworks on the same frequency as the Microcontroller,

and the Channels A & B are set as cleardown to vary the speeds from 0

to 255 in increasing order.)

• StartTimer1

(StartTimer1 is used to start the PWM channels.)

• DEFINING VARIABLES

SYNTAX:

DIM (var) as type Var- Name of Variable

Type - Bit, Byte, Word, Integer, Long, Single, Double or String

Example:

Dim A as Integer

Dim B as String * 8

First statement is defining A variable as integer and second one is defining B variable as String of 8 characters long. Other than Integer and String there are many data types available inBASCOM.

• START & CLEAR COMMANDS

Start Command: This command is use to start the specified device.

Syntax:

START device

Device - TIMER0, TIMER1, COUNTER0 or COUNTER1, WATCHDOG, AC

(Analog comparator power) or ADC (A/D converter power)

Example – Start ADC

CLS Command: Clear the LCD display and set the cursor to home.

Syntax/ Example – Cls

• LOOPS

If – Else statement, Loops and Select – case statement

BASCOM allows using all types of loops in the program like do, while and for.

Concept of using these loops is same as using them in other languages like C.

Given below are syntaxes of all loops you can use in BASCOM –

1. Do Loop

Do

Loop

2. If – else statement

If (condition) then

Else

Endif

• GETADC COMMAND

This command is used to take input from the analog sensor connected to the development board. This command retrieves the analog value from channel 0-7 of port A. The range of analog value is from 0 to 1023.

Syntax: var = GETADC (channel [, offset])

Var- The variable in which the value will be stored. Channel – It is the pin no of port A to which analog sensor is connected.

Offset – It is an optional numeric variable that specifies gain or mode.

Example

L = Getadc (2)

Here, in above example, the analog value of the input provided by the sensor connected to pin 2 of port A is stored in variable L.

• LCD COMMAND

It is used to display a constant or variable on LCD screen.

SYNTAX:

LCD x

X - Variable or constant to be displayed on LCD

For displaying string / text, Use LCD “text”

For displaying variable, Use LCD A (A refers to the variable)

For displaying text/variable in next line, we use command LOWERLINE

Example

LCD A; “hello”

Lowerline LCD “Nextsapiens”

Output on LCD will be:

“Value of Variable A”, Hello

Nextsapiens

• WAITMS & PWMXX COMMAND

Waitms command : Suspends program execution for a given time in mS.

Syntax

WAITMS mS

Ms- The number of milliseconds to wait. (1-65535)

Example: Waitms 200

PWMXX command: It is used to set the speed of motor.

Syntax

PwmXX = value

XX- it is the channel of a motor

Value – any integer value ranging from 0 to maximum speed .

Example

Pwm1a = 180

• PORTX.Y COMMAND

PORTX.y command: it is used to set the direction of the motor Syntax

PORTX.y = value

X.y - ‘X’ as port number and ‘y’ as pin number

Value - 0 for clock rotation and 1 for anti clock rotation

Example:

PortD.3 = 1

2.4 HOME AUTOMATION USING MICROCONTROLER

Fig 2.4 Home Automation Using Microcontroller

The Home Automation System with IR Module is a device that helps you to operate your electrical appliances simply by breaking of IR sensors signal. The device is easy to operate and provides you with features like, switching on/ off the device and regulating the time period of the operation. Also the Device updates you with notifications via messages whenever an operation takes place.The device comprises of four sections:

1. Power Supply Section

2. Microcontroller Section

3. IR sensor Section

4. Home Automation Section

2.4.1 POWER SUPPLY SECTION:

The power supply is obtained by the 230volts AC home supply. The supply is fed to a transformer and a part of it is bifurcated to the home automation circuit which is connected to the relay. The supply fed to the transformer is stepped down to 12 volts, which is further divided into two parts for Microcontroller and Home Automation Circuitry. The power supply section also converts the alternating current into direct current.

2.4.2 MICROCONTROLLER SUPPLY SECTION:

The Microcontroller has Voltage Regulator IC 7805 which converts the 12 volts supply to 5 volts.

Fig 2.4.2 an Atmeg16 Microcontroller Board

2.4.3 IR SENSOR SECTION:

2.4.3a IR Sensors

A sensor (also called detector) is a device that measures a physical quantity and converts it into a signal which can be read by an observer or by an instrument. For example, a mercury-in-glass thermometer converts the measured temperature into expansion and contraction of a liquid which can be read on a calibrated glass tube. A thermocouple converts temperature to an output voltage which can be read by a voltmeter. For accuracy, most sensors are calibrated against known standards.

2.4.3b Basic design of IR sensor

All objects above absolute zero emit energy in the form of radiation. Usually infrared radiation is invisible to the human eye but can be detected by electronic devices designed for such a purpose. The term passive in this instance means that the PIR device does not emit an infrared beam but merely passively accepts incoming infrared radiation. “Infra” meaning below our ability to detect it visually, and “Red” because this color represents the lowest energy level that our eyes can sense before it becomes invisible. Thus, infrared means below the energy level of the color red, and applies to many sources of invisible energy

2.4.4 HOME AUTOMATION SUPPLY SECTION:

Fig 2.4.4 A Home Automation Board

All the sections work on 12 volts but the home automation section requires 24 volts for its working. Therefore the 12 volts supply wire is cut into two parts which are then combined to give an output of 24volts. This supply is fed to a capacitor through a diode, so that the supply becomes uniform (without ripples). Home Automation Consists of the following:

2.4.4a DARLINGTON TRANSISTOR TIP122:

In electronics, the Darlington transistor (often called a Darlington pair) is a compound structure consisting of two bipolar transistors (either integrated or separated devices) connected in such a way that the current amplified by the first transistor is amplified further by the second one. Thisconfiguration gives a much higher current gain than each transistor taken separately and, in the case of integrated devices, can take less space than two individual transistors because they can use a shared collector. Integrated Darlington pairs come packaged singly in transistor packages or as an array of devices (usually eight) in an A

Darlington pair behaves like a single transistor with a high current gain

(approximately the product of the gains of the two transistors). In fact,integrated devices have three leads (B, C and E), broadly equivalent to those of a standard transistor.

A general relation between the compound current gain and the individual ga ins is given by:

.

If β1 and β2 are high enough (hundreds), this relation can be approximated with:

.

A typical modern device has a current gain of 1000 or more, so that only a small base current is needed to make the pair switch on. However, this high current gain comes several drawbacks.

Fig 2.4.4a Circ uit Diagram of Darlington Transistors & TIP122

2.4 .4b OPTOCOUPLERS

In electronics, an opto-isolator, also called an optocoupler, photocoupler, or optical isolator, is "an electronic device designed to transfer electrical signals by

utilizing light waves to provide coupling with electrical isolation between its input and output". The main purpose of an optoisolator is "to prevent high voltages or rapidly changing voltages on one side of the circuit from damaging components or distorting transmissions on the other side. Commercially available opto-isolators withstand input-to-output voltages up to 10 kV and voltage transients with speeds up to 10 kV/ µs. Phototransistor opto-isolators

Phototransistors are inherently slower than photodiodes. The earliest and the slowest but still common 4N35 opto-isolator, for example, has rise and fall times of 5 µs into a 100 Ohm load and its bandwidth is limited at around 10

kilohertz - sufficient for applications like electroencephalography or pulse- width motor control. Devices like PC-900 or 6N138 recommended in the original 1983 Musical Instrument Digital Interface specification allow digital data transfer speeds of tens of kilo Bauds. Phototransistors must be properly

biased and loaded to achieve their maximum speeds, for example, the 4N28 operates at up to 50 kHz with optimum bias and less than 4 kHz without it.

Design with transistor opto-isolators requires generous allowances for wide fluctuations of parameters found in commercially available devices. Such fluctuations may be destructive, for example, when an opto-isolator in the feedback loop of a DC-to-DC converter changes its transfer function and causes spurious oscillations, or when unexpected delays in opto-isolatorscause a short circuit through one side of an H-bridge. Manufacturers' datasheets typically list only worst-case values for critical parameters; actual devices surpass these worst-case estimates in an unpredictable fashion. Bob Pease observed that current transfer ratio in a batch of 4N28's can vary from 15% to more than

100%; the datasheet specified only a minimum of 10%.

Fig 2.4.4b 4pin Optocoupler 817a

Transistor beta in the same batch can vary from 300 to 3000, resulting in

10:1 variance in bandwidth.

Opto-isolators using field-effect transistors (FETs) as sensors are rare and, like vactrols, can be used as remote-controlled analog potentiometers provided that

the voltage across the FET's output terminal does not exceed a few hundred mV. Opto-FETs turn on without injecting switching charge in the output circuit, which is particularly useful in sample and hold circuits.

2.4.4c RELAY

A relay is an electrically operated switch. Many relays use an electromagnet to operate a switching mechanism mechanically, but other operating principles are also used. Relays are used where it is necessary to control a circuit by a low- power signal (with complete electrical isolation between control and controlled circuits), or where several circuits must be controlled by one signal.

Fig2.4.4c Relay A simple electromagnetic relay consists of a coil of wire surrounding a soft iron core, an

iron yoke which provides a low reluctance path for magnetic flux, a movable iron

armature, and one or more sets of contacts (there are two in the relay pictured). The

armature is hinged to the yoke and mechanically linked to one or more sets of moving

contacts. It is held in place by a spring so that when the relay is de-energized there is an air

gap in the magnetic circuit. In this condition, one of the two sets of contacts in the relay

pictured is closed, and the other set is open. Other relays may have more or fewer sets

of contacts depending on their function. The relay in the picture also has a wire connecting the armature to the yoke. This ensures continuity of the circuit between the

moving contacts on the armature, and the circuit track on the printed circuit board

(PCB) via the yoke, which is soldered to the PCB.

When an electric current is passed through the coil it generates a magnetic field that attracts the armature and the consequent movement of the movable contact(s) either makes or breaks (depending upon construction) a connection with a fixed contact. If the set of contacts was closed when the relay was de-energized, then the movement opens the contacts and breaks the connection, and vice versa if the contacts were open.

When the current to the coil is switched off, the armature is returned by a force, approximately half as strong as the magnetic force, to its relaxed position. Usually this force is provided by a spring, but gravity is also used commonly in industrial motor starters. Most relays are manufactured to operate quickly. In a low-voltage application this reduces noise; in a high voltage or current application it reduces arcing.

When the coil is energized with direct current, a diode is often placed across the coil to dissipate the energy from the collapsing magnetic field at deactivation, which would otherwise generate a voltage spike dangerous to semiconductor circuit components. Some automotive relays include a diode inside the relay case. Alternatively, a contact protection network consisting of a capacitor and resistor in series (snubber circuit) may absorb the surge. If the coil is designed to be energized with alternating current (AC), a small copper "shading ring" can be crimped to the end of the solenoid, creating a small out-of-phase current which increases the minimum pull on the armature during the AC cycle.

• TYPES OF RELAY

Since relays are switches, the terminology applied to switches is also applied to relays.

A relay will switch one or more poles, each of whose contacts can be thrown by energizing the coil in one of three ways:

• Normally-open (NO) contacts connect the circuit when the relay is activated; the

circuit is disconnected when the relay is inactive. It is also called a Form A

contact or "make" contact. NO contacts can also be distinguished as "early-make"

or NOEM, which means that the contacts will close before the button or switch is

fully engaged.

• Normally-closed (NC) contacts disconnect the circuit when the relay is activated;

the circuit is connected when the relay is inactive. It is also called a Form B

contact or "break" contact. NC contacts can also be distinguished as "late-break"

or NCLB, which means that the contacts will stay closed until the button or switch

is fully disengaged.

• Change-over (CO), or double-throw (DT), contacts control two circuits: one

normally- open contact and one normally-closed contact with a common terminal.

It is also called a Form C contact or "transfer" contact ("break before make").

If this type of contact utilizes”make before break" functionality, then it is called a

Form D contact.

The following designations are commonly encountered:

• SPST – Single Pole Single Throw. These have two terminals which can be

connected or disconnected. Including two for the coil, such a relay has four

terminals in total. It is ambiguous whether the pole is normally open or

normally closed. The terminology "SPNO" and "SPNC" is sometimes used to

resolve the ambiguity.

• SPDT – Single Pole Double Throw. A common terminal connects to either of two others.

Including two for the coil, such a relay has five terminals in total.

• DPST – Double Pole Single Throw. These have two pairs of terminals. Equivalent to two SPST switches or relays actuated by a single coil. Including two for the coil,

such a relay has six ter mi nals in total. The poles may be Form A or Form B (or one

of each).

• DPDT – Double Pole Double Throw. These have two rows of change-over terminals.

Equivalent to two SP DT switches or relays actuated by a single coil. Such a

relay has eight terminals, including the coil.

Pole and throw

SPST SPDT

DPST DPDT

Fig 2.4.4c Schematic of types of Relays

2.4.4d TRANSFORMER

A transformer is a device that transfers electrical energy from one circuit to another through inductively coupled conductors —the transformer's coils. A varying current in the first or primary winding creates a varying magnetic flux in the transformer's core and thus a varying magnetic field through the secondary winding. This varying magnetic field induces a varying electromotive force (EMF), or "voltage", in the secondary winding. This effe ct is called

inductive coupling.

If a load is connected to the secondary, current will flow in the secondary winding, and electrical energy will be transferferred from the primary circuit through the tranransformer to the load. In an ideal transformer, the in duced voltage in the secondary winding ( Vs) is in proportion to the primary voltage ( Vp) and is given by the ratio of the number of turns in the secondary (Ns) to the number of turns in the primary ( Np) as follows:

Fig.2.4.4d Transformer

By appropri ate selection of the ratio of turns, a transformer thus enables an alternating current

(AC) voltage to be "stepped up" by making Ns greater than Np, or "stepped down" by making

Ns less than Np. The windings are coils wound around a ferromagnetic core, ai r-core transformers being a notable exception.

Transformers range in size from a thumbnail -sized coupling transformer hidden inside a stage microphone to huge units weighing hundreds of tons used to interconnect portions of power grids. All operate on the same basic principles, although the range of designs is wide. While new technologies have eliminated the need for transformers in some electronic circuits, transformers are still found in nearly all electronic devices designed f or household ("mains") voltage. Transformers are essential for high -voltage electric power transmission, which makes long-distance transmission economically practical.

2.4.4e CAPACITOR

A capacitor (originally known as condenser) is a passive two-terminal electrical component

used to store energy in an electric field. The forms of practical capacitors vary widely, but all contain at least two electrical conductors separated by a dielectric (insulator); for example, one common construction consinsists of metal foils separated by a thin layer of insulating film. Capacitors are widely used as parts of electrical circuits in many common electrical devices.

When there is a potential difference (voltage) across the conductors, a static electric field develops across the dielectric, causing positive charge to collect on one plate and negative charge on the other plate. Energy is stored in the electrostatic field. An ideal capacitor is characterized by a single constant value, capacitance, measured in farads. This is the ratio of the electric charge on each conductor to the potential difference between them.

Fig.2.4.4e Types of capacitors

The capacitance is greatest when there is a narrow separation between large areas of conductor, hence capacitor conductors are often called "plates," referring to an early means of construction. In practice, the dielectric between the plates passes a small amount of leakage current and also has an electric field strength limit, resulting in a breakdown voltage, while the conductors and leads introduce an undesired inductance and resistance.

Capacitors are widely used in electronic circuits for blocking direct current while allowing alternating current to pass, in filter networks, for smoothing the output of power supplies, in the resonant circuits that tune radios to particular frequencies, in electric power transmission systems for stabilizing voltage and power flow, and for many other purposes.

2.4.4f DIODE

In electronics, a diode is a two-terminal electronic component with asymmetric transfer characteristic, with low (ideally zero) resistance to current flow in one direction, and high (ideally infinite) resistance in the other. A semiconductor diode, the most common type today, is a crystalline piece of semiconductor material with a p-n junction connected to two electrical terminals A vacuum tube diode, now rarely used except in some high-power technologies and by enthusiasts, is a vacuum tube with two electrodes, a plate (anode) and cathode.

Fig. 2.4.4f PN junction diodes

The most common function of a diode is to allow an electric current to pass in one direction

(called the diode's forward direction), while blocking current in the opposite direction (the reverse direction). Thus, the diode can be thought of as an electronic version of a check valve. This unidirectional behavior is called rectification, and is used to convert alternating current to direct current, including extraction of modulation from radio signals in radio receivers—these diodes are forms of rectifiers.

However, diodes can have more complicated behavior than this simple on–off action.

Semiconductor diodes do not begin conducting electricity until a certain threshold voltage is present in the forward direction (a state in which the diode is said to be forward-biased). The voltage drop across a forward-biased diode varies only a little with the current, and is a function of temperature; this effect can be used as a temperature sensor or voltage reference.

Semiconductor diodes' nonlinear current–voltage characteristic can be tailored by varying the semiconductor materials and introducing impurities into (doping) the materials

These are exploited in special purpose diodes that perform many different functions. For example, diodes are used to regulate voltage (Zener diodes), to protect circuits from high voltage surges (avalanche diodes), to electronically tune radio and TV receivers (varactor diodes), to generate radio frequency oscillations (tunnel diodes, Gunn diodes, IMPATT diodes), and to produce light (light emitting diodes). Tunnel diodes exhibit negative resistance, which makes them useful in some types of circuits.

Diodes were the first semiconductor electronic devices. The discovery of crystals rectifying abilities was made by German physicist Ferdinand Braun in 1874. The first semiconductor diodes, called cat's whisker diodes, developed around 1906, were made of mineral crystals such as galena. Today most diodes are made of silicon, but other semiconductors such as germanium are sometimes used.

2.4.4g TRANSISTOR

A transistor is a semiconductor device used to amplify and switch electronic signals and power. It is composed of a semiconductor material with at least three terminals for

connection to an external circuit. A voltage or current applied to one pair of the transistor's terminals changes the current flowing through another pair of terminals. Because the controlled (output) power can be higher than the controlling (input) power, a transistor can amplify a signal. Today, some transistors are packaged individually, but many more are found embedded in integrated circuits.

Fig2.4.4g types ofcapacitors

The transistor is the fundamental building block of modern electronic devices, and is ubiquitous in modern electronic systems. Following its development in the early 1950s the transistor revolutionized the field of electronics, and paved the way for smaller and cheaper radios, calculators, and computers, among other things.

2.4.4h RESISTOR

A resistor is a passive two-terminal electrical component that implements electrical resistance as a circuit element. The current through a resistor is in direct pro portion to the voltage across the resistor's terminals. Thus, the ratio of the voltage applied across a resistor's terminals to the intensity of current through the circuit is called resistance. This relation is represented by

Ohm's law:

where I is the current through the conductor in units of amperes, V is the potential difference measured across the conductor in units of volts, and R is the resistance of the conductor in units of ohms. More specifically, Ohm's law states that the R in this relation is constant, independent of the current. Resistors are common elements of electrical networks and electronic circuits and are ubiquitous in electronic equipment. Practical resistors can be made of various compounds and films, as well as resistance wire (wire made of a high -resistivity alloy, such as nickel-chrome). Resistors are also implemented within integrated circuits, particularly analog devices, and can also be integrated into hybrid and printed circuits.

Fig.2.4.4h Types of Resistors

The electrical functionality of a resistor is specified by its resistance: common commercial resistors are manufactured over a range of more than nine orders of magnitude. When specifying that resistance in an electronic design, the required precision of the resistance may require attention to the manufacturing tolerance of the chosen resistor, according to its specific application. The temperature coefficient of the resistance may also be of concern in some precision applications. Practical resistors are also specified as having a maximum power rating which must exceed the anticipated power dissipation of that resistor in a particular circuit: this is mainlyly of concern in power electronics applications.ns. Resistors with higher power ratings are physically larger and may require heat sinks. In a high-voltage circuit, attention must sometimes be paid to the rated maximum working voltage of the resistor.

Practical resistors have a series inductance and a small parallel capacitance; these specifications can be important in high-frequency applications. In a low-noise amplifier or pre-amp, the noise characteristics of a resistor may be an issue. The unwanted inductance, excess noise, and temperature coefficient are mainly dependent on the technology used in manufacturing the resistor. They are not normally specified individually for a particular family of resistors manufactured using a particular technology. [1] A family of discrete resistors is also characterized according to its form factor, that is, the size of the device and the position of its leads (or terminals) which is relevant in the practical manufacturing of circuits using them.

METHODOLGY OF DESIGN

CHAPTER 3 MEHTODOLOGY OF DESIGN

3.1 FLOW CHART

Fig 3.1 Flow Chart showing the working of the prototype

3.2 BLOCK DIAGRAM

• Sensors break when a person Enters or Exit • Sensor generate a numeric code and sends to Microcontroller IR SENSOR

•It recieves the code from sensors and Processes

MICROCONTROLLER •Than Compares it with Pre -defined values for Comparison ATMEGA16

• It recieve Signal from controller to control lights and fans

HOME • Selects Which of the Relay to be Energised And which one to be Deenergised AUTOMATION

• If Relay of fan is energised it will runother wise it will be off

ROOM LIGHTS AND • If relay of Light is Energised it wiii be on otherwise it will be off. FANS

Fig 3.2 Block Diagram of the system

3.3 POWER SUPPLY SECTION DESIGNING:

• The Power section consists of Regulator 7805. a 12V DC adaptor, capacitors, diodes,

& Voltage

• The adaptor is connected to 220 volts AC household supply, and this supply is

converted to 12 volts DC supply.

• The 12V DC is fed to a Diode, so that there is no backflow of current

• Further the supp ly is fed to a 0.33µF capacitor, to avoid volt age spike

• This supply is then conn ected to the first pin of Voltage Regulator 7805

• 7805 converts this supp ly into 5V

• The 5V supply is obtained from the 3rd pin of 7805

• Again the 5V supply is fed to 0.33µF capacitor

• An LED is connected to it to check whether the supply is avail able or not

• Finally the +5 supply can be obtained from the circuit.

3.4 CONTROLLER BOARD CIRCUIT DIAGRAM Fig3.4: complete controller board ckt diag.

RESULTS

& ANALYSIS MICROCONTROLLER BASED ANTISLEEP ALARM

CHAPTER 4 RESULTS & DISCUSSION

4.1 RESULTS

This section describes the output of the implemented system. Several testing has been

performed to ensure its executed and produce the intended result. The prototype system

is designed to receive signal from IR SENSOR and send to the Atmega16 circuit

which then triggers the relay on the Home Automation Board. The incoming message is

deleted by the microcontroller upon completing the requested process, and signal exist in

the connected IR Sensor. The system then replies a message to user mobile phone

reporting the status of the devices (turned ON or turned OFF). The status message is to

remind the user regarding the current state of the appliances.

The system worked properly in nine tests out of ten. It reverted notifications and

processed the commands of any mobile number, which can be regarded as a weak point

for the system as anyone can access it.

MICROCONTROLLER BASED ANTISLEEP ALARM

4.2 ANALYSIS

When the device is switched on the LCD displays “Initializing”, this means that the entire

system is getting ready for functioning, also the IR sensor will generate a code in

cnditiond of obstacle and no obstacle and transmit signals to controller for further

comparision. It takes around 30 seconds for the whole system to initialize and after

the process is over the LCD displays a message that to show that the system is ready for

use.

After that a person can enter or exit the room, hence the lights connected can be

on, on or off.

Enetering the room means the system will start the equipment for unlimited time, unless

and until an any person exit from room or the system is not being resetted on buzzer alarm.

In case the buzzer beaps. It will be for 5secs . After the beep it will wait for one minute time period and than it will switch off the fan in case the counter is not zero.

In case the buzzer beeps, system not resetted and the counter is also zero , hence it will

switch off both fans , as well as lights.

The flexibility to the users is that a user has the power to control the time period of

operation of the device. Without having the tension off switching on or off the device lights

are controlled and also wastage of energy is under control.

MICROCONTROLLER BASED ANTISLEEP ALARM

APPLICATION

MICROCONTROLLER BASED ANTISLEEP ALARM

5. APPLICATION

The dummy has various applications . which are as follows:

• Its used for students to make them awake as the name suggests

“ANTISLEEP ALARM”

• It can be used normally in every house hold usage to save electricity

• It can be used in hotels in order to save electrical energy.

MICROCONTROLLER BASED ANTISLEEP ALARM

CONCLUSION

MICROCONTROLLER BASED ANTISLEEP ALARM

6. CONCLUSION

The prototype was successfully developed and met the objectives. The system can

automatically switch ON and OFF the extension and lamp remotely using SMS. The

integration of software and hardware has performed a good task in producing the SMS

system. However, there are several weaknesses had been identified which can be further

improved in the future such as the system could provide better performance by

intelligently send notification upon power failure, provide a flexible function by

supporting both manual and automatic control as well as provide an option for the user to

control the appliance through web-based system. Also the system has a weakness to be

operated by any user as it is open to all HOUSE HOLD or INDUSTRIAL uses, but

this error could have been rectified by adding a password to the program. In addition,

the system is very practical when the user is away from home due to it can control the

electrical home appliances remotely as long as the mobile phone gets the coverage.

MICROCONTROLLER BASED ANTISLEEP ALARM

LIST OF REFRENCES

1. http://www.fairchildsemi.com/ds/TI/TIP120.pdf

2. http://en.wikipedia.org/wiki/Opto-isolator

3. http://en.wikipedia.org/wiki/Microcontroller

4. http://www.thefreedictionary.com/relay

5. http://en.wikipedia.org/wiki/Relay

6. http://www.datasheetarchive.com/module%20sim%20300%20gsm%20modem% 2

0datasheet-datasheet.html

7. http://www.howstuffworks.com/lcd.htm

8. http://www.webopedia.com/TERM/L/LCD.html

9. http://en.wikipedia.org/wiki/Liquid_crystal_display

10. http://en.wikipedia.org/wiki/Light-emitting_diode