final reporteditrb

105
ANDROID BASED PORTABLE MULTIPARAMETER MONITORING SYSTEM A project report submitted in partial fulfilment of the requirement for the award of the degree of BACHELOR OF ENGINEERING IN ELECTRONICS AND INSTRUMENTATION Submitted by S.Mahathi Vatsal (1210611144) LLN. Vamsi Krishna (1210611121) V.Luke Vikas (1210611163) G.Sai Ram Prabhu (1210611111) Under the esteemed guidance of Mr.L.Srinivasa Rao, M.Tech Assistant Professor Dept. of Electronics and Instrumentation Engineering DEPARTMENT OF ELECTRONICS AND INSTRUMENTATION ENGINEERING GANDHI INSTITUTE OF TECHNOLOGY AND MANAGEMENT GITAM UNIVERSITY 1

Upload: lln-vamsi-krishna

Post on 12-Nov-2015

226 views

Category:

Documents


10 download

DESCRIPTION

brtb

TRANSCRIPT

ANDROID BASED PORTABLE MULTIPARAMETER MONITORING SYSTEM

A project report submitted in partial fulfilment of the requirement for the award of the degree of

BACHELOR OF ENGINEERINGINELECTRONICS AND INSTRUMENTATION

Submitted byS.Mahathi Vatsal (1210611144)LLN. Vamsi Krishna (1210611121)V.Luke Vikas (1210611163)G.Sai Ram Prabhu (1210611111)

Under the esteemed guidance of

Mr.L.Srinivasa Rao, M.TechAssistant ProfessorDept. of Electronics and Instrumentation Engineering

DEPARTMENT OF ELECTRONICS AND INSTRUMENTATION ENGINEERINGGANDHI INSTITUTE OF TECHNOLOGY AND MANAGEMENTGITAM UNIVERSITY(Estd u/3 of UGC Act, 1956)Visakhapatnam-5300452011-2015DEPARTMENT OF ELECTRONICS AND INSTRUMENTATION ENGINEERINGGITAM UNIVERSITY OF TECHNOLOGYVisakhapatnam-530045

BATCH 2011-2015CERTIFICATEThis is to certify that the project report titled ANDROID BASED PORTABLE MULTIPARAMETER MONITORING SYSTEM that is being submitted by the Batch No.5 consisting of S.MAHATHI VATSAL (1210611144), LLN.VAMSI KRISHNA (1210611121), V.LUKE VIKAS (1210611163) and G.SAI RAM PRABHU (1210611111) is in partial fulfilment of the requirements for the Award of BACHELOR OF ENGINEERING IN ELECTRONICS AND INSTRUMENTATION ENGINEERING, is a record of bonafide work done on that under my guidance. The contents of this project work, in full or in parts, have neither been taken from any other sources nor have been submitted to any other institute or university for the award of any degree or diploma and the same is certified.

Project guide: Head of the department:

Mr.L.Srinivasa Rao, M.Tech Dr.D.ElizabethRani, Assistant professor Professor , HOD Dept. of EIE, Dept. Of EIE,Gitam University. Gitam University.

ACKNOWLEDGEMENT

We would like to express our deep sense of gratitude towards Dr.D.Elizabeth Rani, Professor, HOD, Department of Electronics and Instrumentation, GITAM UNIVERSITY for her administrative support during the project work.We would like to express our deep sense of gratitude to Mr.L.Srinivasa Rao, Assistant Professor for his valuable guidance rendered to us in the completion of this project.We also wish to express our sincere gratitude to Ms.M.Grace Mercy, Project Coordinator, Department of Electronics and Instrumentation, GITAM University for her constant support and guidance.We are thankful to all the faculty and non-teaching staff of Department of Electronics and Instrumentation Engineering, GITAM University, who have supported us during the project work..

S. Mahathi Vatsal 1210611144LLN. Vamsi Krishna 1210611121V. Luke Vikas 1210611163G. Sai Ram Prabhu 1210611111

ABSTRACTMobile devices (in particular Smartphones and tablets) can be used to monitor quality of life parameters. Today mobile devices use embedded sensors such as accelerometers, compasses, GPSs, microphones, and cameras without considering, for example, the air quality or the pollutants of the environment. This project presents the possibility to use the Smartphones capabilities to gather data from other phones or sensors. . In this project, a novel interface by applying a Bluetooth-based sensor to sense monitored are light, temperature, smoke, motion and fire for monitoring of the environmental conditions using the android-based Smartphone is introduced.The Bluetooth-based parameter acquisition system consists of a device comprising a sensor and a microcontroller that wirelessly transmits these climatic parameters to a receiver using the Bluetooth communication system. An application called a Bluetooth SPP Tools Pro by Android is used to acquire data from the parameters that has described before. The android application has two parts. The first part, display, illustrates the parametric values that are read from the Bluetooth-based acquisition system from the kit, and the second part involves the movement of the kit.The preliminary aim in this project is to build a Mobile operated ARM7 based device, which could be able to move in forward, backward, right and left directions. By using keys on the Mobile. The device can be moved in all the above specified directions. And the transmission of wireless signals can be carried by using Bluetooth communication. The device is fitted with 2 DC geared motors and to control its operation LPC2148 is being used as controller. In this project, LPC2148, DC Geared motors, and Bluetooth is used to for the navigation of device. ARM7TDMI is an advanced version of microprocessors and forms the heart of the system.

TABLE OF CONTENTS

CHAPTER CONTENTS PAGE1 INTRODUCTION 1

1.1 OVERVIEW 2

1.2 BLOCK DIAGRAM 3

2 ARM7 MICROCONTROLLER 4

2.1 ARM7 LPC2148 MICROCONTROLLERS 5

2.1.1 POWER SUPPLY FOR ARM7 LPC2148 5 2.1.2CRYSTAL OSCILLATOR 7 2.1.3 RESET CIRCUIT 7 2.1.4 RTC CRYSTAL OSCILLATOR 8 2.1.5 UART 8

2.2 KEY FEATURES OF LPC 2148 9

2.3 PIN DIAGRAM OF ARM7 LPC 2148 10 2.4 BLOCK DIAGRAM OF LPC 2148 11

2.5 ARCHITURURAL OVERVIEW OF LPC 2148 12

2.6 ON CHIP FLASH MEMORY OF LPC 2148 12

2.7 ON CHIP STATIC MEMORY 12

2.8 EXCEPTIONS, INTERRUPTS AND VECTOR TABLE 12

3 SENSORS14

3.1 TEMPERATURE SENSOR LM 3515

3.1.1 GENERAL DESCRIPTION OF LM 3515 3.1.2 FEATURES AND PRINCIPLE OF LM 35 15 3.1.3 DIAGRAM OF LM 35 16 3.1.4 IMAGE OF LM 3517 3.1.5 WORKING OF LM 3517

3.2 GAS SENSOR MQ-218

3.2.1 GENERAL DESCRIPTION OF MQ-218 3.2.2 FEATURES AND PRINCIPLE OF MQ-218 3.2.3 DIAGRAM OF MQ-219 3.2.4 WORKING OF MQ-220 3.2.5 APPLICATIONS OF MQ-220

3.3LIGHT SENSOR-LDR20 3.3.1 GENERAL DESCRIPTION OF LDR20 3.3.2 FEATURESAND PRINCIPLE OF LDR21 3.3.3 DIAGRAM OF LDR22 3.3.4 WORKING OF LDR22 3.3.5 APPLICATIONS OF LDR22

3.4 FIRE SENSOR-PHOTODIODE23 3.4.1 GENERAL DESCRIPTION OF PHOTODIODE23 3.4.2 FEATURESAND PRINCIPLE OF PHOTODIODE23 3.4.3 DIAGRAM OF PHOTODIODE25 3.4.4 WORKING OF PHOTODIODE25 3.4.5 APPLICATIONS OF PHOTODIODE25

3.5 INTRUDER SENSOR- PASSIVE INFRARED SENSOR25 3.5.1 GENERAL DESCRIPTION OF PIR25 3.5.2 FEATURESAND PRINCIPLE OF PIR 25 3.5.3 DIAGRAM OF PIR26 3.5.4 WORKING OF PIR26 3.5.5 APPLICATIONS OF PIR27

4 CONTROL CIRCUITORY28

4.1 POWER SUPPLY CIRCUIT29 4.1.1 STEP DOWN TRANSFORMER29 4.1.2 BRIDGE RECTIFIER29 4.1.3 7805 REGULATOR31 4.1.4 FILTER CAPACITOR32

4.2 ULN 2003 CURRENT AMPLIFIER 32

4.3 SUGAR CUBE RELAY SWITCH34

4.3.1 RELAY SWITCH344.3.2 BASIC DESIGN AND RELAY OPERATION344.3.3 JQC-3FC/T73 SUGAR CUBE DISPLAY354.4 FAN364.5 BUZZER374.6 BLUETOOTH MODULE374.6.1 BLUETOOTH MODULE HC-05374.6.2 ANDROID APP- BLUETOOTH SPP TOOLS PRO384.7 ROBOTIC PLATFORM394.7.1 DC GEARED MOTORS394.7.2 IC L293D MOTOR DRIVER40

5. SERIAL COMMUNICATION AND DISPLAY435.1 RS 232 FOR SERIES COMMUNICATION44 5.1.1 INTRODUCTION TO RS-23244 5.1.2 STANDARDS OF RS-232445.1.3 RANGE OF RS-232455.1.4 COMMUNICATION METHODS OF RS-23245 5.1.5 PIN DIAGRAM OF RS-232455.1.6 RS-232 SPECIFICATIONS46

5.2 16X2 CHARACTER LCD46 5.2.1 INTRODUCTION TO THE 16X2 LCD465.2.2 DESCRIPTION OF 16X2 LCD47 5.2.3 PIN DIAGRAM OF LCD 16X2 475.2.4 PIN DESCRIPTION OF LCD48

6. SOFTWARE USED49

6.1 INTRODUCTION TO THE KEIL MICROVISION50 6.2 ARM7 ADVANTAGES IN THE KEIL SOFTWARE50 6.3 C COMPILER516.4 IMPLEMENTATION OF EMBEDDED SYSTEMS51 6.5 PROGRAM FOR THIS PROJECT IN KEIL 52 6.6 FLOW CHART 64

OBSERVATIONS65CONCLUSION AND FUTURE SCOPE67REFERENCES68

LIST OF FIGURESPageCHAPTER 11.1 BLOCK DIAGRAM USED IN THIS PROJECT 3CHAPTER 22.1 BLOCK DIAGRAM FOR POWER SUPPLY62.2 CIRCUIT DIAGRAM FOR POWER SUPPLY62.3 RESET CIRCUIT FOR LPC 214872.4 OSCILLATORY CIRCUIT FOR LPC 214872.5 RTC OPERATION CIRCUIT82.6 UART CONNECTION DIAGRAM82.7 LPC 214892.8 PIN DIAGRAM OF LPC 2148102.9 BLOCK DIAGRAM OF LPC 2148112.10 VECTOR TABLE13

CHAPTER 33.1 IMAGE OF LM 35163.2 IMAGE OF GAS SENSOR173.3 IMAGE OF LDR193.4 IMAGE OF PHOTODIODE203.5 PASSIVE IR SENSOR24CHAPTER 44.1 STEP DOWN TRANSFORMER294.2 BRIDGE RECTIFIER304.3 7805 REGULATOR314.4 PIN DESCRIPTION OF 7805324.5 ULN 2003334.6 PIN DIAGRAM OF ULN 2003334.7 WORKING OF ULN 2003344.8 JQC-3FC/T73 SUGAR CUBE RELAY354.9 FAN364.10 BUZZER374.11 BLUETOOTH MODULE384.12 DC GEARED MOTOR404.13 IC 293D IMAGE414.14 DIAGRAM OF H-BRIDGE 41CHAPTER 55.1 PIN DIAGRAM OF RS-232455.2 PIN DIAGRAM OF LCD 16X2475.3 PIN DESCRIPTION OF LCD48

CHAPTER 66.1 FLOW CHART OF THE PROJECT646.2 OVERVIEW OF THE PROJECT 656.3 INITIAL LCD OUTPUT666.4 FINAL LCD OUTPUT666.5 INITIAL OUTPUT IN ANDROID APP676.6 FINAL OUTPUT IN AMDROID APP 6710

CHAPTER 1:INTRODUCTION

1.1 OVERVIEW:Awireless sensor network (WSN)of spatially distributed autonomous sensorstomonitorphysical or environmental conditions, such as temperature, sound,pressure, etc. and to cooperatively pass their data through the network to a main location. The more modern networks are bi-directional, also enablingcontrolof sensor activity. The development of wireless sensor networks was motivated by military applications such as battlefield surveillance; today such networks are used in many industrial and consumer applications, such as industrial process monitoring and control, machine health monitoring, and so on.The WSN is built of "nodes" from a few to several hundreds or even thousands, where each node is connected to one (or sometimes several) sensors. Each such sensor network node has typically several parts: radiotransceiverwith an internalantennaor connection to an external antenna, amicrocontroller, an electronic circuit for interfacing with the sensors and an energy source, usually abatteryor an embedded form ofenergy harvesting. Asensor nodemight vary in size from that of a shoebox down to the size of a grain of dust, although functioning "motes" of genuine microscopic dimensions have yet to be created. The cost of sensor nodes is similarly variable, ranging from a few to hundreds of dollars, depending on the complexity of the individual sensor nodes. Size and cost constraints on sensor nodes result in corresponding constraints on resources such as energy, memory, computational speed and communications bandwidth. The topology of the WSNs can vary from a simplestar networkto an advancedmulti-hopwireless mesh network. The propagation technique between the hops of the network can beroutingorflooding.The main aim of this project is to monitor temperature, light, motion, fire and smoke and control temperature and light. Using relative low cost and low power components and the Bluetooth communication system for the transmission of the acquired data to an android based Smartphone. A Robotic platform was developed using 2 DC geared motors of 100rpm each and an IC L293D motor driver. An application in android mobile called Bluetooth SPP Tools Pro was used for displaying information and controlling the robotic platform by moving it in all directions-forward, backward, right, left and stop.

1.2 BLOCK DIAGRAM USED IN THIS PROJECT:

Fig 1.1 Block Diagram

CHAPTER 2:ARM7 MICROCONTROLLER

2.1 ARM7LPC2148 MICROCONTROLLERS:ARM is one of the major options available for embedded system developer. Over the last few years, the ARM architecture has become the most pervasive 32-bitarchitecture in the world, with wide range of ICs available from various IC manufacturers.ARM processorsare embedded in products ranging from cell/mobile phones to automotive braking systems. A worldwide community of ARM partners and third-party vendors has developed among semiconductor and product design companies, including hardware engineers, system designers, and software developers. ARM7 is one of the widely used micro-controller family in embedded system application. A RISC-based computer design approach means ARM processors require significantly fewer transistors than typical processors in average computers. LPC2148 need minimum below listed hardware to work properly:1.Power Supply2. Crystal Oscillator3. Reset Circuit4. RTC crystal oscillator (This is not necessary if you are not using RTC. However this is considered as necessary requirement)5. UART2.1.1 Power Supply for ARM7LPC2148LPC2148 works on 3.3 V power supply. LM 117 can be used for generating 3.3 V supply. However, basic peripherals like LCD, ULN 2003 (Motor Driver IC) etc. works on 5V. So AC mains supply is converted into 5V using below mentioned circuit and after that LM 117 is used to convert 5V into 3.3V.Fig 2.1 Block Diagram for Power Supply

Transformer: It is used to step down 230V AC to 9V AC supply and provides isolation between power grids and circuit.Rectifier:It is used to convert AC supply into DC.Filter:It is used to reduce ripple factor of DC output available from rectifier end.Regulator:It is used to regulate DC supply output.Here, Regulator IC 7805 is used to provide fix 5V dc supply.Fig 2.2 Circuit Diagram for Power Supply2.1.2 Reset CircuitReset button is essential in a system to avoid programming pitfalls and sometimes to manually bring back the system to the initialization mode. MCP 130T is a special IC used for providing stable RESET signal to LPC 2148.

Fig 2.3 Reset Circuit for LPC21482.1.3 Oscillator Circuit:Oscillations, the heartbeat, are provided using a crystal and are necessary for the system to work.

Fig 2.4 Oscillatory Circuit for LPC21482.1.4 RTC Oscillator CircuitIt provides clock for RTC operation.

Fig 2.5 RTC Operation Circuit

2.1.5 UART:LPC 2148 has inbuilt ISP which means we can program it within the system using serial communication on COM0. It has also COM1 for serial communication. MAX 232/233 IC must be used for voltage logic conversion.

Fig 2.6 Related Connections for UART

2.2 KEY FEATURES OF LPC2148:LPC2148is the widely used IC from ARM-7 family. It is manufactured by Philips and it is pre-loaded with many inbuilt peripherals making it more efficient and a reliable option for the beginners as well as high end application developer.1. 8 to 40 kB of on-chip static RAM and 32 to 512 kB of on-chip flash program memory.128 bit wide interface/accelerator enables high speed 60 MHz operation.2. In-System/In-Application Programming (ISP/IAP) via on-chip boot-loader software.Single flash sector or full chip erase in 400 ms and programming of 256 bytes in 1ms.3. EmbeddedICE RT and Embedded Trace interfaces offer real-time debugging with theon-chip RealMonitor software and high speed tracing of instruction execution.4. USB 2.0 Full Speed compliant Device Controller with 2 kB of endpoint RAM.In addition, the LPC2146/8 provides 8 kB of on-chip RAM accessible to USB by DMA.5. One or two 10-bit A/D converters provide a total of 6/14analog inputs, with conversion times as low as 2.44 us per channel.6. Single 10-bit D/A converter provides variable analog output.7. Two 32-bit timers/external event counters (with four capture and four comparechannels each), PWM unit (six outputs) and watchdog.8. Low power real-time clock with independent power and dedicated 32 kHz clock input.9. Multiple serial interfaces including two UARTs (16C550), two Fast I2C-bus (400 Kbit/s), SPI and SSP with buffering and variable data length capabilities.10. Vectored interrupt controller with configurable priorities and vector addresses.

Fig 2.7 LPC2148 2.3 PIN DIAGRAM OF LPC2148

Fig 2.8 Pin Diagram of LPC2148

2.4 BLOCK DIAGRAM OF LPC2148

Fig 2.9 Block Diagram of LPC2148

2.5 ARCHITECTURAL OVERVIEW OF LPC2148:The ARM is a 32-bitReducedInstructionSet Computer (RISC) instruction set architecture (ISA) developed by ARM Limited. It was known as theAdvancedRISCMachine, and before that as theAcornRISCMachine. The ARM architecture is the most widely used 32-bit ISA in terms of numbers produced.The ARM processor consists of: Arithmetic Logic Unit (32-bit), One Booth multiplier (32-bit), One Barrel shifter, One Control unit, Register file of 37 registers each of 32 bits.In addition to this the ARM also consists of a Program status register of 32 bits, Some special registers like the instruction register, memory data read and write register and memory address register ,one Priority encoder which is used in the multiple load and store instruction to indicate which register in the register file to be loaded or stored and Multiplexers etc.2.6 ON-CHIP FLASH MEMORY OF LPC2148:The LPC2148 incorporates a 512 kB Flash memory system. This memory may be used for both code and data storage. When the LPC2148 on-chip boot loader is used, 500 kB of Flash memory is available for user code. The LPC2148 Flash memory provides minimum of 100,000 erase/write cycles and 20 years of data-retention.2.7 ON-CHIP STATIC RAM:The LPC2148 provides 32 kB of static RAM which may be used for code and/or data storage. It may be accessed as 8-bits, 16-bits, and 32-bits.

2.8 EXCEPTIONS, INTERRUPTS AND VECTOR TABLE:Exceptions are generated by internal and external sources to cause the ARM processor to handle an event, such as an externally generated interrupt or an attempt to execute an undefined instruction.

Exception / InterruptNameAddressHigh Address

ResetRESET0X000000000Xffff0000

Undefined InstructionUNDEF0X000000040Xffff0004

Software InterruptSWI0X000000080Xffff0008

Pre-fetch AbortPABT0X0000000C0Xffff000c

Data AbortDABT0X000000100Xffff0010

Reserved---0X000000140Xffff0014

Interrupt RequestIRQ0X000000180Xffff0018

Fast Interrupt RequestFIQ0X0000001C0Xffff001c

Fig 2.10 Vector TableThe exception Vector table shown above gives the address of the subroutine program to be executed when the exception or interrupt occurs. Each vector table entry contains a form of branch instruction pointing to the start of a specific routine.Reset vectoris the location of the first instruction executed by the processor when power is applied. This instruction branches to the initialization code.

CHAPTER 3:SENSORS

3.1 TEMPERATURE SENSOR LM-35:3.1.1 GENERAL DESCRIPTION OF LM-35:TheLM35seriesare precisionintegrated-circuittemperature sensors,whoseoutputvoltageis linearlyproportionaltothe Celsius (Centigrade) temperature. The LM35 thus hasan advantage over linear temperature sensors calibrated in Kelvin, as the user is not required to subtract a large constantvoltagefromitsoutputto obtainconvenientCentigrade scaling. The LM35 does not require any external calibration or trimming provide typical accuracies of 14C at room temperature and34Coverafull55to+150C temperature range. Low cost is assured by trimming and calibration at thewaterlevel.TheLM35slowoutputimpedance, linear output, andprecise inherentcalibrationmakeinterfacing toreadoutorcontrolcircuitryespecially easy.It canbeusedwithsingle power supplies, orwithplusand minussupplies.Asitdrawsonly60A fromitssupply,ithas verylowself-heating,lessthan0.1Cin stillair.TheLM35is ratedtooperateovera55to+150Ctemperature range, whiletheLM35Cisratedfora40to+110Crange(10 withimprovedaccuracy).TheLM35seriesisavailablepackaged in hermetic TO-46 transistor packages, while the LM35C, LM35CA, and LM35D are also available in the plasticTO-92transistorpackage.TheLM35Disalsoavail- ablein an8-leadsurfacemountsmalloutlinepackageanda plasticTO-220package.3.1.2 FEATURES AND EXPERIMENTAL PRINCIPLE OF LM-35:1. CalibrateddirectlyinCelsius(Centigrade)2. Linear+10.0mV/Cscalefactor3. 0.5Caccuracyguarantee able(at+25C)4. Ratedforfull55to+150Crange5. Suitableforremoteapplications6. Lowcostduetowafer-leveltrimming7. Operatesfrom4to30volts8. Lessthan60Acurrentdrain9. Lowself-heating, 0.08Cinstillair10. Nonlinearity only14C typical11. Lowimpedanceoutput,0.1 for1mAloadThe voltage that is read across the diode is actually the working base for the sensor. When the voltage increases, the temperature also rises. There is a voltage drop between the emitter and base of the transistor which is recorded. If the voltage difference is amplified, an analog signal is generated. This signal and the temperature are proportional. Even though the technique has improved, this remains the basic working principle of the temperature sensors.

3.1.3 CONNECTION DIAGRAM OF LM-35:

Fig 3.1 Connection Diagram

3.1.4 IMAGE OF THE LM-35

Fig 3.2 Image of LM-35The Block Diagram of the LM-35 consists of the three pins and a plastic TO-220 package. The three pins are associated as the Vcc, output and GND (Ground). The Vcc is the input voltage supplied to the sensor (LM-35). It draws only 60 A from the supply. The output is in the form of the voltage. It causes Linear +10mV/C Scale Factor. The ground is used for the safety purpose of the sensor.

3.1.5 WORKING OF THE LM-35:This project uses IC LM35 as a sensor for detecting accurate centigrade temperature. Linearity defines how well over a range of temperature a sensors output consistently changes. Unlike thermistor, Linearity of a precision IC Sensors are very good of 0.5C accuracy and has wide temperature range. Its output voltage is linearly proportional to the Celsius (Centigrade) temperature.The LM35 is rated to operate over a -55 to +150C temperature range.It draws only 60 A from its supply, it has very low self-heating, less than 0.1C in still air. LM35 Operates from 4 to 30 volts.Output of IC is 10mv/degree centigrade for e.g. if the output of sensor is 280 mV then temperature is 28 degree C. so by using a Digital multimeter we can easily calculate the degree temperature. For trigger point you should set the voltage of pin 2 of IC 741 by using preset or potentiometer.Our aim of this project is not to construct a thermometer but to activate or deactivate a device at a particular margin temperature. For simplicity we have used 2 LED for indication of both low (Green) and high (Red) temperature.The output of IC2 increases in proportion to the temperature by 10 mV per degree. This varying voltage is feed to a comparator IC 741 (OP Amplifier). OP Amplifier are among the most widely used electronic devices today.The op-amp is one type of differential amplifier. It has two input inverting (-) and non-inverting (+) and one output pin. We have used IC741 as non-inverting amplifier which means pin 3 is the input and the output is not reversed. This circuit amplifies the difference between its input terminals.

3.2 GAS SENSOR-MQ-2 SENSOR:3.2.1 GENERAL DESCRIPTION OF MQ-2 SENSOR:MQ2 is a low cost semiconductor sensor which can detect smoke and flammable gases at concentrations from 300 to 10,000 ppm. The sensitive material used for this sensor is SnO2, whose conductivity is lower in clean air. Its conductivity increases as the concentration of combustible gases increases. This sensor has high sensitivity to Hydrogen, Propane, LPG, Methane and other combustible steams. This can be used to detect gas leakage in industries and houses. MQ2 gas sensor can be easily interfaced with Microcontrollers, Arduino Boards, and Raspberry Pi etc. using an Analog to Digital Converter (ADC).3.2.2 FEATURES AND EXPERIMENTAL PRINCIPLE OF MQ-2:1. Wide detecting scope2. Stable and long life3. High sensitivity4. Fast response5. Low cost6. Long Life7. Simple drive circuit

Principle: Catalytic-type gas sensor consist of two elements: a detector element (D) which contains catalytic material and is sensitive to combustible gases, and a compensator element (C) which is inert. Combustible gases will burn only on the detector element, causing a rise in its temperature and, as a consequence, a rise in its resistance. Combustible gases will not burn on the compensatorits temperature and resistance remain unchanged in the presence of combustible gases. Normally a Wheatstone bridge circuit is formed with both elements as shown in Figure 2. A variable resistor (VR) is adjusted to maintain a state of balance of the bridge circuit in clean air free of combustible gases. When combustible gases are present, only the resistance of the detector element will rise, causing an imbalance in the bridge circuit, thus producing an output voltage signal (Vout). The output voltage signal is proportional to the concentration of combustible gases. Gas concentration can be determined by measuring the output voltage.3.2.3 DIAGRAM OF MQ-2 SENSOR:

Fig 3.3 MQ-2 sensor

In order to manage above listed functions efficiently, the steel mesh is made into two layers. The mesh is bound to rest of the body via a copper plated clamping ring.3.2.4 WORKING OF MQ-2 SENSOR:The top of the gas sensor is removed off to see the internals parts of the sensor: sensing element and connection wiring. The hexapod structure is constituted by the sensing element and six connecting legs that extend beyond the Bakelite base.Image shows the hollow sensing element which is made up from Aluminum Oxide based ceramic and has a coating of tin oxide. Using a ceramic substrate increases the heating efficiency and tin oxide, being sensitive towards adsorbing desired gas components (in this case methane and its products) suffices as sensing coating.The leads responsible for heating the sensing element are connected through Nickel-Chromium, well known conductive alloy. Leads responsible for output signals are connected using platinum wires which convey small changes in the current that passes through the sensing element. The platinum wires are connected to the body of the sensing element while Nickel-Chromium wires pass through its hollow structure.3.2.5 APPLICATIONS OF MQ-2 SENSOR:1) Domestic gas leakage detector2) Industrial Combustible gas detector3) Portable gas detector4) They are used in gas leakage detecting equipments in family and industry, are suitable for detecting of LPG, I-butane, propane, methane, alcohol, Hydrogen, smoke.

3.3 LIGHT SENSOR-LIGHT DEPENDENT RESISTOR (LDR):3.3.1 GENERAL DECSRIPTION OF LDR:Aphotoresistororlight-dependent resistor(LDR) orphotocellis a light-controlled variableresistor. Theresistanceof a photoresistor decreases with increasing incident light intensity; in other words, it exhibitsphotoconductivity. A photoresistor can be applied in light-sensitive detector circuits, and light- and dark-activated switching circuits.A photoresistor is made of a high resistancesemiconductor. In the dark, a photoresistor can have a resistance as high as a few megaohms (M), while in the light, a photoresistor can have a resistance as low as a few hundred ohms. If incident light on a photoresistor exceeds a certainfrequency,photonsabsorbed by the semiconductor give boundelectronsenough energy to jump into theconduction band. The resulting free electrons (and theirholepartners) conduct electricity, thereby loweringresistance. The resistance range and sensitivity of a photoresistor can substantially differ among dissimilar devices. Moreover, unique photoresistors may react substantially differently to photons within certain wavelength bands.3.3.2 FEATURES AND EXPERIMENTAL PRINCIPAL OF LDR:Photoresistors are less light-sensitive devices thanphotodiodesorphototransistors: the two latter components are truesemiconductor devices, while a photoresistor is a passive component and does not have a PN-junction. The photo resistivity of any photoresistor may vary widely depending on ambient temperature, making them unsuitable for applications requiring precise measurement of or sensitivity to light.Photoresistors also exhibit a certain degree oflatencybetween exposure to light and the subsequent decrease in resistance, usually around 10 milliseconds. The lag time when going from lit to dark environments is even greater than, often as long as one second. This property makes them unsuitable for sensing rapidly flashing lights, but is sometimes used to smooth the response of audio signal compression.LDRs are light dependent devices whoseresistancedecreases when light falls on them and increases in the dark. When alight dependentresistoris kept in dark, its resistance is very high. This resistance is called as darkresistance. It can be as high as 1012 . And if the device is allowed to absorb light itsresistancewill decrease drastically. If a constantvoltageis applied to it and intensity of light is increased thecurrentstarts increasing.Alight dependentresistorworks on the principle of photo conductivity. Photo conductivity is an optical phenomenon in which the materials conductivity (Hence resistivity) reduces when light is absorbed by the material.

3.3.3 DIAGRAM OF LDR:

Fig 3.4 diagram of LDRAn LDR has a zigzag cadmium sulphide track. It is a bilateral device,i.e., conducts in both directions in same fashion.

3.3.4 WORKING OF LDR:When light falls i.e. when the photons fall on the device, the electrons in the valence band of thesemiconductormaterial are excited to the conduction band. These photons in the incident light should have energy greater than the band gap of thesemiconductor material to make the electrons jump from the valence band to the conduction band. Hence when light having enough energy is incident on the device more & more electrons are excited to the conduction band which results in large number of charge carriers. The result of this process is more and morecurrentstarts flowing and hence it is said that theresistanceof the device has decreased.This is the most commonworking principle of LDR.3.3.5 APPLICATIONS OF LDR:They are also used in somedynamic compressorstogether with a smallincandescentorneonlamp, orlight-emitting diodeto control gain reduction. A common usage of this application can be found in manyguitar amplifiersthat incorporate an onboardtremoloeffect, as the oscillating light patterns control the level of signal running through the amp circuit..LDRs have low cost and simple structure. They are often used as light sensors. They are used when there is a need to detect absences or presences of light like in a camera light meter. Used in street lamps, alarm clock, burglar alarm circuits, light intensity meters, for counting the packages moving on a conveyor belt, etc.

3.4 FIRE SENSOR-PHOTODIODE:3.4.1 GENERAL DESCRIPTION OF PHOTODIODE:Aphotodiodeis a semiconductor device that convertslightintocurrent. The current is generated when photons are absorbed in the photodiode. A small amount of current is also produced when no light is present. Photodiodes may containoptical filters, built-in lenses, and may have large or small surface areas. Photodiodes usually have a slower response time as their surface area increases. The common, traditionalsolar cellused to generate electricsolar poweris a large area photodiode.Photodiodes are similar to regularsemiconductordiodesexcept that they may be either exposed (to detectvacuum UVorX-rays) or packaged with a window oroptical fibreconnection to allow light to reach the sensitive part of the device. Many diodes designed for use specifically as a photodiode use aPIN junctionrather than apn junction, to increase the speed of response. A photodiode is designed to operate inreverse bias. 3.4.2 FEATURES AND EXPERIMENTAL PRINCIPAL OF PHOTODIODE:Responsivity: TheSpectral responsivityis a ratio of the generated photocurrent to incident light power, expressed inA/Wwhen used in photoconductive mode. The wavelength-dependence may also be expressed as aQuantum efficiency, or the ratio of the number of photo generated carriers to incident photons, a unit less quantity. Allows to detect flames from 2m away. The current through the photodiode in the absence of light, when it is operated in photoconductive mode. The dark current includes photocurrent generated by background radiation and the saturation current of the semiconductor junction. Dark current must be accounted for bycalibrationif a photodiode is used to make an accurate optical power measurement, and it is also a source ofnoisewhen a photodiode is used in an optical communication system.Pn photodiodes are used in similar applications to otherphotodetectors, such asphotoconductors,charge-coupled devices, andphotomultipliertubes. They may be used to generate an output which is dependent upon the illumination (analog; for measurement and the like), or to change the state of circuitry (digital; either for control and switching, or digital signal processing).3.4.3 DIAGRAM OF PHOTODIODE:

Fig 3.5 photodiode3.4.4 WORKING OF PHOTODIODE:The photodiode used in infrared detectors generate a photo voltage proportional to the incident light rays or infrared rays falling on it. Typically, 1V is produced in the photodiode when it is forward biased by accepting the photons. Here the passive infrared rays from the spark or fire are used to activate the photodiode to generate the photo voltage.The high output from IC1 is used to trigger SCR BT169 (SCR1) for activating the relay. When the relay energises, power to the device will cut off immediately. SCR1 remains latched until push-to-off switch S1 is pressed. When SCR1 conducts, T1 gets base bias and it conducts to activate alarm generator UM3561 (IC2). Zener diode ZD1 keeps the supply voltage for IC2 at a safer level of 3.1 volts. IC2 is wired to generate a fire brigade alarm by connecting its pin 6 to ground. The output of IC2 is amplified by transistor T2 to sound the alarm from the speaker.3.4.5 APPLICATIONS OF PHOTODIODE:Photodiodes are often used for accurate measurement of light intensity in science and industry. They generally have a more linear response than photoconductors.They are also widely used in various medical applications, such as detectors forcomputed tomography(coupled withscintillators), instruments to analyse samples (immunoassay), andpulse oximeters.3.5 INTRUDER SENSOR-PASSIVE INFRARED SENSOR:3.5.1 GENERAL DESCRIPTION OF PASSIVE INFRARED SENSOR:Apassive infrared sensor(PIR sensor) is an electronicsensorthat measuresinfrared(IR) light radiating from objects in its field of view. They are most often used inPIR-based motion detectors.The IR Sensor-Single is a general purpose proximity sensor. Here we use it for collision detection. The module consist of an IR emitter and IR receiver pair. The high precision IR receiver always detects an IR signal. The module consists of 358 comparator IC. The output of sensor is high whenever it IR frequency and low otherwise. The on-board LED indicator helps user to check status of the sensor without using any additional hardware. The power consumption of this module is low. It gives a digital output.

3.5.2 FEATURES AND EXPERIMENTAL PRINCIPAL OF PIR: A PIR-basedmotion detectoris used to sense movement of people, animals, or other objects. They are commonly used inburglar alarmsand automatically-activatedlightingsystems. They are commonly called simply "PIR", or sometimes "PID", for "passive infrared detector". The PIR sensor is typically mounted on aprinted circuit boardcontaining the necessary electronics required to interpret the signals from the sensor itself. The complete assembly is usually contained within a housing, mounted in a location where the sensor can cover area to be monitored.The termpassivein this instance refers to the fact that PIR devices do not generate or radiate any energy for detection purposes. They work entirely by detecting the energy given off by other objects.[1]PIR sensors don't detect or measure "heat"; instead they detect the infrared radiation emitted or reflected from an object.

3.5.3 IMAGE OF PASSIVE INFRARED SENSOR:

fig 3.6 passive infrared sensorInfrared radiation enters through the front of the sensor, known as the 'sensor face'. At the core of a PIR sensor is asolid statesensor or set of sensors, made frompyroelectric materialsmaterials which generate energy when exposed to heat. Typically, the sensors are approximately 1/4 inch square (40mm2), and take the form of athin film. Materials commonly used in PIR sensors includegallium nitride(GaN),caesium nitrate(CsNO3),polyvinyl fluorides, derivatives ofphenyl pyridine, andcobaltphthalocyanine. The sensor is often manufactured as part of anintegrated circuit.

3.5.4 WORKING OF PASSIVE INFRARED SENSOR:An individual PIR sensor detects changes in the amount of infrared radiation impinging upon it, which varies depending on the temperature and surface characteristics of the objects in front of the sensor.When an object, such as ahuman, passes in front of the background, such as awall, the temperature at that point in the sensor's field of view will rise fromroom temperaturetobody temperature, and then back again. The sensor converts the resulting change in the incoming infrared radiation into a change in the output voltage, and this triggers the detection. Moving objects of similar temperature to the background but different surface characteristics may also have a different infrared emission pattern, and thus sometimes trigger the detector. PIRs come in many configurations for a wide variety of applications. The most common models have numerousFresnel lensesor mirror segments, an effective range of about ten meters (thirty feet), and a field of view less than 180 degrees. Models with wider fields of view, including 360 degrees, are availabletypically designed to mount on a ceiling. Some larger PIRs are made with single segment mirrors and can sense changes in infrared energy over one hundred feet away from the PIR. There are also PIRs designed with reversible orientation mirrors which allow either broad coverage (110 wide) or very narrow "curtain" coverage, or with individually selectable segments to "shape" the coverage.3.5.5 APPLICATIONS OF PASSIVE INFRARED SENSOR:When used as part of a burglar alarm, the electronics in the PIR typically control a smallrelay. This relay completes the circuit across a pair ofelectrical contactsconnected to a detection input zone of theburglar alarm control panel. The system is usually designed such that if no motion is being detected, the relay contact is closeda 'normally closed' (NC) relay. If motion is detected, the relay opens, triggering the alarm.

CHAPTER 4:CONTROL CIRCUITORY

4.1 POWER SUPPLY CIRCUIT:4.1.1 STEP DOWN TRANSFORMER:

Fig.4.1 Step Down Transformer

Step down transformers are designed to reduce electrical voltage. Their primary voltage is greater than their secondary voltage. This kind of transformer "steps down" the voltage applied to it. For instance, a step down transformer is needed to use an 110v product in a country with a 220v supply.Step down transformers convert electrical voltage from one level or phase configuration usually down to a lower level. They can include features for electrical isolation, power distribution, and control and instrumentation applications. Step down transformers typically rely on the principle of magnetic induction between coils to convert voltage and/or current levels.Step down transformers are made from two or more coils of insulated wire wound around a core made of iron. When voltage is applied to one coil (frequently called the primary or input) it magnetizes the iron core, which induces a voltage in the other coil, (frequently called the secondary or output). The turns ratio of the two sets of windings determines the amount of voltage transformation.4.1.2 BRIDGE RECTIFIER:A diode bridge is an arrangement of four (or more) diodes in a bridge circuit configuration that provides the same polarity of output for either polarity of input.When used in its most common application, for conversion of an alternating current (AC) input into a direct current (DC) output, it is known as a bridge rectifier. A bridge rectifier provides full-wave rectification from a two-wire AC input, resulting in lower cost and weight as compared to a rectifier with a 3-wire input from a transformer with a center-tapped secondary winding.Basic operation:In the diagrams below, when the input connected to the left corner of the diamond is positive, and the input connected to the right corner is negative, current flows from the upper supply terminal to the right along the red (positive) path to the output, and returns to the lower supply terminal via the blue (negative) path.When the input connected to the left corner is negative, and the input connected to the right corner is positive, current flows from the lower supply terminal to the right along the red (positive) path to the output, and returns to the upper supply terminal via the blue (negative) path.

Fig.4.2 Circuit Diagram of Bridge RectifierWhen the input connected to the left corner is negative, and the input connected to the right corner is positive, current flows from the lower supply terminal to the right along the red (positive) path to the output, and returns to the upper supply terminal via the blue (negative) path.In each case, the upper right output remains positive and lower right output negative. Since this is true whether the input is AC or DC, this circuit not only produces a DC output from an AC input, it can also provide what is sometimes called "reverse polarity protection". That is, it permits normal functioning of DC-powered equipment when batteries have been installed backwards, or when the leads (wires) from a DC power source have been reversed, and protects the equipment from potential damage caused by reverse polarity.4.1.3 7805 REGULATOR:

Fig 4.3 7805 regulator

A regulated power supply is very much essential for several electronic devices due to the semiconductor material employed in them have a fixed rate of current as well as voltage. The device may get damaged if there is any deviation from the fixed rate. The AC power supply gets converted into constant DC by this circuit. By the help of a voltage regulator DC, unregulated output will be fixed to a constant voltage. The circuit is made up of linear voltage regulator 7805 along with capacitors and resistors with bridge rectifier made up from diodes. From giving an unchanging voltage supply to building confident that output reaches uninterrupted to the appliance, the diodes along with capacitors handle elevated efficient signal conveyed.

Fig 4.4 pin description4.1.4 FILTER CAPACITOR:The capacitor-input filter, also called the pi filter due to its shape that looks like the Greek letter , is a type of electronic filter. Filter circuits are used to remove unwanted or undesired frequencies from a signal.In this project, a capacitor of 1000microfarads is used to eliminate all the ripples in the higher ranges so that the circuit works smoothly. 4.2 ULN2003 CURRENT AMPLIFIER:ULN2003is a high voltage and high current Darlington array IC. It contains seven open collector Darlington pairs with common emitters. A Darlington pair is an arrangement of two bipolar transistors.Each channel or Darlington pair inULN2003is rated at 500mA and can withstand peak current of 600mA. The inputs and outputs are provided opposite to each other in the pin layout. Each driver also containsa suppression diodeto dissipate voltage spikes while driving inductive loads.

Fig. 4.5 Diagram of ULN2003

Features:1. 500-mA-Rated Collector Current (Single Output)2. High-Voltage Outputs: 50 V3. Output Clamp Diodes4. Inputs Compatible With Various Types of Logic5. Relay-Driver Applications

Fig.4.6 Pin Diagram of ULN2003

Working:

Fig.4.7 Working of ULN2003Applications:1. Drive Relays2. Lamp and LED displays3. Stepper motors

4.3 SUGAR CUBE RELAY SWITCH:4.3.1 RELAY SWITCH:Arelayis anelectricallyoperatedswitch. Many relays use anelectromagnetto mechanically operate a switch, but other operating principles are also used, such assolid-state relays. 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. The first relays were used in long distancetelegraphcircuits as amplifiers: they repeated the signal coming in from one circuit and re-transmitted it on another circuit. Relays were used extensively in telephone exchanges and early computers to perform logical operations.4.3.2 BASIC DESIGN AND RELAY OPERATION:When anelectric currentis passed through the coil it generates amagnetic fieldthat activates 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 reducesarcing.When the coil is energized withdirect current, adiodeis often placed across the coil to dissipate the energy from the collapsing magnetic field at deactivation, which would otherwise generate avoltage spikedangerous tosemiconductorcircuit components. Some automotive relays include a diode inside the relay case. Alternatively, a contact protection network consisting of a capacitor and resistor in series (snubbedcircuit) may absorb the surge. If the coil is designed to be energized withalternating current(AC), some method is used to split the flux into two out-of-phase components which add together, increasing the minimum pull on the armature during the AC cycle. Typically this is done with a small copper "shading ring" crimped around a portion of the core that creates the delayed, out-of-phase component.[1]4.3.3 JQC-3FC/T73 SUGAR CUBE RELAY:

fig 4.8 T73 sugar cube relay

SPECIFICATIONS:1. MAX. SWITCHING CURRENT:7A, 10A2. MAX. SWITCHING VOLTAGE:28V DC/ 250V AC3. DIELECTRIC STRENGTH VR.M.S: BETWEEN OPEN CONTACTS =750VAC; 4. BETWEEN COIL AND CONTACTS =1000VAC; 5. BETWEEN CONTACTS FORM =1000VAC; 6. AMBIENT TEMPERATURE: -40-+85oC; 7. OPERATION/RELEASE TIME:=10/8MS8. CONTACT CAPACITY: 10A 125V, 7A 250V

4.4 FAN:A fanis anyfaninside, or attached to, acomputer caseused foractive cooling, and may refer to fans that draw cooler air into the case from the outside, expel warm air from inside, or move air across aheat sinkto cool a particular component. Asprocessor, sensorsand other components in ARM board emit a lot of heat when overheated, these components need to be kept within a specified temperature range to prevent overheating, instability, malfunction and damage leading to a shortened component lifespan.In this project, a fan is used as control measure for temperature. Whenever the temperatures crosses a certain limit, the fan starts off to compensate with the raising temperature. It is used for controlling high temperatures, it keeps temperature at the required degrees.

Fig 4.9 fan

4.5 BUZZERAbuzzerorbeeperis anaudioSignaling device,which may bemechanical,electromechanical, orpiezoelectric. Typical uses of buzzers and beepers includealarm devices,timersand confirmation of user input such as a mouse click or keystroke. In this project, the buzzer is used as an alarm Signaling device that blows when there is an excess of any one or more parameters. The electronic symbol for buzzer is shown below,

Fig.4.10 Electronic Symbol for BuzzerThey are of three kinds. Mechanical, electrical and piezoelectric respectively. In the project, we are using an electrical buzzer. In this project, buzzer is used as an alarm when there occurs a fire, or a thief or when smokes reaches 200mV.

4.6 BLUETOOTH MODULE:A Bluetooth module HC-05 is used for communication between the microcontroller system and the Android Mobile.4.6.1 BLUETOOTH MODULE- HC-05:HC-05is a class-2Bluetooth modulewith Serial Port Profile, which can configure as either Master or slave.A Drop-in replacement for wired serial connections, transparent usage. You can use it simply for a serial port replacement to establish connection between MCU, PC to your embedded project and etc.HC-05 Specification:1. Bluetooth protocol: Bluetooth Specification v2.0+EDR2. Frequency: 2.4GHz ISM band3. Modulation: GFSK(Gaussian Frequency Shift Keying)4. Emission power: 4dBm, Class 25. Sensitivity: -84dBm at 0.1% BER6. Speed: Asynchronous: 2.1Mbps(Max) / 160 kbps, Synchronous: 1Mbps/1Mbps7. Security: Authentication and encryption8. Profiles: Bluetooth serial port9. Power supply: +3.3VDC 50mA10. Working temperature: -20 ~ +75Centigrade11. Dimension: 26.9mm x 13mm x 2.2 mm

Fig.4.11 HC-05 Bluetooth Module

4.6.2 ANDRIOD APPLICATION-BLUETOOTH SPP TOOLS PRO:The software for the Bluetooth client communication tools (ie: Bluetooth slave mode), Bluetooth serial communication can be tested. Can connect a Bluetooth MCU and PC serial port.Support android 4.0+ version of the system.Hardware1.Serial Port Bluetooth Module( TTL )2.Arduino Microcontroller Board3.MCU serial communication4.Can search for Bluetooth low energy devices (nothing more)Software features:1. Search for Bluetooth devices, and displays the class and RSSI (signal strength);2. The use of serial communication, receiving and sending data;3. Can be set to ASCII and HEX input and output mode;4. The data results can be saved to the SD card (sdcard/Bluetooth spp pro/...).5. Can search for Bluetooth low energy devices (nothing more)

This tool three modules: 1. Byte stream mode: the basic input-output model; 2. Keyboard mode: Can customize the output value of 12 buttons; each button has three states (respectively: Down | Long-press | Up), each state can send commands event.3. Command Line: Set the command terminator for communication debugging.If the connected Bluetooth device is not paired, the system will automatically prompt you for pairing. Bluetooth pairing is successful, try to connect again.This can only connect Bluetooth serial module devices, Bluetooth devices are generally used for MCU serial communication.System using the Bluetooth pairing means: [menu-> Settings -> Wireless and Network -> Bluetooth Settings], open the Bluetooth feature, and to search for Bluetooth devices to pair, paired with a device only once.System Configuration (includes keyboard mode button settings) file can be found in the SD card Bluetooth spp pro directory. You can back up the configuration file, or copy the configuration file to another terminal equipment, covering his profile to complete recovery.4.7 ROBOTIC PLATFORM:A robotic platform with wheels is built so that the system can move with the help of controls present in Android mobile application- Bluetooth SPP Tools pro. For this purpose, 3 wheels are used with 2 DC geared motors of 100rpm each and an IC L293D Motor Driver is used for providing power to the DC motors.4.7.1 DC GEARED MOTORS:100RPM 12V DC geared motors for robotics applications. It gives a massive torque of 35Kgcm. The motor comes with metal gearbox and off-centred shaft.Features:1. 100RPM 12V DC motors with MetalGearbox andMetal Gears2. 18000 RPM base motor3. 6mm Diashaft with M3 thread hole4. Gearbox diameter 37 mm.5. Motor Diameter 28.5 mm6. Length 63 mm without shaft7. Shaft length 30mm8. 180gm weight9. 35kgcm torque10. No-load current =800 mA, Load current = up to7.5 A(Max)

Fig.4.12 DC Geared Motor

4.7.2 IC L293D MOTOR DRIVER:L293D IC generally comes as a standard 16-pin DIP (dual-in line package). This motor driver IC can simultaneously control two small motors in either direction; forward and reverse with just 4 microcontroller pins. Some of the features of this IC are:1. Output current capability is limited to 600mA per channel with peak output current limited to 1.2A.2. Supply voltage can be as large as 36 Volts. 3. Another major feature ofL293Dis its internal clamp diodes. This fly back diode helps protect the driver IC from voltage spikes that occur when the motor coil is turned on and off.4. The logical low in the IC is set to 1.5V. This means the pin is set high only if the voltage across the pin crosses 1.5V which makes it suitable for use in high frequency applications like switching applications (up to 5KHz)

Fig.4.13 IC L293D H-bridges can be built from scratch using relays, mosfets, field effect transistors (FET), bi-polar junction transistors (BJT), etc.

Fig. 4.14 H-BridgeAs in the image, the circuit has four switches A, B, C and D. Turning these switches ON and OFF can drive a motor in different ways.1. Turning on SwitchesAandDmakes the motor rotate clockwise2. Turning on SwitchesBandCmakes the motor rotate anti-clockwise3. Turning on SwitchesAandBwill stop the motor (Brakes)4. Turning off all the switches gives the motor a free wheel drive5. Lastly turning onA&Cat the same time orB&Dat the same time shorts your entire circuit.

CHAPTER 5:SERIAL COMMUNICATION AND DISPLAY

5.1 RS-232 FOR SERIES COMMUNICATION:RS-232 is used for series communication. This project, RS-232 is used for communication between the microcontroller and android based mobile.5.1.1 INTRODUCTION TO RS-232:An RS-232serial portwas once a standard feature of apersonal computer, used for connections tomodems,printers,mice, data storage,uninterruptible power supplies, and other peripheral devices. However, RS-232 is hampered by low transmission speed, large voltage swing, and large standard connectors. In modern personal computers,USBhas displaced RS-232 from most of its peripheral interface roles. Many computers do not come equipped with RS-232 ports and must use either an external USB-to-RS-232 converter or an internal expansion card with one or more serial ports to connect to RS-232 peripherals. RS-232 devices are widely used, especially in industrial machines, networking equipment and scientific instruments.

5.1.2 STANDARDS OF RS-232:In RS-232, user data is sent as atime-seriesofbits. Both synchronous and asynchronous transmissions are supported by the standard. In addition to the data circuits, the standard defines a number of control circuits used to manage the connection between the DTE and DCE. Each data or control circuit only operates in one direction that is, signalling from a DTE to the attached DCE or the reverse. Since transmit data and receive data are separate circuits, the interface can operate in afull duplexmanner, supporting concurrent data flow in both directions.RS-232 devices may be classified as Data Terminal Equipment (DTE) or Data Communication Equipment (DCE); this defines at each device which wires will be sending and receiving each signal. The standard recommended but did not make mandatory theD-sub miniature25-pin connector. According to the standard, male connectors have DTE pin functions, and female connectors have DCE pin functions. Other devices may have any combination of connector gender and pin definitions. Many terminals were manufactured with female connectors but were sold with a cable with male connectors at each end; the terminal with its cable satisfied the recommendations in the standard. The standard specifies 20 different signal connections. Since most devices use only a few signals, smaller connectors can often be used.5.1.3 RANGE OF RS-232:Cable length is one of the most discussed items in RS232 world. The standard has a clear answer, the maximum cable length is 50 feet, or the cable length equal to a capacitance of 2500 pF. The latter rule is often forgotten. This means that using a cable with low capacitance allows you to span longer distances without going beyond the limitations of the standard. 5.1.4 COMMUNICATION METHODS OF RS-232:To implement RS232 software handshaking, it is necessary to send codes along the lines to establish communications and control the data flow. There are a number of control codes used for RS232 (and other) links under these circumstances. However they are normally used with older legacy equipment.5.1.5 PIN DIAGRAM OF THE RS-232:

Figure 5.1 pin diagram of RS 232

5.1.6 RS-232 SPECIFICATIONS:It includes specifications on voltage levels; slew rate and voltage withstand level.RS232 pin out signals are represented by voltage levels with respect to common. It specifies maximum circuit voltage as 25v. At the transmitter side, driver output specifies voltage+3v to +15vas high leveland -3v to -15v for low level. In the same way for the receiver output high level for voltage is+3v to +15v and low level voltage is -3v to -15v. It should be known that the receiver logic provides the +2v noise margin.The dead area between +3v and -3v is designed to absorb line noise.In RS232 specification low level -3v to-15v is defined as logic 1is ON stateand referred as Marking while high level +3v to +15v is defined as logic 0as OFF stateand known as Spacing. The RS232 standard also limits the maximum slew rate which reduces the cross-talk between the two signals. Slew rate is defined as the rate of change of out-put voltage with respect to time. The maximum allowable slew rate in RS232 is 30v/micro-seconds which slows down the rise and fall time and reduces the cross-talk.Circuits driving an RS-232-compatible interface must be able to withstand indefinite short circuit to ground or to any voltage level up to 25 volts. Some computer equipment ignores the negative level and accepts a zero voltage level as the OFF state. The output signal level usually swings between +12V and -12V.5.2 16X2 CHARACTER LCD:In this project, LCD is used for the display purpose of the readings of the five sensors. This LCD is connected to the microcontroller LPC2148 for displaying the readings of the sensors. This LCD is of 16 characters each in 2 rows.5.2.1 INTRODUCTION TO THE 16X2 LCD:LCD stands for Liquid Crystal Display. It is an Output device that is used for showing and kind of data to the user.There are basically two kinds of LCD:1. Alphanumeric LCD2. Graphic LCD.Here the16X2signifies 16 columns and 2 rows. Alphanumeric means it can print Characters as well as numbers, i.e. it understands ASCII and you will be able to print any printable ASCII characters.This 16X2 is a window of the much larger LCD which can print 132 characters and we are only being given a window of 32 characters divided into 2 lines 16X2.

5.2.2 DESCRIPTION OF 16X2 LCD:A16x2 LCDmeans it can display 16 characters per line and there are 2 such lines. In this LCD each character is displayed in 5x7 pixel matrix. This LCD has two registers, namely, Command and Data.The command register stores the command instructions given to the LCD. A command is an instruction given to LCD to do a predefined task like initializing it, clearing its screen, setting the cursor position, controlling display etc. The data register stores the data to be displayed on the LCD. The data is the ASCII value of the character to be displayed on the LCD. Click to learn more about internal structure of aLCD.

5.2.3 PIN DIAGRAM OF LCD 16X2:

Fig 5.2 pin diagram of LCD 16X2

5.2.4 PIN DESCRIPTION OF LCD:Pin NoFunctionName

1Ground (0V)Ground

2Supply voltage; 5V (4.7V 5.3V)Vcc

3Contrast adjustment; through a variable resistorVEE

4Selects command register when low; and data register when highRegister Select

5Low to write to the register; High to read from the registerRead/write

6Sends data to data pins when a high to low pulse is givenEnable

78-bit data pinsDB0

8DB1

9DB2

10DB3

11DB4

12DB5

13DB6

14DB7

15Backlight VCC(5V)Led+

16Backlight Ground (0V)Led-

Fig 5.3 pin description of LCD

CHAPTER 6:SOFTWARE USED

6.1 INTRODUCTION TO THE KEIL MICROVISION:Keil is a German based Software development company. It provides several development tools like:1. IDE (Integrated Development environment)2. Project Manager3. Simulator4. Debugger5. C Cross Compiler , Cross Assembler, Locator/LinkerKeil Software provides you with software development tools for the 8051 family of microcontrollers. With these tools, you can generate embedded applications for the multitude of 8051 derivatives. Keil provides following tools for 8051 development1.C51 Optimizing C Cross Compiler,2.A51 Macro Assembler,3.8051 Utilities (linker, object file converter, library manager),4.Source-Level Debugger/Simulator,5.Vision for Windows Integrated Development Environment.

6.2 ARM7 ADVANTANAGES IN KEIL SOFTWARE:1. Complete support for Cortex-M, Cortex-R4, ARM7, and ARM9 devices2. Industry-leading ARMC/C++ Compilation Toolchain3. Vision4IDE, debugger, and simulation environment4. KeilRTXdeterministic, small footprint real-time operating system (with source code)5. TCP/IP Networking Suiteoffers multiple protocols and various applications6. USB DeviceandUSB Hoststacks are provided with standard driver classes7. CompleteGUI Libraryfor embedded systems with graphical user interfaces8. ULINKproenables on-the-fly analysis of running applications and records every executed Cortex-M instruction9. CompleteCode Coverageinformation about your program's execution10. Execution ProfilerandPerformance Analyserenable program optimization11. Numerous example projects help you quickly become familiar with MDK-ARM's powerful, built-in features12. CMSISCortex Microcontroller Software Interface Standard compliant

6.3 C COMPILER:In this project a C-Compiler called Turbo C is used for compilation process.Acompileris acomputer program(or set of programs) that transformssource codewritten in aprogramming language(the source language) into another computer language (the target language, often having a binary form known asobject code).The most common reason for converting a source code is to create anexecutableprogram. Turbo Cis anIntegrated Development Environmentandcompilerfor theC programming languagefromBorland. First introduced in 1987, it was noted for its integrated development environment, small size, fast compile speed, comprehensive manuals and low price.6.4 IMPLEMENTATION OF EMBEDDED PROGRAMS:CREATING AND BUILDING PROJECT FILE:These are the simple steps to get off the mark your inning!Step 1: After opening Keil uV4, Go toProjecttab andCreate new vision projectNow Select new folder and give name to Project.Step 2: After Creating project nowSelect your device model. Here, NXP-LPC2148 Step 3: so now your project is created andMessagewindow will appear to add start-up file of your Device click onYesso it will be added to your project folderStep 4: Now go to File and create new file and save it with.Cextension if you will write program in C language or save with.asmforassemblylanguage.i.e.,Led.cStep 5: Now write your program and save it again. You can try example given at end of this tutorial.Step 6: After that on left you see project window [if its not there.go to View tab and click on project window]Now come on Project window.

Right click on targetand click onoptions for targetHere you can change your device also.Clickoutputtab here & checkcreate Hex fileif you want to generate hex fileNow click on ok so it will save changes.Step 7:Now Expand target and you will see source groupRight click on group and click onAdd files to source groupNow add your program file which you have written in C/assembly.You can see program file added under source group.Step 8: Now Click onBuild target.You can find it under Project tab or in toolbar. It can also be done by pressingF7key.Step 9: you can see Status of your program inBuild outputwindow

6.5PROGRAM FOR THIS PROJECT IN KEIL:#include#include#include///////////////////////////////////////////////////////////////#define Fosc 12000000 #define Fcclk (Fosc * 5) #define Fcco (Fcclk * 4) #define Fpclk (Fcclk / 4) * 1 #define UART_BPS19600 //Set buadrate here////////////////////////////////////////////////////////////////unsigned int C [6]={0x20,0x28,0x01,0x0e,0x06,0x80};unsigned int RS=0X01000000;unsigned int EN=0X00400000;unsigned int PORT=0X00003C00;////////////////////////////////////////////////////////////////void LCD_INIT(void);void LCD_CMD(unsigned char );void LCD_DATA(unsigned char );void LCD_DAISPLAY(unsigned char * );////////////////////////////////////////////////////////////////unsigned int ADC_Data1=0;unsigned int ADC_Data2=0;unsigned int ADC_Data4=0;unsigned int ADC_Data5=0;void send_bcd1(int);void ascii(unsigned int);void send_bcd(int);void ADC_Init(void);////////////////////////////////////////////////////////////////void DELAY(unsigned int);////////////////////////////////////////////////////////////////unsigned int aaa;unsigned char rc;void Init_UART0(void);void UART0_SendByte(unsigned char data);void UART0_SendStr(const unsigned char *str);////////////////////////////////////////////////////////////main(){PINSEL0 = 0x00050005;// UART 1 and 0PINSEL1=0x15440000;IODIR0|=0X00003c00; /*(pin p0.10, 11, 12, 13 are used for LCD data line)*/IODIR1=0XF3000000; /*(pin p1.24, p1.25 are used for reg: select and Enable)*/ /*(0/P P1.28 TO P1.31 DEVICES) */ADC_Init();Init_UART0();LCD_INIT();DELAY(100);LCD_CMD(0x01);//title 1lineLCD_CMD(0x80);LCD_DISPLAY(ANDROID MULTI ");LCD_CMD(0xC0);LCD_DISPLAY("SENSOR MONITORING");DELAY(1000);DELAY(1000);

LCD_CMD (0x01);LCD_CMD (0x80);LCD_DISPLAY ("T: F: S: ");LCD_CMD (0xC0);LCD_DISPLAY ("I: L: ");DELAY (1000);while (1){UART0_SendStr ("********************************* ");UART0_SendByte ('\r');UART0_SendByte ('\n');////////////////////////TEMP////////////////////////////////////AD0CR = (AD0CR&0xFFFFFF00)|0x02;//Select AD0.1 for conversion //P0.28AD0CR|= (1 >8) & 0x00FF;ADC_Data5 = ADC_Data1+4;//DELAY (2000);LCD_CMD (0x82);send_bcd (ADC_Data5);//DELAY(1000);UART0_SendStr("TEMP : ");UART0_SendByte((ADC_Data5/10) + 0x30);UART0_SendByte((ADC_Data5%10) + 0x30);UART0_SendStr("deg");UART0_SendByte('\r');UART0_SendByte('\n');/////////////////////////////////////////////////////if(ADC_Data1>45){UART0_SendStr("High Temperature"); UART0_SendStr("TEMP: ");UART0_SendByte((ADC_Data5/10) + 0x30);UART0_SendByte((ADC_Data5%10) + 0x30);UART0_SendStr("deg");UART0_SendByte('\r');UART0_SendByte('\n');DELAY(1000);}///////////////////////LIGHT/////////////////////////////////////*DELAY(1000);aaa=IOPIN0;aaa=aaa & 0X00400000;//p0.22 lightif(aaa==0X00400000){LCD_CMD(0xc2);LCD_DISPLAY("Y");UART0_SendStr("Light: YES");UART0_SendByte('\r');UART0_SendByte('\n');DELAY(100);}else{LCD_CMD(0xC2);LCD_DISPLAY("N");UART0_SendStr("Light: NO");UART0_SendByte('\r');UART0_SendByte('\n');DELAY(100);}////////////////////////SMOKE//////////////////////////////////DELAY(1000);AD0CR = (AD0CR&0xFFFFFF00)|0x08; //Select AD0.1 for conversion //P0.30AD0CR|=(1 >8) & 0x03FF;DELAY(200);LCD_CMD(0x8c);send_bcd1(ADC_Data2);DELAY(100);UART0_SendStr("SMOKE: ");UART0_SendByte((ADC_Data2/100) + 0x30);UART0_SendByte(((ADC_Data2/10)%10) + 0x30);UART0_SendByte((ADC_Data2%10) + 0x30);UART0_SendStr("mV");UART0_SendByte('\r');UART0_SendByte('\n');if(ADC_Data2>200){DELAY(100);UART0_SendStr("Smoke Detected ");UART0_SendByte('\r');UART0_SendByte('\n');UART0_SendStr("SMOKE: ");UART0_SendByte((ADC_Data2/100) + 0x30);UART0_SendByte(((ADC_Data2/10)%10) + 0x30);UART0_SendByte((ADC_Data2%10) + 0x30);UART0_SendStr("mV");UART0_SendByte('\r');UART0_SendByte('\n');DELAY(100);} ////////////////////////MOTION//////////////////////////////////DELAY(100);aaa=IOPIN0;aaa=aaa & 0X00100000;//p0.20 PIR SENSORif(aaa==0X00100000){LCD_CMD(0xCE);LCD_DISPLAY("Y");DELAY(100);UART0_SendStr("MOTION: YES");UART0_SendByte('\r');UART0_SendByte('\n');DELAY(100);} else{LCD_CMD(0xCE);LCD_DISPLAY("N");DELAY(100);UART0_SendStr("MOTION: NO");UART0_SendByte('\r');UART0_SendByte('\n');DELAY(100);} */DELAY(1000);AD0CR = (AD0CR&0xFFFFFF00)|0x04; //Select AD0.1 for conversion //P0.29AD0CR|=(1 >8) & 0x03FF;DELAY(200);//LCD_CMD(0xC2);//send_bcd(ADC_Data4);//DELAY(1000);//UART0_SendStr("HMDTY: ");//UART0_SendByte((ADC_Data4/10) + 0x30);//UART0_SendByte((ADC_Data4%10) + 0x30);//UART0_SendStr("%RH");UART0_SendByte('\r');UART0_SendByte('\n');DELAY(1000); //////////////////////////FIRE//////////////////////////////////DELAY(1000);aaa=IOPIN0;aaa=aaa & 0X00200000;//p0.21 fireif(aaa==0X00200000){LCD_CMD(0x8E);LCD_DISPLAY("N");DELAY(1000);UART0_SendStr("FIRE : NO ");UART0_SendByte('\r');UART0_SendByte('\n');DELAY(1000);} else{LCD_CMD(0x8E);LCD_DISPLAY("Y");DELAY(1000);UART0_SendStr("FIRE : YES ");UART0_SendByte('\r');UART0_SendByte('\n');DELAY(1000);}///////////////////////////////////////////////////DELAY(1000);DELAY(1000);DELAY(1000);DELAY(1000);}}////////////////////////////////////////////////////////////////void LCD_INIT(){unsigned int i;IODIR0|=PORT;IODIR1|=0X01400000;for(i=0;i