Certificate of Approval This is to certify that this report of B. Tech. Final Year project, entitled “SMART HOME SECURITY SYSTEM” is a record of bona-fide work, carried out by SUJOY KUMAR SAHA, SHAHUDULLAH KHAN, MD. JAWAID KHAN under my supervision and guidance. In my opinion, the report in its present form is in partial fulfillment of all the requirements, as specified by the Regent Education and Research Foundation and as per regulations of the West Bengal University of Technology. In fact, it has attained the standard, necessary for submission. To the best of my knowledge, the results embodied in this report, are original in nature and worthy of incorporation in the present version of the report for B. Tech. programme in Electronics and Communication Engineering Guide / Supervisor External Guide __________________________ Mr. SHUBHAJIT CHATTERJEE
__________________________ Mr. Ananda Sankar Kundu
Department of Electronics and Communication Engineering Regent Education and Research Foundation
____________________ Examiner(s)
M.Tech in Mechatronics
____________________________ Head of the Department
Electronics and Communication Engineering Regent Education and Research foundation
ABSTRACT In the recent years of Serious Accidents and Thefts dealing with Temperature and Gas Leakage Monitoring and Control of the Various Households Like Home, Workplaces, and Industries we fail to still keep up the standards. To make things easier for the supervisor, we have made a project which makes everything controllable with a help of a cell phone. Our project is based on overview of a GSM BASED DEVICE CONTROL, GAS LEAKAGE MONITORING, & HOME SECURITY SYSTEM. We came up with this idea of developing a simpler, multipurpose, cost-effective design to control the on-off mechanism of various devices in the field via short message service or SMS. The project is more helpful in case of crisis, the situation being the absence of the supervisor at the work place so that he/she is unable to monitor in person for the purpose of safety (in home or industries). This paper evaluates the development of a Low-cost security system using small PIR (Pyroelectric Infrared) sensor built around a microcontroller. The low-power PIR detectors take advantage of pyroelectricity to detect a human body that is a constant source of Passive Infrared (radiation in the infrared region). The system senses the signal generated by PIR sensor detecting the presence of individuals not at thermal equilibrium with the surrounding environment. Detecting the presence of any unauthorized person in any specific time interval, it triggers an alarm & sets up a call to a predefined number through a GSM modem. This highly reactive approach has low computational requirement, therefore it is wellsuited to surveillance, industrial applications and smart environments. Tests performed gave promising results. “GSM based Control System” implements the emerging applications of the GSM technology. Using GSM networks, a control system has been proposed that will act as an embedded system which can monitor and control appliances and other devices locally using built-in input and output peripherals. This project can be further extended to employ in household and even in various industries appliances where the entire monitor and control various other parameters could also performed at no cost. Among these, this project focuses on the monitor & control of the parameter ‘Temperature, Gas Leakage, and Source of Passive Infrared’; which has been a major parameter of danger in most of the Industry’s and Households leading to a lot of disastrous histories. This project offers users with enormous benefits of simplicity, being compatible to situations where the presence near the machine poses a great threat to safety, needing just basic knowledge of messaging & what more it has a lot of reliability. Keywords: Home Security, Sensors, GSM Network, SMS, Password, Device Control.
ii
TABLE OF CONTENTS CHAPTER NO. I II III
TITLE
PAGE NO.
CERTIFICATE OF APPROVAL ACKNOWLEDGEMENT ABSTRACT
i ii ii
INTRODUCTION
6
Need For the System Motivation Background Summary of Prior Work Summary of Present Work Organization of the Thesis Resource (Software/ Hardware) Used System Operation Flow Diagram
7 8 8 9 10 11 11 12
Embedded System & Microcontroller
14
Application Area Embedded System in Consumer Electronics Computer vs. Embedded System Features In Future Embedded Systems Microcontroller description
15 15 16 16 17
Design Considerations
21
3.1:
HARDWARE
22
3.1.1: 3.1.2: 3.1.3:
Hardware Components Involved SIM300 GSM Modem with Antenna Sensors
22 23 25
3.1.3.1: 3.1.3.2:
Burglar Alarms PIR Motion Sensor Gas Sensing MQ7 Sensor
25 27
3.1.4: 3.1.5: 3.1.6:
12V SPDT Relays 12V & 1Amp Adapter Microcontroller Development Kit
32 33 34
3.1.6.1: 3.1.6.2: 3.1.6.3: 3.1.6.4: 3.1.6.5: 3.1.6.6:
Printed Circuit Board – [PCB] Light Emitting Diode – [LED] Liquid Crystal Display – [LCD] ATMEGA8 Microcontroller IC Supporting ATMEGA8 Microcontroller IC 7805 Voltage Regulator IC
36 37 37 39 41 41
CHAPTER 1 1.1: 1.2: 1.3: 1.4: 1.5: 1.6: 1.7: 1.8: CHAPTER 2 2.1: 2.2: 2.3: 2.4: 2.5: CHAPTER 3
iii
3.1.6.7: 3.1.6.8 : 3.1.6.9: 3.1.6.10: 3.1.6.11:
ADC 8 MHz Crystal Oscillator Electrolytic Capacitors L293D Motor Driver MAX232 Converter
41 42 43 44 52
3.1.7:
Miscellaneous Hardware
52
3.2:
SOFTWARE
51
3.2.1: 3.2.2:
Required Softwares Software Details
52 52
3.2.2.1: 3.2.2.2: 3.2.2.2:
AVR Studio 4.0 Extreme Burner AVR V1.2 Others Involved Softwares
52 59 61
Software & Hardware Design
62
System Hardware & Implementation CODING
63 64
CHAPTER 5
CONCLUSION
75
CHAPTER 6
REFERENCE
79
CHAPTER 4 4.1: 4.2:
iv
CHAPTER 1 INTRODUCTION
v
INTRODUCTION
CHAPTER 1
1. INTORDUCTION GSM Based Device Control is to automate and control electrical devices remotely using the Short Message Service, a tele-service of GSM mobile communication is the main object of this project. This project deals with the monitoring and controlling of a remote system, be it a machine in an industry, or a simple household appliances like a gas stove, a water heater, etc. by using the technology of embedded systems. The tele services of GSM which has a service useful for message transfer, the short message services (SMS), is used in this project. This service offers transmission of messages through the unused channels. Automation is done via this short messaging service of GSM. The project is more helpful in case of crisis, the situation being the absence of the supervisor at the work place so that he/she is unable to monitor in person for the purpose of safety (in industries). This project can be further extended to employ in various industries and even in household appliances where the entire monitor and control various other parameters could also performed at no cost. This project uses “embedded system” as the platform. “Embedded system” is a system, which incorporates in it an intelligent device to control and monitor any events surrounding it. Some of such intelligent devices include microprocessors, microcontrollers, DSPS, etc. This project uses microcontroller based. Among these, this project focuses on the monitor & control of the parameter ‘temperature’, which has been a major parameter of danger in most of the industry’s leading to a lot of disastrous histories. In today’s age of digital technology and intelligent systems, home automation has become one of the fastest developing application-based technologies in the world. The idea of comfortable living in home has since changed for the past decade as digital, vision and wireless technologies are integrated into it. Intelligent homes, in simple terms, can be described as homes that are fully automated in terms of carrying out a predetermined task, providing feedback to the users, and responding accordingly to situations. In other words, it simply allows many aspects of the home system such as temperature and lighting control, network and communications, entertainment system, emergency response and security monitoring systems to be automated and controlled, both near and at a distance. Automated security systems play an important role of providing an extra layer of security through user authentication to prevent break-ins at entry points and also to track illegal intrusions or unsolicited activities within the vicinity of the home (indoors and outdoors). There has been much research done in the design of various types of automated security systems. Sensor-based systems that rely on contact or movement sensors or contact-based systems such as fingerprint and palm print scan or keypad activation that require substantial amount of contact with an input device.
6
Many security systems are based on only a single system. In an event of system failure or intrusion of the user authentication, there is no backup system to monitor the home continually. This shortcoming can be dealt with using multiple security systems (ormulti-layered security systems). However, multisystem implementations will definitely be more demanding in terms of computational cost and organization. This requires careful integration and sharing of resources. Thus, a feasible system should be effective, practical and reasonable in cost. In this paper, we proposed an integrated dual-level sensor based home security system, consisting of two subsystems – PIR sensors, burglar alarm module and fire alarm module. Both subsystems work independently but are incorporated into a single automated system for practical implementation. The organization of this paper is as follows. In section II, the integrated architecture of the system is further elaborated. Finally, section ------ will give the conclusion and future directions. In Microsoft Security Intelligence Report (Shostack et al. 2009, 14), it is suggested that the top data loss threat continued to be stolen equipment such computers, which accounted for 30% of reported data loss incidents. This statement indicates that in the current situation, home security is increasing its value for people to research. Since home networks are easily exposed to vulnerabilities, supervisory control of residential environments has become increasingly important by network computers or even through mobile devices.
1.1. Need for the System The primary objects of the present project to provide a novel means for safely detecting any malfunction of a pressurized gas system in order to prevent accumulation of combustible gases, so that damage or explosion due to such an accumulation of gases is prevented. Another object of the present invention is to provide a novel safety means for detecting the leakage of gas into the area of an appliance when the appliance is in a shutdown condition and not in operation. Yet another object of the present invention is to provide a novel gas detection and monitoring system which is economical to manufacture and which may be readily installed in conventional trailers, boats or the like which are normally dependent upon a stored supply of pressurized gas. Typical installation areas being gas yards (Bullets), gas banks with multi cylinders in manifold, user production departments / utility areas like kitchens. Ideal sensor for use to detect the presence of a dangerous LPG leak in your car or in a service station, storage tank environment. This unit can be easily incorporated into an alarm unit, to sound an alarm or give a visual indication of the LPG concentration. The sensor has excellent sensitivity combined with a quick response time. The sensor can also sense iso-butane, propane, LNG and cigarette smoke. Moreover this system can be further extended to employ in various industries especially in security appliances for business solutions. It can even make things easier for the person who wants to control simple household appliances where the person with the cell phone has the complete monitoring power without being in site.
7
1.2. Motivation Motivation is the activation or energization of goal-oriented behavior. Motivation may be internal or external. The term is generally used for humans but, theoretically, it can also be used to describe the causes for animal behavior as well. According to various theories, motivation may be rooted in the basic need to minimize physical pain and maximize pleasure, or it may include specific needs such as eating and resting, or a desired object, hobby, goal, state of being, ideal, or it may be attributed to less-apparent reasons such as altruism, morality, or avoiding mortality. Motivation is a six phased process beginning from the inner state or need deficiency and ending with need fulfillment. The motivation level is explained below— (1) Need Deficiency, (2) Search & Choice of Strategy, (3) Goal directed behavior, (4) Evaluation of performance, (6) Reevaluation of needs, (5) Reward or Punishment, In the case of our project motivation comes from our be loving professor, some pages of magazines. So motivation comes to us & we involved with this project for last few months and so on. For this idea & the project, we like to thank all Teachers, faculty members, professors, our HOD, our Guide Mr. Shubhajit Chatterjee, and the last not in the least our external guide Mr. Ananda Sankar Kundu.
1.3. Background The new age of technology has redefined communication. Most people nowadays have access to mobile phones and thus the world indeed has become a global village. At any given moment, any particular individual can be contacted with the mobile phone. But the application of mobile phone can not just be restricted to sending SMS or starting conversations. New innovations and ideas can be generated from it that can further enhance its capabilities. Technologies such as Infra-red, Bluetooth, etc which has developed in recent years goes to show the very fact that improvements are in fact possible and these improvements have eased our life and the way we live. Remote management of several home and office appliances is a subject of growing interest and in recent years we have seen many systems providing such controls. These days, apart from supporting voice calls a mobile phone can be used to send text messages as well as multimedia messages (that may contain pictures, graphics, animations, etc). Sending written text messages is very popular among mobile phone users. Instant messaging, as it is also known, allows quick transmission of short messages that allow an individual to share ideas, opinions and other relevant
8
information. We have used the very concept to design a system that acts a platform to receive messages which in fact are commands sent to control different appliances and devices connected to the platform. We have designed a control system which is based on the GSM technology that effectively allows control from a remote area to the desired location. The application of our suggested system is immense in the ever changing technological world. It allows a greater degree of freedom to an individual whether it is controlling the household appliances or office equipments. The need to be physically present in order to control appliances of a certain location is eliminated with the use of our system. Technologies are developing all the time. Although different devices and their handbooks for home users for their home security systems exist in the market, they are often separate and fragmentary. Users are often confused about the various devices in the market. It is also a challenge to install them together through several types of interfaces, ports, and protocols. To remember different pin-codes causes a headache.
1.4. Summary of the Prior Work Technology has advanced so much in the last decade or two that it has made life more efficient and comfortable. The comfort of being able to take control of devices from one particular location has become imperative as it saves a lot of time and effort. Therefore there arises a need to do so in a systematic manner which we have tried to implement with our system. The system we have proposed is an extended approach to automating a control system. With the advancement and breakthroughs in technology over the years, the lives of people have become more complicated and thus they have become busier than before. With the adoption of our system, we can gain control over certain things that required constant attention. The application of our system comes in handy when people who forget to do simple things such as turn ON or OFF devices at their home or in their office, they can now do so without their presence by the transmission of a simple text message from their mobile phone. This development, we believe, will ultimately save a lot of time especially when people don’t have to come back for simple things such as to turn ON/OFF switches at their home or at their office once they set out for their respective work. The objective of this project is to develop a device that allows for a user to remotely control and monitor multiple home/office appliances using a cellular phone. This system will be a powerful and flexible tool that will offer this service at any time, and from anywhere with the constraints of the technologies being applied. Possible target appliances include (but are not limited to) climate control system, security systems, lights; anything with an electrical interface. The proposed approach for designing this system is to implement a microcontroller-based control module that receives its instructions and command from a cellular phone over the GSM network. The microcontroller then will carry out the issued commands and then communicate the status of a given appliance or device back to the cellular phone.
9
1.5. Summary of Present Work The project here is all about a Home security system, in this project we have planned to develop a Home security system. Home security system for detecting an intrusion into a monitored area by a PIR detector. A security system has a flee-standing intrusion detector. The free standing intrusion detector has a transmitter coupled with a portable receiver to alert a homeowner that an intrusion has taken place or occurred within a pre-set time period. The area under surveillance is monitored by an infrared detector which activates the transmitter upon the detection of abrupt differences in infrared radiation levels, associated with the presence of a warm body in an otherwise equilibrated environment. A radio signal is emitted by the transmitter which is received by the portable hand-held remote receiver. A first signal, indicating that an intrusion has been detected less than a preselected period of time in the past in the monitored areas, is displayed on the receiver for that preselected period of time. After the preselected period of time has elapsed, a second signal is generated to indicate that the intrusion took place at a time greater than the preselected period of time in the past and that the probability of the intruder still being present is less. Once the intrusion detector is activated, the signal is continuously transmitted to the portable receiver until the intrusion detector has been reset. A security system for a home comprising: A free standing intrusion detector to be set in an area of said home to be protected, said free standing intrusion detector comprising: An intrusion detector to generate an intrusion signal in response to an intrusion into said area; A radio signaling transmitter responsive to said intrusion signal to transmit a radio signal means for modulating said radio signal for a predetermined time in response to said intrusion signal; and time delay means for delaying the actuation of said intrusion detector to allow a person sufficient time to exit said area to be protected after setting said intrusion detector; and a portable receiver adapted to be hand carried comprising. Means for generating an output signal in response to said radio signal. Display means for generating a visual display indicating an intrusion has occurred in response to said output signal. Basically, the home security system is includes
Wired and wireless network
Backup device, e.g. Apple Time Capsule
Web-Camera monitoring system (movement detector)
Electric locks
Alarms (mobile phone, e-mail) warnings
Other security devices.
The proposed integration architecture incorporates subsystems – PIR sensors, burglar alarm module and fire alarm module, into a single automated architecture for practical implementation in intelligent home environments. The figure shows a block diagram of the proposed system architecture and its setup and connectivity. The modules work independently and parallel but share computational resources
10
1.6. Organization of the Thesis Our project is based on GSM Based Home Security System, which have many written and researchable thesis in electronics era. At fast we can say that KEMI-TORNIO UNIVERSITY OF APPLIED SCIENCES made a project on Infrastructure Plan for Home Security System which was based on Tong Yao Bachelor’s thesis of the Degree Programme in Business Administration Business Information Technology Tornio 2011
And the most importantly thesis written by K. Gill, S.H. Yang, F. Yao and X. Lu, “ A Zigbee, Based on Home Automation system”, IEEE Transactions on Consumer Electronics, Vol.55,No.2, (2009), pp. 422-430 Has a great inspiration in our project.
.
Picture 1: An interview in Lukko Oy in Tornio, Finland The following picture presents several of the devices in Lukko Oy where the interview was
implemented. The devices are different kinds of movement detector, Web-camera, smoke sensor and PIR (Infrared Ray) detector
1.7. Resources (Software/Hardware) Uses Gratitude to our beloved Professors, Guide, and Supervisor for their help & continuous support for completing our projects. For the resourceful & continuous help many many thanks to them. Our project utilizes both the Hardware and Software resources. Softwares we use in our project are as follows -
AVR STUDIO 4.0
SERIAL TERMINAL
EXTREME BURNER AVR V1.2
The others application software we use to complete our project are as –
WINDOWS 7 ULTIMATE
MICROSOFT OFFICE WORD AND POWERPOINT
PICASA 3
11
GOOGLE CHROME
On the other hand all Hardware resource comes bellow—
Printed Circuit Board – [PCB]
ATMEGA8 Microcontroller IC
Supporting ATMEGA8 Microcontroller IC
7805 Voltage Regulator IC
ADC
L293D Motor Driver
MAX232 Converter
8 MHz Crystal Oscillator
Electrolytic Capacitors
Ceramic Substrate Capacitors
Liquid Crystal Display – [LCD]
Light Emitting Diode – [LED]
Burglar Alarms PIR Motion Sensor
Gas Sensing MQ7 Sensor
PVC & Connecting Wires &Plugs
12V SPDT Relays
SIM300 GSM Modem with Antenna
Microcontroller Development Kit
12 V 1 Amp Adapter
15 watt Bulbs & Holder
Miscellaneous Hardware
This Hardware Parts & software Application are used in our project from the very fast day of our project work. And many other miscellaneous components are also used in our work. So with this various components we complete our project successfully.
1.8. System Operation Flow Diagram Assuming that the control unit is powered and operating properly, the process of controlling a device connected to the interface will proceed through the following steps; • The remote user sends text messages including commands to the receiver. • GSM receiver receives messages sent from the user cell phone. • GSM receiver decodes the sent message and sends the commands to the microcontroller.
12
• Microcontroller issues commands to the appliances and the devices connected will switch ON/OFF. • GSM Module sends back Information to the Remote user.
APPLIANCES
CELL PHONE
Send Text Message
SEND MESSAGE
GSM
SEND MESSAGE
CHIP
Communicate with Network Transfer data to Microcontroller
MICROCONTROLLE R
Decode incoming Message Send instruction to appliance Monitor Completion
ISSUE COMMAND
PERFORM REQUIRED INSTRUCTIONS
LAMP
Security System
MQ7 GAS SENSOR
FIGURE 1: System Operation Flow Diagram
13
CHAPTER
2
EMBEDDED SYSTEM &
MICROCONTROLLER
14
EMBEDDED SYSTEM & MICROCONTROLLER
CHAPTER 2
2. Embedded System An embedded system is a computer system designed to perform one or a few dedicated functions, often with real-time computing constraints. It is embedded as part of a complete device often including hardware and mechanical parts. In contrast, a general-purpose computer, such as a personal computer, is designed to be flexible and to meet a wide range of an end-user's needs. Embedded systems are stand alone computing devices or centers usually dedicated to performing limited computing functions reliably, securely and with minimum upkeep costs.
2.1 Application Area Home Appliances Automobile/ Aerospace Personal Gadgets Home/ Office Automation Systems Robotics Advertisement Displays And many other areas
2.2 Embedded System in Consumer Electronics
15
2.3 Computer vs. Embedded System Computers are Flexible, can run many programs at a time. On the other hand, embedded systems are designed for specific applications and generally do not support multitasking. Embedded systems are designed to get Lower cost Improved Reliability Meet Real-Time Constraints Energy Efficiency (draw minimum power for the purpose) Custom voltage/power requirements (VDC: 12, 14, 24, 72...) Security (hacker proof) Reliability (work without failure for years) Environment (broad temperature range, sealed from chemicals, radiation) Efficient Interaction with user (fewer buttons, touch) Integrate with design
2.4 Features Expected In Future Embedded Systems Energy harvesting or energy scavenging as replacement for power system. Smaller footprint to allow coupling to the device itself. Fault detection/self correcting algorithms along with backup processors are expected to become common in future. Hermetically sealed for biological or clean room applications Tough and rough: can be dropped from 5 feet, can withstand pressure Withstand -40 C to 85 C Efficient power supply capable of running on AC, or 12, 14, 24, 72, 120 VDC Custom user interface: touch screen.
16
2.5 What Is A MICROCONTROLLER? It is a highly integrated circuit that contains a processor, memory, input and output ports, timers, ADC and many other on-chip functional blocks.
2.5.1 How to Understand a Microcontroller? 1. Understand the Architecture 2. Understand the Functions of pins and the External Connections 3. Program the Microcontroller
2.5.2 Basics of 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 microprocessors 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 microprocessor, 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 non-digital electronic systems. Some microcontrollers may use four-bit words and operate at clock rate frequencies as low as 4 kHz, for low power consumption (single-digit mill watts or microwatts). They will generally have the ability to retain functionality while waiting for an event such as a button press or other interrupt; power consumption while sleeping (CPU clock and most peripherals off) may be just nano watts, making many of them well suited for long lasting battery applications. Other microcontrollers may serve performance-critical roles, where they may need to act more like a digital signal processor (DSP), with higher clock speeds and power consumption.
2.5.3 Historical Development of the Microcontroller The first single-chip microprocessor was the 4-bit Intel 4004 released in 1971, with the Intel 8008 and other more capable microprocessors becoming available over the next several
17
years. However, both processors required external chips to implement a working system, raising total system cost, and making it impossible to economically computerize appliances. The Smithsonian Institution says TI engineers Gary Boone and Michael Cochran succeeded in creating the first microcontroller in 1971. The result of their work was the TMS 1000, which went commercial in 1974. It combined read-only memory, read/write memory, processor and clock on one chip and was targeted at embedded systems. Partly in response to the existence of the single-chip TMS 1000. Intel developed a computer system on a chip optimized for control applications, the Intel 8048, with commercial parts first shipping in 1977.It combined RAM and ROM on the same chip. This chip would find its way into over one billion PC keyboards, and other numerous applications. At that time Intel's President, Luke J. Valenter stated that the microcontroller was one of the most successful in the company's history, and expanded the division's budget over 25%.
Most microcontrollers at this time had two variants. One had an erasable EPROM program memory, with a transparent quartz window in the lid of the package to allow it to be erased by exposure to ultraviolet light. The other was a PROM variant which was only programmable once; sometimes this was signified with the designation OTP, standing for "one-time programmable". The PROM was actually exactly the same type of memory as the EPROM, but because there was no way to expose it to ultraviolet light, it could not be erased. The erasable versions required ceramic packages with quartz windows, making them significantly more expensive than the OTP versions, which could be made in lower-cost opaque plastic packages. For the erasable variants, quartz was required, instead of less expensive glass, for its transparency to ultraviolet—glass is largely opaque to UV—but the main
cost
differentiator
was
the
ceramic
package
itself.
In
1993,
the
introduction
of EEPROM memory allowed microcontrollers (beginning with the Microchip PIC16x84 ) to be electrically erased quickly without an expensive package as required for EPROM, allowing both rapid prototyping, and In System Programming. (EEPROM technology had been available prior to 18
this time, but the earlier EEPROM was more expensive and less durable, making it unsuitable for low-cost mass-produced microcontrollers.) The same year, Atmel introduced the first microcontroller using Flash memory, a special type of EEPROM. Other companies rapidly followed suit, with both memory types. Nowadays microcontrollers are cheap and readily available for hobbyists, with large online communities around certain processors.
2.5.4 List of Common Microcontroller 1. AMCC
13. Holtek
25. Renesas Electronics
2. Altera
14. Infineon
26. Rockwell
3. Analog Devices
15. Intel
27. Silicon Laboratories
4. Atmel
16. Lattice Semiconductor
28. Silicon Motion
5. Charmed Labs
17. Maxim Integrated
29. Sony
6. Cypress Semiconductor
18. Microchip Technology
30. STMicroelectronics
7. Dallas Semiconductor
19. National Semiconductor 31. Texas Instruments
8. ELAN Microelectronics Corp.
20. NEC
32. Toshiba
9. Energy Micro
21. Panasonic
33. Ubicom
10. EPSON Semiconductor
22. Parallax
34. Xemics
11. FreescaleSemiconductor
23. NXP Semiconductors
35. Xilinx
12. Fujitsu
24. Rabbit Semiconductor
36. XMOS 37. ZiLOG
2.5.5 General architecture of a microcontroller The architecture of a microcontroller depends on the application it is built for. For example, some designs include usage of more than one RAM, ROM and I/O functionality integrated into the package. The architecture of a typical microcontroller is complex and may include the following: 1.
A CPU, ranging from simple 4-bit to complex 64-bit processers.
2.
Peripherals such as timers, event counters and watchdog.
3.
RAM (volatile memory) for data storage. The data is stored in the form of registers, and the general-purpose registers store information that interacts with the arithmetic logical unit (ALU).
4.
ROM, EPROM, EEPROM or flash memory for program and operating parameter storage.
5.
Programming capabilities.
6.
Serial input/output such as serial ports.
7.
A clock generator for resonator, quartz timing crystal or RC circuit.
8.
Analog-to-digital convertors.
19
9.
Serial ports.
10.
Data bus to carry information.
2.5.6 Digital Logic V/S Microcontroller Digital Logic
Input
LOGIC (AND, ORetc)
Output
Microcontroller
Input
Program
2.5.7 Features
4 KB on chip program memory.
128 bytes on chip data memory (RAM).
4 reg banks.
128 user defined software flags.
8-bit data bus
16-bit address bus
32 general purpose registers each of 8 bits
16 bit timers (usually 2, but may have more, or less).
3 internal and 2 external interrupts.
Bit as well as byte addressable RAM area of 16 bytes.
Four 8-bit ports, (short models have two 8-bit ports).
16-bit program counter and data pointer.
1 Microsecond instruction cycle with 12 MHz Crystal. 20
Output
CHAPTER 3 DESIGN CONSIDERATIONS
21
CHAPTER DESIGN CONSIDERATIONS
3
3.1. HARDWARE The proposed integration architecture incorporates subsystems – PIR sensors, burglar alarm module and fire alarm module, Device control module into a single automated architecture for practical implementation in intelligent home environments. The figure shows a block diagram of the proposed system architecture and its setup and connectivity. The modules work independently and parallely but share computational resources. So in our project module we need the microcontroller based hardware system and other hand AVR STUDIO based & C compiler based means programming based software part as well as required.
3.1.1. Hardware Components Involved To make the basic hardware part of our project many electronics and electrical components required. At our project the all needed hardware components are written bellow—
Microcontroller Development Kit Printed Circuit Board – [PCB] ATMEGA8 Microcontroller IC Supporting ATMEGA8 Microcontroller IC 7805 Voltage Regulator IC Liquid Crystal Display – [LCD] Light Emitting Diode – [LED] ADC 8 MHz Crystal Oscillator Electrolytic Capacitors Ceramic Substrate Capacitors L293D Motor Driver MAX232 Converter
SIM300 GSM Modem with Antenna
Burglar Alarms PIR Motion Sensor
Gas Sensing MQ7 Sensor
12V SPDT Relays
12 V 1 Amp Adapter
PVC & Connecting Wires &Plugs
15 watt Bulbs & Holder
Miscellaneous Hardware
22
3.1.2. SIM300 GSM Modem 3.1.2.1. INTRODUCTION Description of the hardware interface of the SIMCOM SIM300 module that connects to the specific application and the air interface are written bellow. As SIM300 can be integrated with a wide range of
applications,
all
functional
components of SIM300 are described in great detail. Designed for global market, SIM300 is a Tri-band GSM/GPRS engine that works on frequencies EGSM 900 MHz, DCS 1800 MHz and PCS1900 MHz SIM300 provides GPRS multi-slot class 10 capabilities and support the GPRS coding schemes CS-1, CS-2, CS-3
and
CS-4.
With
a
tiny
configuration of 40mm x 33mm x 2.85 mm, SIM300 can fit almost all the
space
requirement
in
your
application, such as Smart phone, PDA phone and other mobile device. Picture 2: SIM300 GSM Module The physical interface to the mobile application is made through a 60 pins 0.5 pitch board-toboard connector, which provides all hardware interfaces between the module and customers’ boards except the RF antenna interface. The SIM300 is designed with power saving technique, the current consumption to as low as 2.5mA in SLEEP mode. The SIM300 is integrated with the TCP/IP protocol, Extended TCP/IP AT commands are developed for customers to use the TCP/IP protocol easily, which is very useful for those data transfer applications. The power supply of SIM300 is from a single voltage source of VBAT= 3.4V...4.5V. This GSM Modem can accept any GSM network operator SIM card and act just like a mobile phone with its own unique phone number. Advantage of using this modem will be that you can use its RS232 port to communicate and develop embedded applications. Applications like SMS Control, data transfer, remote control and logging can be developed easily. The modem can either be connected to PC serial port directly or to any microcontroller. It can be used to send and receive SMS or make/receive voice calls.
23
3.1.2.2. APPLICATIONS SMS based Remote Control & Alerts Security Applications Sensor Monitoring GPRS Mode Remote Data Logging 3.1.2.3. FEATURES Highly Reliable for 24x7 operations with Matched Antenna Status of Modem Indicated by LED Simple to Use & Low Cost Quad Band Modem supports all GSM operator SIM cards
3.1.2.4. POWER SUPPLY REQUIREMENT Use DC Power Adaptor with following ratings · DC Voltage: 12V · DC Current Rating at least: 1A · DC Socket Polarity: Centre +ve & Outside –ve · Current consumption in normal operation 250mA, can rise up to 1Amp peak while transmission so your power supply should be able to handle at least 1Amp current. Power supply is included in the packaging of this product. SERIAL CABLE DETAILS Serial Cable provided has following pins connected with RS232 level (+12V / 12V) output Pin 2 is RS232 level TX output Pin 3 is RS232 level RX input Pin 5 is Ground
Our project is based on GSM Services, so one of the main hardware components
is
this
SIM300
GSM
Module. And the figure ahead of this section we used in our project.
PICTURE 3: Our Project’s GSM Module
24
3.1.3. SENSOR For various type of detection in the house, we used two type of sensor in our project. One of them is use to detect passive infrared radiation & motion of a human body. And the other one detect gas leakage or presence of gas in the environment. This two type of sensor are written bellow- PIR Motion Sensor. MQ7 Gas Sensor.
3.1.3.1. PIR Motion Sensor PIR is basically made of Pyroelectric sensors to develop an electric signal in response to a change in the incident thermal radiation. Every living body emits some low level radiations and the hotter the body, the more is emitted radiation. Commercial PIR sensors typically include two IR-sensitive elements with opposite polarization housed in a hermetically sealed metal with a window made of IR-transmissive material
(typically
coated
silicon to protect the sensing element). When the sensor is idle, both slots detect the same amount of IR, the ambient amount radiated from the room or walls or outdoors. When a warm body like a human or an animal
passes by, it
first
intercepts one half of the PIR sensor which causes a positive differential change between the two halves. When the warm body leaves the sensing area, the reverse happens, whereby the sensor generates a negative differential change. These change pulses are what is detected. In order to shape the FOV, i.e. Field Of View
FIGURE 2: PIR sensor output waveform of the sensor, the detector is equipped with lenses in front of it. The lens used here is inexpensive and lightweight plastic materials with transmission characteristics suited for the desired wavelength range. To cover much larger area, detection lens is split up into multiple sections, each section of which is a Fresnel lens. Fresnel lens condenses light. Providing a larger range of IR to the sensor it can span over several tens of degree width. Thus total configuration improves immunity to changes in background temperature, noise 25
or humidity and causes a shorter settling time of the output after a body moved in or out the FOV. Along with pyroelectric sensor, a chip named Micro Power PIR Motion Detector IC has been used. This chip takes the output of the sensor and does some minor processing on it to emit a digital output pulse from the analog sensor. Schematic of PIR sensor output waveform is shown in Fig. 2. For triggering purpose, there are three dedicated pins in the PIR module: HIGH, LOW and COMMON. When connecting up LOW and COMMON pins, the output turns on and off every second or so when moving in front of it. That is called "non-retriggering" and shown in Fig. 3(a). When connecting up HIGH and COMMON pins, the output stay on the entire time that something is moving. That is called "retriggering" and shown in Fig. 3(b).
PIR Sensor
Detected Motion Jumper Setting
Output
(a)
PIR Sensor
Detected Motion Jumper Setting
Output
(b) Figure 3: (a) Non-Retriggering (b) retriggering waveforms PIR sensor module: The PIR sensor module is fed from the output of fixed output voltage regulator IC LM7805. PIR positive input terminal is fed with a +5V supply and negative terminal is grounded. PIR sensor module output pin is connected to MCU pin. For re-triggering purpose, a jumper (JP) is attached on the COMMON (C) pin and HIGH (H) pin.
Sensor and signal processing segment As the jumper of PIR sensor module is placed between C and H, the output will stay on the entire time something is moving. The regulator IC serves regulated +5V to the LM35 and PIR sensor
26
module. Prior to any operation, external interrupt is disabled in software of MCU. When the mechanical switch is closed, pin RBO gets an input voltage. This sets the system to run. The analog voltage output from LM35 is taken and converted to an equivalent binary value which represents the ambient temperature. As PIR sensor module does not person satisfactorily below 15° C temperature, MCU monitors the temperature and light LED on pin RC3 when the temperature is equal to or greater than the critical temperature [5]. After the LED is on, the MCU waits a pre-defined time for the place to be fully evacuated. After that time is over, the system is online. After activation of the system, if there is any movement on that place within the coverage region of the PIR sensor module, it outputs a pulse which is taken as input by MCU. MCU then
Figure 4: Sensor and signal processing segment waits a pre defined time and checks for that signal again. This is done for avoiding false triggering.
Alarm segment RC4 remains HIGH right from the beginning. Thus, the output pin IQ of 74LS75 stays LOW and the alarm does not ring. If the signal is still present during the second check, MCU makes pin RC4 LOW. This makes a HIGH on IQ of 74LS75 and the alarm rings. RELATED WORKS Today’s indoor security systems built with various sensors such as ultrasonic detectors, microwave detectors, photoelectric detectors, infrared detectors etc. Each of these systems has its own limitations. As an example, photo-electric beam systems detect the presence of an intruder by transmitting visible or infrared light beams across an area, where these beams maybe obstructed. But the drawback lies within it if the intruder is aware of the presence of this system. Despite of having strong dependence on surrounding environmental status, pyroelectricity has become a widely used detection parameter because of simplicity and privilege of interfacing to the digital systems. Now, it is extensively used for intruder 27
detection, smart environment sensing, and power management applications. Several works have been conducted in various applications. Intelligent fireproof and theft-proof alarm system [1], GSM (Global System for Mobile) network based home safeguard system [2], human tracking system [3] and intruder detection systems [4] are some notable works done previously based on pyroelectricity sensing technique. Our work introduces a low-cost security system solution. Utilization of existing cellular network to alert and inform the system owner about the security breach is made to cope up with ever increasing demand for cheap but reliable security system. The proposed prototype system is implemented and tested for the desired functionalities. Fig. 8 shows the test bed. The green and red LEDs are employed to indicate the temperature above optimal level and the alarm respectively. The function of mechanical switch is done manually through a connecting wire. The system made 5 calls to a pre-specified cell phone number in 5 test runs which yields a hundred percent success rate. The whole test procedure is done in a laboratory having the mentioned criteria for optimal performance. Based on several experiments conducted under various conditions, it is verified that this system can resolve the presence of any warm body within the coverage area and execute subsequent actions. In order for a PIR sensor to work well most of the time, it is designed with certain limitations. A PIR sensor cannot detect a stationary or very slowly moving body. If the sensor was set to the required sensitivity, it would be activated by the cooling of a nearby wall in the evening, or by very small animals. Similarly, if someone walks straight towards a PIR sensor, it will not detect them until they are very close by. PIR sensors are temperature sensitive - they work optimally at ambient air temperatures of around 15-20 degree Celsius. If the temperature is over 30 degree Celsius, the field of view narrows and the sensor will be less sensitive. Alternatively, if the temperature is below 15 degree Celsius, the field of view widens and smaller or more distant objects will activate the sensor [5]. On cold nights, the difference in temperature between a people, e.g. normal body temperature is 37°C and the outside air temperature is relatively large, giving an apparent increase in performance of the sensor. On hot nights, this difference in temperature is relatively small and a decrease in performance of the sensor can be expected [7]. Moreover, the PIR sensors are sensitive to exposure to direct sunlight and direct wind from heaters and air conditioners. Precaution is required if there are pets in the house. PIR's are sensitive enough to detect dogs and cats. There are special lens available or a tape can be put on lower part of the existing lens, so as to avoid detection close to the ground. At the same time, it should be kept in mind that the intruder can also crawl and avoid detection. So placement and subsequent testing of PIR sensor modules' is a must to avoid false alarms. These factors need to be kept in mind to ensure the proper operation of this system.
3.1.3.2. MQ7 GAS Sensor Sensitive material of MQ-7 gas sensor is SnO2, which with lower conductivity in clean air. It make detection by method of cycle high and low temperature, and detect CO when low temperature (heated by 1.5V). The sensor’s conductivity is higher along with the gas concentration rising. When high
28
temperature (heated by 5.0V), it cleans the other gases adsorbed under low temperature. Please use simple electro circuit, Convert change of conductivity to correspond output signal of gas concentration. MQ-7 gas sensor has high senility to Carbon Monoxide. The sensor could be used to detect different gases contains CO; it is with low cost and suitable for different application. Character Configuration *Good sensitivity to Combustible gas in wide range * High sensitivity to Natural gas * Long life and low cost * Simple drive circuit FEATURES * High sensitivity to carbon monoxide * Stable and long life
Application * Domestic gas leakage detector * Industrial CO detector * Portable gas detector * Protection from any gas leakage in cars * Large industries which uses gas as their production
FIGURE: Character Configuration
FIGURE: Standard circuit
If the detected gas is LPG, Butane and propane which is heavier than normal air, Install the gas leak alarm about 1.00 meter above the ground, adversely, For the Natural gas, Methane, coal gas, and CO, which is lighter than the normal air, Install gas leak alarm about 1 meter below the roof, Both of them are should be with good air circulation. They are used in gas leakage detecting equipments in family, Car and industry, are suitable for detecting of LPG, iso-butane, propane, LNG, avoid the noise of alcohol and cooking fumes and cigarette smoke. Resistance value of MQ-7 is difference to various kinds and various concentration gases. So, when using these components, sensitivity adjustment is very necessary. we recommend that you calibrate the detector for 200ppm CO in air and use value of Load resistance that( RL) about 10 KΩ(5KΩ to 47 KΩ).
29
When accurately measuring, the proper alarm point for the gas detector should be determined after considering the temperature and humidity influence. The sensitivity adjusting program: a. Connect the sensor to the application circuit. b. Turn on the power; keep preheating through electricity over 48 hours. c. Adjust the load resistance RL until you get a signal value which is respond to a certain carbon monoxide concentration at the end point of 90 seconds. d. Adjust the another load resistance RL until you get a signal value which is respond to a CO concentration at the end point of 60 seconds .
Block Diagram In this circuit we used MQ-6 sensor for gas leakage detection. MQ-6 sensor composed by micro AL2O3 ceramic tube, Tin Dioxide (SnO2) sensitive layer, measuring electrode and heater are fixed into a crust made by plastic and stainless steel net. The heater provides necessary work conditions for work BUZZER
LPG/CNG GAS SENSOR
ATMEGA8 MICROCONTROLLER
DISPLAY UNIT
STEPPER MOTOR DRIVER
STEPPER MOTOR
FIGURE: Block Diagram
of sensitive components. The enveloped MQ-6 has 6 pin, 4 of them are used to fetch signals, and other 2 are used for providing heating current. Here MQ-6 sensor works on basics of combustion process, and output is given in variable voltage form, so, when LPG gas is leakage voltage at the output pin of MQ-6 is increased and we use IC2 (Op-amp LM324) as a comparator for compare the LPG leakage with respect to normal condition. Output of comparator is fed to IC1 microcontroller (ATMEL 89S8253) and corresponding coding LCD is display gas leakage and give another instruction to stepper motor via ULN2803 to turn 90o to turn off the regulator of gas tank. Temperature sensor DS18B20 is continuously communicated with
30
Microcontroller and display temperature at LCD. If temperature is more than 50o then fire alarm is activated and display fire on LCD.
MQ7 GAS Sensor MQ-6 gas sensor composed by micro AL2O3 ceramic tube, Tin Dioxide (SnO2) sensitive layer, measuring electrode and heater are fixed into a crust made by plastic and stainless steel net. The heater provides necessary work conditions for work of sensitive components. The enveloped MQ-6 has 6 pin, 4 of them are used to fetch signals, and other 2 are used for providing heating current.
DISPLAY UNIT It is 16*2 LCD that shows the Tag ID number as instructed by the microcontroller.
MICROCONTROLLER DETAILS The microcontroller used here is a common 8 bit Atmel microcontroller AT89s8253.It is a low-power, high-performance CMOS 8-bit microcontroller with12K bytes of In-System Programmable (ISP) Flash program memory and 2K bytes of EEPROM data memory. It has 32 programmable input output lines.
FEATURES • 12K Bytes of In-System Programmable (ISP) Flash Program Memory • SPI Serial Interface for Program Downloading • Endurance: 10,000 Write/Erase Cycles • 2K Bytes EEPROM Data Memory • Endurance: 100,000 Write/Erase Cycles • 2.7V to 5.5V Operating Range • Fully Static Operation: 0 Hz to 24 MHz (in x1 and x2 Modes) • Three-level Program Memory Lock • 256 x 8-bit Internal RAM • 32 Programmable I/O Lines • Three 16-bit Timer / Counters • Nine Interrupt Sources • Enhanced UART Serial Port with Framing Error Detection and Automatic Address Recognition
• Enhanced SPI (Double Write/Read Buffered) Serial Interface • Programmable Watchdog Timer
31
APPLICATIONS Gas leak detection system Fire/Safety detection system Gas leak alarm Gas detector
FEATURES High sensitivity LPG, iso-butane, propane Small sensitivity to alcohol, smoke Fast response Wide detection range Stable performance and long life Simple drive circuit
ADVANTAGE It is use also house as LPG leakage detection It also detects alcohol so it is used as liquor tester. The sensor has excellent sensitivity combined with a quick response time
DISADVANTAGES 1. It is little sensitive to smoke, then in kitchen it is not completely& perfectly response for LPG gas leakage. 2. It works only when at 5V power supply is given. 3. Its sensitivity depends on Humidity and temperature.
3.1.4. 12V SPDT Relays NC: - Normally Connected NO: - Normally Open COM: - Common The relay driver is used to isolate both the controlling and the controlled device. The relay is an electromagnetic device, which consists of solenoid, moving contacts (switch) and restoring spring and consumes comparatively large amount of power. Hence it is possible for the interface IC to drive the relay satisfactorily. To enable this, a driver circuitry, which will act as a buffer circuit, is to be incorporated between them. The driver circuitry senses the presence of a “high” level at the input and 32
drives the relay from another voltage source. Hence the relay is used to switch the electrical supply to the appliances. From the figure when we connect the rated voltage across the coil the back emf opposes the current flow but after the short time the supplied voltage will overcome the back emf and the current flow through the coil increase. When the current is equal to the activating current of relay the core is magnetized and it attracts the moving contacts. Now the moving contact leaves from its initial position denoted “(N/C)” normally closed terminal which is a fixed terminal. The common contact or moving contact establishes the connection with a new terminal which is indicated as a normally open terminal “(N/O)”. Whenever, the supply coil is withdrawn the magnetizing force is vanished. Now, the spring pulls the moving contact back to initial position, where it makes a connection makes with N/C terminal. However, it is also to be noted that at this time also a back emf is produced. The withdrawal time may be in microsecond, the back emf may be in the range of few kilovolts and in opposite polarity with the supplied terminals the voltage is known as surge voltage. It must be neutralized or else it may damage the system.
3.1.5. 12V & 1Amp Adapter 12V 1Amp power Adapter is need in our project to give the hardware part continuous 12v DC supply. Power supply is a reference to a source of electrical power. A device or system that supplies electrical or other types of energy to an output load or group of loads is called a power supply unit or PSU. The term is most commonly applied to electrical energy supplies, less often to mechanical ones, and rarely to others. Here in our application we need a 5v DC power supply for all electronics involved in the project. This requires step down transformer, rectifier, voltage regulator, and filter circuit for generation of 5v DC power. This is the working principal of 12V 1A Adapter.
33
3.1.6. Microcontroller Development Kit There is no need to mention the need of the Embedded Systems in day to day life. From Microwave Oven to Refrigerator, from Door Access Control to Security Systems, from Manufacturing unit to Process control applications everywhere you can find its application. Embedded systems design should be cost effective as well as reliable. The Atmega8 is a low cost yet very powerful RISC microcontroller with lots of internal resources. This tutorial Guide you to start with ATMEGA8, its internal resources & also external Devices.
FEATURES 1. Atmega8 Microcontroller 2. 8k CODE MEM 3. 1 Kb RAM 4. In system PROGRAMMING 5. 512byte EEPROM 6. 16x2 LCD Display 8. 6 Channel 10 Bit ADC 9. XBEE INTERFACE 10. 3 LEDs. 11. 3 INPUT KEY. 12. 2xdc MOTOR DRIVE (l293D)
Features Of the ATMEGA 8 Microcontroller Popular 8 bit microcontroller of the AVR series. Salient features include Advanced RISC Architecture 130 Powerful Instructions – Most Single-clock Cycle Execution 32 × 8 General Purpose Working Registers Fully Static Operation Up to 16MIPS Throughput at 16MHz On-chip 2-cycle Multiplier 8Kbytes of In-System Self-programmable Flash program memory 512Bytes EEPROM 1Kbyte Internal SRAM
34
Identifying the Components LCD
USB
LEDs
DC Socket
Programmer IC
Motor Output
KEYs
Main Microcontroller
Pin Configuration
35
XBEE
7805
ADC Inputs
3.1.6.1 Printed Circuit Board – [PCB] It is used to mechanically support and electrically connect Electrical components using conductive pathways, tracks or signal traces etched from copper sheets laminated onto anonconductive substrate. It is also referred to as printed wiring board (PWB) or etched wiring board. A PCB populated with electronic components is a printed circuit assembly (PCA), also known as a printed circuit board assembly (PCBA). Printed circuit boards are used in virtually all but the simplest commercially-produced electronic devices. PCBs are inexpensive, and can be highly reliable. They require much more layout effort and higher initial cost than either wire wrap or point-to-point construction, but are much cheaper and faster for highvolume production; the production and soldering of PCBs can be done by totally automated equipment. Much of the electronics industry's PCB design, assembly, and quality control needs are set by standards that are published by the IPC organization. Development of the methods used in modern printed circuit boards started early in the 20th century. In 1903, a German inventor, Albert Hanson, described flat foil conductors laminated to an insulating board, in multiple layers. Thomas Edison experimented with chemical methods of plating conductors onto linen paper in 1904. Arthur Berry in 1913 patented a print-and-etch method in Britain, and in the United States Max Schoop obtained a patent[1] to flame-spray metal onto a board through a patterned mask. Charles Durcase in 1927 patented a method of electroplating circuit patterns.
36
3.1.6.2. Light Emitting Diode – [LED] A light-emitting diode (LED) is a semiconductor light source.[6] LEDs are used as indicator lamps in many devices and are increasingly used for other lighting. Appearing as practical electronic components in 1962,[7] early LEDs emitted low-intensity red light, but modern versions are available across the visible, ultraviolet, and infrared wavelengths, with very high brightness. When a light-emitting diode is switched on, electrons are able to recombine with holes within the device, releasing energy in the form of photons. This effect is called electroluminescence and the color of the light (corresponding to the energy of the photon) is determined by the energy band gap of the semiconductor. An LED is often small in area (less than 1 mm2), and integrated optical components may be used to shape its radiation pattern.[8] LEDs present many advantages over incandescent light sources including lower energy consumption, longer lifetime, improved physical robustness, smaller size, and faster switching. However, LEDs powerful enough for room lighting are relatively expensive and require more precise current and heat management than compact fluorescent lamp sources of comparable output. Light-emitting diodes are used in applications as diverse as aviation lighting, digital microscopes, automotive lighting, advertising, general lighting, and traffic signals. LEDs have allowed new text, video displays, and sensors to be developed, while their high switching rates are also useful in advanced communications technology. Infrared LEDs are also used in the remote control units of many commercial products including televisions, DVD players and other domestic appliances. LEDs are also used in sevensegment display. LED falls within the family of P-N junction devices. The light emitting diode (LED) is a diode that will give off visible light when it is energized. In any forward biased P-N junction there is, with in the structure and primarily close to the junction, a recombination of hole and electrons. This recombination requires that the energy possessed by the unbound free electron be transferred to another state. The process of giving off light by applying an electrical source is called electroluminescence. LED is a component used for indication. All the functions being carried out are displayed by led .The LED is diode which glows when the current is being flown through it in forward bias condition. The LEDs are available in the round shell and also in the flat shells. The positive leg is longer than negative leg.
3.1.6.3. LIQUID CRYSTAL DISPLAY -- (LCD) A liquid crystal display (LCD) is a thin, flat display device made up of any number of color or monochrome pixels arrayed in front of a light source or reflector. It is often utilized in battery-powered electronic devices because it uses very small amounts of electric power. JHD 162A is LCD that has following features: 37
• Number of characters: 16 characters*2 lines. • Module dimension: 80.0mm*36.0mm*9.7mm. • Area: 66.0mm*16.0mm. • Active area: 56.2mm*11.5mm. • Dot size: 0.55mm*0.65mm. • Dot pitch: 0.60mm*0.70mm. • Character size: 2.95mm*5.55mm. • Character pitch: 3.55mm*5.95mm. • LCD Type: Positive, Reflective, Yellow Green.
Internal Working Principle
LCD controller has 2 internal Memory: CGROM: Stores the Patterns for generating a Character DDRAM: Stores the characters to be displayed in the LCD Interfacing LCD From Software Every Position in the LCD display is mapped with a location in the Display Driver RAM in the LCD controller. Such as 0x80 location is mapped with First line, First Column. The complete mapping for a 16X2 LCD is given below. To Interface the LCD from Software you need to know the address of each location in the Display. Here is the illustration of the LCD address.
Line 1
80
81
82
83
84
85
86
87
88
89
8A
8B
8C
8D
8E
8F
C0
C1
C2
C3
C4
C5
C6
C7
C8
C9
CA
CB
CC
CD
CE
CF
Line 2
38
Before putting a character to a LCD location you have to select the location first. This function is used to send a byte of data/address to the LCD. voidLCD_write(uint8_t data,uint8_t rs)
rs should be 0 for sending address, 1 for sending data. The Location can be provided by either putting the address mentioned above or You can write as (LINE1+COLUMN1) format. These macros are defined in EMB02.H The LCD only accepts data in ASCII format. So if you want to display ‘A’ in the LCD, you have to send the ascii value of ‘A’. You can directly send a character to the LCD by this function. LCD_write(0x80,0); LCD_write(‘A’,1);
Communication with LCD
For communicating with LCD, we need to write in display driver RAM
For communication we need address and data
Address and data lines are multiplexed
RS pin is used to select data or address, 0 for selecting address
3.1.6.4. ATMEGA8 Microcontroller IC Main microcontroller of our project is this ATMEGA8 Microcontroller.
Features • High-performance, Low-power Atmel®AVR® 8-bit Microcontroller • Advanced RISC Architecture – 130 Powerful Instructions – Most Single-clock Cycle Execution – 32 × 8 General Purpose Working Registers – Fully Static Operation – Up to 16MIPS Throughput at 16MHz – On-chip 2-cycle Multiplier • High Endurance Non-volatile Memory segments – 8Kbytes of In-System Self-programmable Flash program memory – 512Bytes EEPROM – 1Kbyte Internal SRAM – Write/Erase Cycles: 10,000 Flash/100,000 EEPROM – Data retention: 20 years at 85°C/100 years at 25°C(1) – Optional Boot Code Section with Independent Lock Bits In-System Programming by On-chip Boot Program 39
True Read-While-Write Operation – Programming Lock for Software Security • Peripheral Features – Two 8-bit Timer/Counters with Separate Prescaler, one Compare Mode – One 16-bit Timer/Counter with Separate Prescaler, Compare Mode, and Capture Mode – Real Time Counter with Separate Oscillator – Three PWM Channels – 8-channel ADC in TQFP and QFN/MLF package Eight Channels 10-bit Accuracy – 6-channel ADC in PDIP package Six Channels 10-bit Accuracy – Byte-oriented Two-wire Serial Interface – Programmable Serial USART – Master/Slave SPI Serial Interface – Programmable Watchdog Timer 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 Interrupt Sources – Five Sleep Modes: Idle, ADC Noise Reduction, Power-save, Power-down, and Standby • I/O and Packages – 23 Programmable I/O Lines – 28-lead PDIP, 32-lead TQFP, and 32-pad QFN/MLF • Operating Voltages – 2.7V - 5.5V (ATmega8L) – 4.5V - 5.5V (ATmega8) • Speed Grades – 0 - 8MHz (ATmega8L) – 0 - 16MHz (ATmega8) • Power Consumption at 4 MHz, 3V, 25°C – Active: 3.6mA – Idle Mode: 1.0mA – Power-down Mode: 0.5μA 40
3.1.6.5. Supporting ATMEGA8 Microcontroller IC As we used Microcontroller development kit, there are two microcontroller IC we are used. One is main ATMEGA8 IC where we done the programme our project. & the other one is programmed Microcontroller IC. Which we used to program into the main Microcontroller. So this is the main function of the Supporting ATMEGA8 Microcontroller IC
3.1.6.6. 7805 Voltage Regulator IC It is a three pin IC used as a voltage regulator. It converts unregulated DC current into regulated DC current. Normally we get fixed output by connecting the voltage regulator at the output of the filtered DC (see in above diagram). It can also be used in circuits to get a low DC voltage from a high DC voltage (for example we use 7805 to get 5V from 12V). There are two types of voltage regulators 1. fixed voltage regulators (78xx, 79xx) 2. Variable voltage regulators (LM317) in fixed voltage regulators there is another classification 1. +ve voltage regulators 2. -ve voltage regulators POSITIVE VOLTAGE REGULATORS this include 78xx voltage regulators. The most commonly used ones are 7805 and 7812.7805 gives fixed 5V DC voltage if input voltage is in (7.5V, 20V). A Voltage Regulator is an electrical regulator designed to automatically maintain a constant voltage level. A voltage regulator may be a simple "feed-forward" design or may include negative feedback control loops. It may use an electromechanical mechanism, or electronic components. Depending on the design, it may be used to regulate one or more AC or DC voltages. Electronic voltage regulators are found in devices such as computer power supplies where they stabilize the DC voltages used by the processor and other elements. Figure a Voltage Regulator, LM7805: LM7805 is a fixed output voltage regulator I.e. 7805 takes + 12V input and gives a fixed regulated output voltage of +5V. - LM35: This is temperature sensor IC rated for full -55° to + 150°C temperature range. This is a transducer IC that takes voltage input and gives a voltage output proportional to the ambient temperature. +VS pin is connected to the output pin of LM7805 and the VOUT pin is connected to one of the analog input channels available on MCU. A basic voltage regulator LM7805 has three legs, converts varying input voltage and produces a constant regulated output voltage. The most common part numbers start with the numbers 78 or 79 and finish with two digits indicating the output voltage. The number 78 represents positive voltage and 79 negative one.
3.1.6.7. ADC Features • 10-bit Resolution • 0.5 LSB Integral Non-linearity • ±2 LSB Absolute Accuracy • 13μs - 260μs Conversion Time • Up to 15 kSPS at Maximum Resolution 41
• 6 Multiplexed Single Ended Input Channels • 2 Additional Multiplexed Single Ended Input Channels (TQFP and QFN/MLF Package only) • Optional Left Adjustment for ADC Result Readout • 0 - VCC ADC Input Voltage Range • Selectable 2.56V ADC Reference Voltage • Free Running or Single Conversion Mode • Interrupt on ADC Conversion Complete • Sleep Mode Noise Canceller The ATmega8 features a 10-bit successive approximation ADC. The ADC is connected to an 8-channel Analog Multiplexer which allows eight single-ended voltage inputs constructed from the pins of Port C. The single-ended voltage inputs refer to 0V (GND). The ADC contains a Sample and Hold circuit which ensures that the input voltage to the ADC is held at a constant level during conversion. A block diagram of the ADC is shown in Figure 90 on page 190. The ADC has a separate analog supply voltage pin, AVCC. AVCC must not differ more than ±0.3V from VCC. See the paragraph “ADC Noise Canceller” on page 195 on how to connect this pin. Internal reference voltages of nominally 2.56V or AVCC are provided On-chip. The voltage reference may be externally decoupled at the AREF pin by a capacitor for better noise performance. The ADC converts an analog input voltage to a 10-bit digital value through successive approximation. The minimum value represents GND and the maximum value represents the voltage on the AREF pin minus 1 LSB. Optionally, AVCC or an internal 2.56V reference voltage may be connected to the AREF pin by writing to the REFSn bits in the ADMUX Register. The internal voltage reference may thus be decoupled by an external capacitor at the AREF pin to improve noise immunity. The analog input channel is selected by writing to the MUX bits in ADMUX. Any of the ADC input pins, as well as GND and a fixed band gap voltage reference, can be selected as single ended inputs to the ADC. The ADC is enabled by setting the ADC Enable bit, ADEN in ADCSRA. Voltage reference and input channel selections will not go into effect until ADEN is set. The ADC does not consume power when ADEN is cleared, so it is recommended to switch off the ADC before entering power saving sleep modes. The ADC generates a 10-bit result which is presented in the ADC Data Registers, ADCH and ADCL. By default, the result is presented right adjusted, but can optionally be presented left adjusted by setting the ADLAR bit in ADMUX.
3.1.6.8. Crystal Oscillator A crystal oscillator is an electronic oscillator circuit that uses the mechanical resonance of a vibrating crystal of piezoelectric material to create an electrical signal with a very precise frequency. [1][2][3] This frequency is commonly used to keep track of time (as in quartz wristwatches), to provide a stable clock signal for digital integrated circuits, and to stabilize frequencies for radio transmitters and receivers. The most common type of piezoelectric resonator used is the quartz crystal, so oscillator circuits
42
incorporating them became known as crystal oscillators, [1] but other piezoelectric materials including polycrystalline ceramics are used in similar circuits. Quartz crystals are manufactured for frequencies from a few tens of kilohertz to tens of megahertz. More than two billion crystals are manufactured annually. Most are used for consumer devices such as wristwatches, clocks, radios, computers, and cell phones. Quartz crystals are also found inside test and measurement equipment, such as counters, signal generators, and oscilloscopes.
3.1.6.9 Electrolytic Capacitors An electrolytic capacitor is a type of capacitor that uses an electrolyte, an ionic conducting liquid, as one of its plates, to achieve a larger capacitance per unit volume than other types. They are often referred to in electronics usage simply as "electrolytic". They are used in relatively high-current and lowfrequency electrical circuits, particularly in power supply filters, where they store charge needed to moderate output voltage and current fluctuations in rectifier output. They are also widely used as coupling capacitors in circuits where AC should be conducted but DC should not. There are two types of electrolytic; aluminum and tantalum. An electrolytic capacitor is a capacitor that uses an electrolyte (an ionic conducting liquid) as one of its plates to achieve a larger capacitance per unit volume than other types, but with performance disadvantages. All capacitors conduct alternating current (AC) and block direct current (DC) and can be used, amongst other applications, to couple circuit blocks allowing AC signals to be transferred while blocking DC power, to store energy, and to filter signals according to their frequency. Most electrolytic capacitors are polarized; hence, they can only be operated with a lower voltage on the terminal marked "-" without damaging the capacitor. This generally limits electrolytic capacitors to supply-decoupling and bias-decoupling, since signal coupling usually involves both positive and negative voltages across the capacitor. The large capacitance of electrolytic capacitors makes them particularly suitable for passing or bypassing lowfrequency signals and storing large amounts of energy. They are widely used in power supplies and for decoupling unwanted AC components from DC power connections. Super capacitors provide the highest capacitance of any practically available capacitor,[1] up to thousands of farads, with working voltages of a few volts. Electrolytic capacitors range downwards from tens (exceptionally hundreds) of thousands of microfarads to about 100 nanofarads—smaller sizes are possible but have no advantage over other types. Other types of capacitor are available in sizes typically up to about ten microfarads, but the larger sizes are much larger and more expensive than electrolytic (film capacitors of up to thousands of microfarads are available, but at very high prices[2]). Electrolytic capacitors are available with working voltages up to about 500V, although the highest capacitance values are not available at high voltage. Working temperature is commonly 85°C for standard use and 105° for high-temperature use; higher temperature units are available, but uncommon. Unlike other types of capacitor, most electrolytic capacitors require that the voltage applied to one terminal (the anode) never become negative relative to the other (they are said to be "polarized"), so cannot be used 43
with AC signals without a DC polarizing bias (non-polarized electrolytic capacitors are available for special purposes). Leakage current, capacitance tolerance and stability, equivalent series resistance (ESR) and dissipation factor are significantly inferior to other types of capacitors, and working life is shorter. Capacitors can lose capacitance as they age and lose electrolyte, particularly at high temperatures. A common failure mode which causes difficult-to-find circuit malfunction is progressively increasing ESR without change of capacitance, again particularly at high temperature. Large ripple currents flowing through the ESR generate harmful heat. Two types of electrolytic capacitor are in common use: aluminum and tantalum. Tantalum capacitors have generally better performance, higher price, and are available only in a more restricted range of parameters. Solid polymer dielectric aluminum electrolytic capacitors have better characteristics than wet-electrolyte types—in particular lower and more stable ESR and longer life—at higher prices and more restricted values.
3.1.6.10. L293D Motor Driver What is a motor? Motor is electrical device which can transform the electrical energy into the mechanical energy. Several types of motors are available, namely they are : 1. A.C Motor 2. D.C Motor 3. Stepper Motor 4. Geared Motor etc. Why need a motor? In case of a mobile robot, the third primitive of Robotics, “Act” refers primarily to locomotion among other objectives. Types of motor
Stepper Motor
D.C Geared Motor
Servo Motor
44
D. C Motor Specification : • • • • •
Operating Voltage Operating Current Free Running RPM Stall Torque Stall Current D.C Motor Characteristics :
Zero speed at maximum load (stall torque) Highest speed while free running (zero load) Highest power at half speed & half load
D.C Motor Torque Speed Curve :
STALL TORQUE
T O R Q U E
NO LOAD SPEED
ROTATIONAL SPEED 45
Speed Relation Between The Robot and The Motor : Remember, Velocity of robot not only depends on the RPM of the motor, It also depends on the Wheel Diameter . Velocity of Robot = RPM X Wheel Periphery But It is always preferred to use Medium Speed and Medium Wheel Size
Direction Control Of a D. C Motor : Changing the polarity of current or voltage changes the direction of rotation.
VDC
+ M
-
+
M
-
Clockwise Direction
Anticlockwise Direction
Speed Control Of D. C Motor :
D.C
Geared Motor :
D.C. motors rotate at very high speed, like 2400 RPM or more. But they don’t provide enough torque. Gearboxes are attached to the D.C. motors to reduce the RPM and Increase the Torque. Remember, Gearboxes do not change the power of a motor.
46
R.P.M of a Geared Motor : Power of a Motor = Rotational Speed in RPM X Torque So, If a 2400 RPM, 50 gm-cm torque motor is attached with a 24:1 Gear Box The Output RPM will be 2400/24 = 100 And torque will be 50 X 24 = 1200 gm-cm The Motor Driver : Here we are using L293d , a bidirectional motor driver to operate our robot. Why Motor Drivers are Required ? The microcontroller’s job is to control Motors. The output of the microcontroller can not provide enough voltage and current to start and run the motors. The motor drivers provide required amount of current and voltage to the motors. D. C Motor Drive :
Comparison Between Unidirectional and Bidirectional Driver : A unidirectional motor drive is a motor drive in which motor rotates in only one direction and stops.
In Bidirectional Drive Motor Rotates in Both direction and stops. The Bidirectional Motor Driver :
Bidirectional DC motor Drive Direction
drives the Motors in both the Clockwise and Anti-Clockwise
47
Although this is costlier, it gives the robot ability to turn in very steep places. Almost in Place Turn is possible with the bidirectional drive
48
How To Drive ?
5.5.6
Pin Configuration Of The Driver :
DC MOTOR #1 – INPUT A DC MOTOR #1 – INPUT B DC MOTOR #1 – EN DC MOTOR #2 – INPUT A DC MOTOR #2 – EN DC MOTOR #2 – INPUT B
H Bridge Bidirectional Drive : 49
EN
A
B
Motor Action
0
X
X
Stopped
Bipolar Motor Driving : L293D is a bipolar motor driver IC. This is a high voltage, high current push-pull four channel driver compatible to TTL logic levels and drive inductive loads. It has 600 mA output current capabilities per
channel
and
internal
clamp diodes.
As shown below there are
connectors provided in the development board to connect DC motors with L293D. Each connector contains 3pins. The center pin is ground. The left and right pins should be connected to the two motor terminals. The motor driver has 3 input pins for each motor. They are EN, A, B. A truth table is provided below to relate the input conditions with the motor action.
50
1
0
0
Brake
1
1
1
Brake
1
0
1
Clockwise Rotation
1
1
0
Anti-Clockwise Rotation
Differential Drive Robot Car with D. C Motor Using L293d : A differential Drive car normally uses 2 drive motors for Locomotion. Usually the left and the right Rear wheels are being driven by 2 separate motors. Driving the car and the steering is possible by controlling the DC motors. Now remember that the two motors are connected in such a way that one motor is connected in opposite direction with the other. So turning the left motor Clockwise and the Right one anti-clockwise will send the car in the forward direction. Here is a chart given which will map the Car motion with the control of the Left and the Right Motor.
Left
Right Motor
Motion
Stopped
Stopped
Stopped
CW
CCW
Forward
CCW
CW
Backward
CW
CW
Left Turn
CCW
CCW
Right Turn
BRAKE
BRAKE
Brake
Motor
Left Motor
Car Chassis
Right Motor
51
3.1.6.11. MAX232 Converter MAX232: This particular IC is necessary for increasing the voltage swing at the outputs. It takes OV and +5V inputs and makes it a + 12V and - 12V output voltages. This increased voltage swing is a requirement for serial communications. Two 1 /IF capacitors are connected between pins 4, 5 and 1, 3 of MAX232. V+ and V- pins are fed from VCC and GNO, i.e. G round through two 1 /IF capacitors. Between VCC and GNO pins, one 10 /IF capacitor is placed. - GSM modem: GSM modem is connected through a OB9 female connector to the interfacing circuit. - MCU: The VCC, i.e. power pin, TTL input and TTL output pins of MAX232 are connected to the pins RCO, RCI and RC2 of MCU respectively.
3.1.7. Miscellaneous Hardware All the hardware we discuss previous there are also many others hardware are there & without their help we cannot proceed.
15 watt Bulbs & Holder
PVC & Connecting Wires &Plugs
Glue, Gas lighter, etc.
3.2 SOFTWARE 3.2.1. Required Software For competitions of our project we need many types of software. Those required software are—
AVR STUDIO 4.0
SERIAL TERMINAL
EXTREME BURNER AVR V1.2
The others application software we use to complete our project are as –
WINDOWS 7 ULTIMATE
MICROSOFT OFFICE WORD AND POWERPOINT
PICASA 3
GOOGLE CHROME
3.2.2 Software Details 3.2.2.1. AVR STUDIO 4.0 Introduction: Software is a well known commonly used name, which is basically used in several purposes. So first of all we have to know actually what is software? Software is a set of program, containing different types of programming which is basically provides us to design another else. 52
For working with the ATMEGA kit, we first need to install some software to write our program, compile them and burn it in our hardware kit. Those Software’s are following :
1. winAVR (free GNU compiler) 2. AVR Studio 4.0 (free IDE) 3. Extreme Burner
WinAVR (Free GNU Compiler) : WinAVR is a suite of executable, open source software development tools for the Atmel AVR series of RISC microprocessors and AVR32 series of microprocessors hosted on the windows platform. It includes the GNU GCC compiler for C and C++. WhatsNew :
AVR32 GNU tool chain
Splint 3.1.2 Splint is a tool for statically checking C programs for security vulnerabilities and programming mistakes. Splint does many of the traditional lint checks. More powerful checks are made possible by additional information given in source code annotations.
New Device Support
Component Version Upgrades Tool Set Background :
WinAVR is a collection of executable software development tools for the Atmel AVR processor hosted on Windows. These software development tools include:
Compilers
Assembler
Linker
53
Librarian
File converter
Other file utilities
C Library
Programmer software
Debugger
In-Circuit Emulator software
Editor / IDE
Many support utilities
AVR Studio 4 : AVR
Studio
is
an
Integrated
Development
Environment (IDE) for writing and debugging AVR applications
in
Windows
9x/ME/NT/2000/XP/VISTA environments.
AVR
Studio provides a project management tool, source file editor, simulator, assembler and front-end for C/C++,
programming,
emulation
and
on-chip
debugging. AVR Studio supports the complete range of ATMEL AVR tools and each release will always contain the latest updates for both the tools and support of new AVR devices. AVR Studio 4 has a modular architecture which allows even more interaction with 3rd party software vendors.
54
How to write a program in the AVR Studio 4 Software :
Click on the AVR Studio 4 On opening this dialog box should come. Click on New project.
Select AVR GCC, Select a suitable location (preferably desktop & Create new folder there). Give a project name then click Next.
55
Select AVR Simulator, Atmega8 from the device list. Click on finish.
Right click on topmost item (usually on the project name) in the left hand tab (see below) and click on ‘Edit Configuration options’
56
Enter 8000000 in the Frequency tab, click on ‘OK’.
57
7.2.2
After writing the program : After typing your program, save it, then click on Build-> Rebuild All
In the bottom side of the software, in the build terminal, result of the compilation will be shown. Any error or warning will be reported here.
58
3.2.2.2 Extreme Burner :
Extreme burner is a such type of software that allows us to transfer the program, that was written in the AVR Studio 4 software, to the microcontroller. It is a burner software that burn the program to the microcontroller with the help of burner.
For transferring the program written in the editor to the kit(burning) follow the subsequent steps : Connect the USB cable into the KIT and PC. Power UP the KIT. Open the ‘Extreme Burner’ software. Click on ‘Chip’ and select ‘ATmega8’ from the list. This is to be done for the first time only
59
Click on Open, then select the “*.hex” file inside the ‘default folder’ inside the project folder.
60
Click on the write and then select the flash with connected and switched on kit to the PC.
3.2.2.3 Other Involved Software The main two software AVR STUDIO 4.0 & EXTREME BURNER are very much help full. But through that we are very helpful to use this following software to complete our project. Those are—
WINDOWS 7 ULTIMATE
MICROSOFT OFFICE WORD AND POWERPOINT
PICASA 3
GOOGLE CHROME BY the help of this minor software is goes very easy to complete the
program.
61
CHAPTER 4 SOFTWARE & HARDWARE DESIGN
62
4.1. System Hardware & Implementation
FIGURE: Hardware of Our Project Smart Home Security System
FIGURE: [1] Development kit
[2] GSM Module 63
4.2 CODING Main program of our project is written below—
#include
INPUT OUTPUT #include AND CBI #include #include<stdio.h> #include #include"uart.h" #include"lcd.h" #include"adc.h" #include"motor.h" #include"math.h"
//HEADER FILE FOR AVR //HEADER FILE FOR FUNCTIONS LIKE SBI //HEADER FILE FOR DELAY
#define RELAY1 5 #define RELAY2 6 #define RELAY3 7
int main(void) { uint8_t count,temp1=0,temp2=0, temp3=0, temp4=0, len=0, lock, send_sms, gas_leak, pir; char ch[400]; lock=0; send_sms=0; sbi(DDRB,0); cbi(PORTB,0); sbi(DDRB,1); sbi(DDRB,2); sbi(PORTB,1); sbi(PORTB,2); ///// SET THE RELAY PORTS AS OUTPUT ///////// sbi(DDRD,RELAY1); sbi(DDRD,RELAY2); sbi(DDRD,RELAY3); sbi(PORTD,RELAY1); 64
sbi(PORTD,RELAY2); sbi(PORTD,RELAY3); USARTInit(103); /// set the baud rate as 9600 bps /// LCD_Init(); // SET LCD AS DEFAULT OUTPUT DEVICE /// for(count=0;count<200;count++) { ch[count]=32; } LCD_Init(); LCD_Clrscr(); printf("Smart Home Security\nAnd Control "); _delay_ms(3000); while(!(UCSRA & (1<
LCD_Clrscr(); LCD_Home(); printf("Modem Company: \n"); printf(ch); _delay_ms(3000);
USART_WriteChar('A'); USART_WriteChar('T'); USART_WriteChar('+'); USART_WriteChar('C'); USART_WriteChar('M'); USART_WriteChar('G'); USART_WriteChar('F'); USART_WriteChar('='); USART_WriteChar('1'); USART_WriteChar('\n'); while(1) { LCD_Clrscr(); printf("Ready ..."); ////// detect intrusion & GAS Leak Here /////////////////////////// if(lock==1) { LCD_Clrscr(); gas_leak=0; pir=0; if( (PINC & 0x02) !=0 ) /// check PIR sensor /// { printf("Intrusion \nDetected........."); send_sms=1; pir=1; } else if( ADC_Read(1) > 450 ) //// check GAS Sensor ////// { printf("GAS Leak \nDetected........"); send_sms=1; gas_leak=1; } } 66
/////// send sms if intrusion detected //////////////////////////// if(send_sms==1) { send_sms=0; _delay_ms(100); USART_WriteChar('A'); USART_WriteChar('T'); USART_WriteChar('+'); USART_WriteChar('C'); USART_WriteChar('M'); USART_WriteChar('G'); USART_WriteChar('S'); USART_WriteChar('='); USART_WriteChar('"'); USART_WriteChar('9'); USART_WriteChar('8'); USART_WriteChar('3'); USART_WriteChar('0'); USART_WriteChar('3'); USART_WriteChar('1'); USART_WriteChar('7'); USART_WriteChar('1'); USART_WriteChar('4'); USART_WriteChar('3'); USART_WriteChar('"'); USART_WriteChar('\n'); _delay_ms(200); if(pir==1 && gas_leak==0) { USART_WriteChar('I'); USART_WriteChar('n'); USART_WriteChar('t'); USART_WriteChar('r'); USART_WriteChar('u'); USART_WriteChar('s'); USART_WriteChar('i'); USART_WriteChar('o'); USART_WriteChar('n'); USART_WriteChar(' '); USART_WriteChar('D'); USART_WriteChar('e'); USART_WriteChar('t'); 67
USART_WriteChar('e'); USART_WriteChar('c'); USART_WriteChar('t'); USART_WriteChar('e'); USART_WriteChar('d'); USART_WriteChar(' '); } else if(pir==0 && gas_leak==1) { USART_WriteChar('G'); USART_WriteChar('A'); USART_WriteChar('S'); USART_WriteChar(' '); USART_WriteChar('L'); USART_WriteChar('e'); USART_WriteChar('a'); USART_WriteChar('k'); USART_WriteChar(' '); USART_WriteChar('D'); USART_WriteChar('e'); USART_WriteChar('t'); USART_WriteChar('e'); USART_WriteChar('c'); USART_WriteChar('t'); USART_WriteChar('e'); USART_WriteChar('d'); USART_WriteChar(' '); } else { USART_WriteChar('G'); USART_WriteChar('A'); USART_WriteChar('S'); USART_WriteChar(' '); USART_WriteChar('L'); USART_WriteChar('e'); USART_WriteChar('a'); USART_WriteChar('k'); USART_WriteChar(' '); USART_WriteChar('a'); USART_WriteChar('n'); USART_WriteChar('d'); USART_WriteChar(' '); USART_WriteChar('I'); USART_WriteChar('n'); USART_WriteChar('t'); 68
USART_WriteChar('r'); USART_WriteChar('u'); USART_WriteChar('s'); USART_WriteChar('i'); USART_WriteChar('o'); USART_WriteChar('n'); USART_WriteChar(' '); USART_WriteChar('D'); USART_WriteChar('e'); USART_WriteChar('t'); USART_WriteChar('e'); USART_WriteChar('c'); USART_WriteChar('t'); USART_WriteChar('e'); USART_WriteChar('d'); USART_WriteChar(' '); } USART_WriteChar(0x1A); _delay_ms(4000); }
/////////////////Activate lock/////////////////////////// USART_WriteChar('A'); USART_WriteChar('T'); USART_WriteChar('+'); USART_WriteChar('C'); USART_WriteChar('M'); USART_WriteChar('G'); USART_WriteChar('R'); USART_WriteChar('='); USART_WriteChar('1'); USART_WriteChar('\n'); while(USARTReadChar()!='\n'); for(count=0;count<200;count++) { ch[count]=32; } count=0; while(1) { 69
///////// incoming SMS detection & relay controlling /////////////// temp4=temp3; temp3=temp2; temp2=temp1; temp1=USARTReadChar(); if(temp4=='+' && temp1=='"') len=count; if(temp2=='O' && temp1=='K') { if(count>15) { ch[count-5]=0; for(count=0;count<45;count++) ch[count]=ch[count+len+3]; LCD_Clrscr(); printf("** New Message **\n"); printf(ch); _delay_ms(2000); if(ch[0]=='L' && ch[1]=='O' && ch[2]=='C' && ch[3]=='K') { if(ch[5]=='N') { lock=1; LCD_Clrscr(); printf("Home security\nActive......"); sbi(PORTC,3); _delay_ms(4000); } if(ch[5]=='F') { lock=0; LCD_Clrscr(); cbi(PORTC,3); printf("Home Security \nDeactivated......"); _delay_ms(4000); } LCD_Clrscr(); printf("** Sending SMS **\n"); _delay_ms(100); 70
USART_WriteChar('A'); USART_WriteChar('T'); USART_WriteChar('+'); USART_WriteChar('C'); USART_WriteChar('M'); USART_WriteChar('G'); USART_WriteChar('S'); USART_WriteChar('='); USART_WriteChar('"');
USART_WriteChar('9'); USART_WriteChar('8'); USART_WriteChar('3'); USART_WriteChar('0'); USART_WriteChar('3'); USART_WriteChar('1'); USART_WriteChar('7'); USART_WriteChar('1'); USART_WriteChar('4'); USART_WriteChar('3'); USART_WriteChar('"'); USART_WriteChar('\n'); _delay_ms(200); USART_WriteChar('H'); USART_WriteChar('o'); USART_WriteChar('m'); USART_WriteChar('e'); USART_WriteChar(' '); USART_WriteChar('L'); USART_WriteChar('o'); USART_WriteChar('c'); USART_WriteChar('k'); USART_WriteChar(' '); USART_WriteChar('S'); USART_WriteChar('u'); USART_WriteChar('c'); USART_WriteChar('c'); USART_WriteChar('e'); USART_WriteChar('s'); USART_WriteChar('s'); USART_WriteChar(0x1A); _delay_ms(300); } if(ch[0]=='D' && ch[1]=='E' && ch[2]=='V') 71
{ if(ch[4]=='1' && ch[7]=='N') { cbi(PORTD,RELAY1); LCD_Clrscr(); printf("Device 1 is\nTurned On...."); _delay_ms(3000); } if(ch[4]=='1' && ch[7]=='F') { sbi(PORTD,RELAY1); LCD_Clrscr(); printf("Device 1 is\nTurned Off...."); _delay_ms(3000); } if(ch[4]=='2' && ch[7]=='N') { cbi(PORTD,RELAY2); LCD_Clrscr(); printf("Device 2 is\nTurned On...."); _delay_ms(3000); } if(ch[4]=='2' && ch[7]=='F') { sbi(PORTD,RELAY2); LCD_Clrscr(); printf("Device 2 is\nTurned Off...."); _delay_ms(3000); } if(ch[4]=='3' && ch[7]=='N') { cbi(PORTD,RELAY3); LCD_Clrscr(); printf("Device 3 is\nTurned On...."); _delay_ms(3000); } if(ch[4]=='3' && ch[7]=='F') { sbi(PORTD,RELAY3); LCD_Clrscr(); printf("Device 3 is\nTurned Off...."); _delay_ms(3000); } LCD_Clrscr(); printf("** Sending SMS **\n"); 72
_delay_ms(100); USART_WriteChar('A'); USART_WriteChar('T'); USART_WriteChar('+'); USART_WriteChar('C'); USART_WriteChar('M'); USART_WriteChar('G'); USART_WriteChar('S'); USART_WriteChar('='); USART_WriteChar('"');
USART_WriteChar('9'); USART_WriteChar('8'); USART_WriteChar('3'); USART_WriteChar('0'); USART_WriteChar('3'); USART_WriteChar('1'); USART_WriteChar('7'); USART_WriteChar('1'); USART_WriteChar('4'); USART_WriteChar('3'); USART_WriteChar('"'); USART_WriteChar('\n'); _delay_ms(200); USART_WriteChar('O'); USART_WriteChar('p'); USART_WriteChar('e'); USART_WriteChar('r'); USART_WriteChar('a'); USART_WriteChar('t'); USART_WriteChar('i'); USART_WriteChar('o'); USART_WriteChar('n'); USART_WriteChar(' '); USART_WriteChar('S'); USART_WriteChar('u'); USART_WriteChar('c'); USART_WriteChar('c'); USART_WriteChar('e'); USART_WriteChar('s'); USART_WriteChar('s'); USART_WriteChar(0x1A); _delay_ms(300); 73
} else { printf("Unknown Message"); } USART_WriteChar('A'); USART_WriteChar('T'); USART_WriteChar('+'); USART_WriteChar('C'); USART_WriteChar('M'); USART_WriteChar('G'); USART_WriteChar('D'); USART_WriteChar('='); USART_WriteChar('1'); USART_WriteChar('\n'); } break; } if(temp2=='O' && temp1=='R') break; ch[count++]=temp1; } } return(0); }
74
CHAPTER 5
CONCLUSION
75
CHAPTER CONCLUSION
5
5.1. RESULT Basically our project is a GSM Based Smart Home Security System. And we can divide our project into two different ways as their working principal. And those are – Security Part, where we protect household from intruders or bugler, and other hand we could secure houses from any critical accident related with gas leakage problem. & Control Part, where we can control (On/Off) any device. Home security system may be considered to enlarge its scalability and included more functionality in 5 more 10 years (Interview 2011). However, the major functions and requirements are not expected to differ significantly, while security, simplicity and affordability will be on the top priority. Future services may contain user friendliness requirements, low installation costs and device expenses requirements, quality of services requirements and interoperability requirements. The user friendliness requirement is mainly for a customer with little computer experience. Thus the technologies and the applications should be operating as simple as possible, and be easy to install. The features such as auto configuration and remote maintenance can be integrated to the system as well. As time goes by, a large market share of home security system will incur the lower expenses of security devices and the installation costs. Quality of service requirements should be applied by the service provider to guarantee limited delay, minimum jitter and other limitation that exists in the home security system. Since there are types of devices and products from various companies coexist in one home, the interoperability assists to define a universal standard for the associations. The associations may be formed by several service providers. One specific solution of a home security system have been produced in this thesis, home user can use it as a reference when construct their own home security system. Although the infrastructure plan for the home security system only remains on the theoretical stage, it can be implemented in future when the technology of devices is mature. Along with the reality that the safety of life is decreasing, home security is increasing its pace for a home user to take actions. This project presents one solution for establishing a low power consumption remote home security alarm system. The system, based on GSM technology, can detect intrusion, fire etc and send alarm message remotely and also can let user listen the prerecorded voice messages which convey some information about intrusion. Along with that system can be remotely armed and disarmed as well. The hardware of this system includes the radio transceiver XBEE, microcontrollers Atmega8, Atmega16 and Atmega162, SIM300 GSM module etc. The system software developed in C language on AVR compiler has the ability of collecting, wireless receiving and transmitting data, and can send a piece of alarm short message and calls to the 15 numbers stored in the system when some dangerous condition has been detected. With the advantages of 76
reliability, easy usage, complement wireless, and low power consumption, the system also has practical value in other fields. This project offers users with enormous benefits of simplicity, being compatible to situations where the presence near the machine poses a great threat to safety, needing just basic knowledge of messaging & what more it has a lot of reliability. One added advantage of this project is that the control engineer who supervises the machine can be engaged in any other extra work, so that the company can enhance its production. All these features enhance the usefulness of the project.
5.2. FUTURE ENHANCEMENTS This project can be further extended to monitor & control more than one parameter with the same simplicity, compatibility & reliability. This project can also be extended to use in household appliances like gas stoves, wherein the utensil with the material to be cooked can be prepared & kept ready on the special gas 93 stove & can ordered to cook via the messaging service, for the prescribed amount of time with the temperature being maintained at specified limits, before we reach home. As we see in the left hand side picture there are also many ways to execute our program broadly in our daily life. So our project is only a model of how to make a household to a gsm based smart home. Into that we also show that we made a gsm based smart home security system
which
can sense gas leakage, intruders’
detector,
&
device control by a simple
Figure 2: Home Security System with Control Panel
SMS. For future enhancements this GSM based smart home security system can be use as a wireless remote control system using WSN. We also add many other detector & sensors like Leakage Sensor, Movement Sensor, Smoke Sensor, Light Sensor, Light Dependent Resistor Chip, STH 75, CHUBB Smoke Detector & many more …If we a say it is a sentence then we can say that total home security system is just the next step. We use this concept also into the various industries and by that way the supervision of the company will be automated & very easy.
77
5.3. Major Constraints Along the course of project completion we encountered various problems and obstacles. Not everything that we had planned went smoothly during the project development span. Also we had a limited amount of time for its completion so we were under a certain amount of pressure as well. We had to start from the research phase at the beginning and needed to gain knowledge on all the devices and components that we had intended to use for our project. Other phases of the project included coding, debugging, testing, documentation and implementation and it needed certain time for completion so we really had to manage the limited time available to us and work accordingly to finish the project within the schedule. 5.4. PROJECT COST Project cost can be divided in two ways and calculated as follows; a. Hardware Cost: Hardware cost for our project can be considered as a moderate amount of money spent. It does not fall under a cheap project neither it is a relatively smaller one. However, having said that, the cost of the hardware components implemented does amount to significant figures. We had to disrupt a GSM Module & Microcontroller Development kit set in order to overcome & competition of the project. Other hardware expenses are not as significant when compared to it but they do accumulate to a considerable amount. But taking into consideration that this is a onetime investment, the cost cannot be said to be too expensive. b. Software Cost: Software cost includes the cost of the required software for our project. We did not have to spend money in getting the necessary software for our project. The software we used for our system is the free edition version and thus no money was put in it. The involvement cost in our project is only the human labors, searching websites, visiting different places and locations for gathering locations and not to mention the cost of electricity that was consumed during the project completion time.
78
CHAPTER 6
REFERENCE
79
CHAPTER REFERENCE
6
6. REFERENCE 6.1. PRINTED “8051 and embedded system” by Mazidi and Mazidi. All datasheets from www.datasheetcatalog.com & www.atmel.com Search results from www.google.com & www.en.wikipedia.org Problem helper sites www.avrfreaks.net & www.triindia.co.in Guide help www.arelab.org & www.engineersgarage.com Atmel Corporation, "Atmega8/L Datasheet", available http://www.atmel.com/dyn/resources/prod_documents/doc2486.pdf Texas Instruments Inc, "MAX232 Datasheet", available http://www.ti.com/lit/ds/symlink/max232.pdf SIMCOM Ltd, "SIM300 Datasheet", available http://wm.sim.com/sim/News/photo/2009612100507.pdf
www.embedtronics.com ,October 2008 Z. Zhi - hui, L. Hui, L. Yin, C. Jia - jia, "Design Of The Intelligent Fire Proof And Theft-Proof Alarm System For Home", JOURNAL OF HENAN POLYTECHNIC UNIVERSITY, vol. 28,no. I, pp. 207-210, Feb. 2009. M. Shankar, 1. Burchett, Q. Hao, B. Guenther, "Human-tracking systems using pyroelectric infrared detectors", Optical Engineering, vol. 10, no. 45, pp. 106401 (0110), Oct. 2006. Glister, Ron 2002. PC Hardware: A beginner’s guide. McGraw-Hill Professional Publishing, USA. Glister, Ron & Heneveld, Helen 2004. HTI + Home Technology Integration and CEDIA Install I All-in-one Exam Guide. McGraw-Hill Professional Publishing, USA. Hair Joseph & Money Arthur, Page Mike & Samouel Phillip 2007. Research Methods for Business. John Wiley & Sons. Chichester. Hickey, Robert B 2003. Electrical Engineer’s Portable Handbook. McGraw-Hill Professional Publishing, USA. Lindstrom, Pete & Thornton, Frank 2005. RFID Security. Syngress Publishing, Canada. Long, Larry 2002. Home Networking Demystified. McGraw-Hill Professional Publishing, USA. 80
Lopez, J & Zhou, J 2008. Wireless Sensor Network Security. IOS Press, Amsterdam. Ross, John 2009. Network Know-How: An Essential Guide for the Accident Admin. No Starch Press, San Francisco, USA. Purser, Steve 2004. A Practical Guide to Managing Information Security. Artech House Incorporated, USA. Coleman, Pat & Nelson, Stephen L 2000. Effective Executive’s Guide to the Internet: The Seven Core Skills Required to Turn the Internet into a Business Power Tool. Consortium of Collective Consciousness, USA.
6.2. NOT PRINTED Apple 2009. Time capsule setup Guide. Downloaded May 2010. http://manuals.info.apple.com/en/TimeCapsule_SetupGuide.pdf Arnief 2009.To Select a Home Backup Storage Device. Downloaded December 2010. http://www.ehow.com/how_5111431_select-home-backup-storagedevice.html Bruin Online 2009. Virtual Private Networking (VPN) using PPTP. Downloaded November 2010. http://www.bol.ucla.edu/services/vpn/pptp/ Dorgem Web Capturer 2003. Updated in January 2003. Downloaded January 2011. http://dorgem.sourceforge.net/ Lukko Oy & Gränslås 2010. An Interview in Tornio & Sweden. 9th October 2010. Meriläinen, Juha 2010. Discussion with the supervisor. 19th May 2010. Mitchell, Bradley. Gallery of Home Network Diagrams. Downloaded November 2010. Paragon Software Group 2011. Updated in 2011. Downloaded January 2011. http://www.paragon-software.com/home/systembackup/ Petri Daniel 2009. Home Network Setup – What are the possible configuration settings for a home/SOHO network with 3-4 computers and an ADSL Interconnection? Downloaded November 2010. http://www.petri.co.il/adsl_home_network_config.htm R. Kayne 2010. What is ADSL? Downloaded November 2010. http://www.wisegeek.com/what-is-adsl.htm
81