Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

GSM BASED DEVICES CONTROL SYSTEM PROJECT REPORT

38,601 views

Published on

B.Tech final year major project report

Published in: Technology, Business
  • Login to see the comments

GSM BASED DEVICES CONTROL SYSTEM PROJECT REPORT

  1. 1. 1 PROJECT REPORT ON SMS BASED DEVICES CONTROL SYSTEM USING GSM TECHNOLOGY Submitted For Partial Fulfilment of Award of BACHELOR OF TECHNOLOGY in Electrical & Electronics Engineering [2008-2012] BY Richa Shukla Rituraj Shriya Mehrotra Shobhit Chaturvedi Vishal Kant Rai UNDER THE GUIDANCE OF Mr.Vinamra Govil (Lecturer) BABU BANARSI DAS NATIONAL INSTITUTE OF TECHNOLOGY&MANAGEMENT LUCKNOW,INDIA
  2. 2. 2 UNDERTAKING We declare that the work presented in this project titled “SMS BASED DEVICES CONTROL SYSTEM USING GSM TECHNOLOGY” submitted to the Department of Electrical & Electronics Engineering, Babu Banarsi Das National Institute Of Technology & Management, Lucknow for the award of the Bachelor of Technology degree, is our original work .We have not plagiarized or submitted the same work for the award of any other degree. In case this undertaking is found incorrect , We accept that our degree may be unconditionally withdrawn. Date: ………………………. Place: Lucknow Richa Shukla Rituraj Shriya Mehrotra Shobhit Chaturvedi Vishal Kant Rai
  3. 3. 3 BABU BANARASI DAS NATIONAL INSTITUTE OF TECHNOLOGY & MANAGEMENT LUCKNOW- 211004,INDIA CERTIFICATE This is to certify that project report entitled “SMS BASED DEVICES CONTROL SYSTEM USING GSM TECHNOLOGY” presented by RICHA SHUKLA, RITURAJ, SHRIYA MEHROTRA, SHOBHIT CHATURVEDI, VISHAL KANT RAI students of final year B.ech in “ELECTRICAL & ELECTRONICS ENGINEERING” are the bonafide presentation of their work done by them under my supervision and guidance. They have submitted this project report towards partial fulfillment for the award of degree of bachelor of technology of the “UTTAR PRADESH TECHNICAL UNIVERSITY, LUCKNOW” .it is further certified that this work has not being submitted elsewhere for the award of any degree or diploma. MR. RAFEEQ AHMAD MR. VINAMRA GOVIL MR. MOHD. SHIBLEE (PROJECT CO-ORDIN.) (PROJECT GUIDE) (HOD, EN-DEPT.) LECTURER EN-DEPT LECTURER EN-DEPT B.B.D.N.I.T.M.
  4. 4. 4 ACKNOWLEDGEMENT We would like to give our cordial thanks to our project guide Mr. VINAMRA GOVIL Senior lecturer EN DEPARTMENT, B.B.D. N. I.T.M,Lucknow,for his regular encouragement,invaluable advice and support without with this project would never have been completed so smoothly.It is because his regular guidance and effort,that the whole process has become a success. We would also like to thanks Mr. MOHD. SHIBLEE, HOD& MR.RAFEEQ AHMAD, project coordinator, Electrical & Electronics Engineering Department, B.B.D.N.I.T.M, Lucknow and other faculty members of the department, for their regular encouragement and support. Without their support ,completion of this B.Tech.course would not have been possible. They were the driving force and also the force of inspiration to us. We would like to thanks our friends Pragati Chaturvedi,Abhinandan Choudhary,Arun Kumar & special thanx to one of our team member Richa for their help in completing our project. Last but not the least We would like to thanks our parents for their indomitable patients,sacrifice and support without which the successful completion of this work would have been a distant dream.
  5. 5. 5 ABSTRACT The rapidly advancing mobile communication technology and the decrease incosts make it possible to incorporate mobile technology into home .The project report on “SMS BASED DEVICE CONTROL IN HOMES” gives an elaborate view and understanding of the project design and functioning. The report is divided into parts for explaining the step by step development of the project. The first part introduces the idea behind the project and the underlying information of the technologies used. Next chapter is dedicated for information on the equipments used and how they were accommodated in the project circuitry. The working of the project with the programming code are explained after that. Lastly, the merits, de-merits and future prospects of the project are given.
  6. 6. 6 CONTENTS ACKNOWLEDGEMENT ………………………….............................................4 ABSTRACT………………………………………………………………………5 LIST OF FIGURE………………………………………………………………...8 Chapter 1 INTRODUCTION…………………………………………………..9 1.1 INTRODUCTION……………………………………………………...10 1 .2 MOTIVATION………………………………………………………...11 1.3 PROBLEM STATEMENT……………………………………………..11 Chapter 2 EQUIPMENT & PCB DESGINING………………………………12 2.1 EQUIPMENTS……………………………………………………………….13 2.1.1 GSM modem……………………………………………………...13 2.1.2 ATMEGA …………………………………………………………15 2.1.3 LIQIUD CRYSTAL DISPLAY(LCD)……………………………20 2.1.4 RELAYS…………………………………………………………..21 2.1.5 ULN 2803…………………………………………………………24 2.2 PCB (PRINTED CIRCUIT BOARD) DESIGNING………………...26 2.2.1 LAYOUT OF THE PROJECT PCB………………………………27 2.2.2 PCB-DESIGNING………………………………………………...28 2.2.2.2CLEANING……………………………………………………..30
  7. 7. 7 2.2.2.3 ETCHING………………………………………………………31 2.2.2.4 DRILLING……………………………………………………..31 2.2.2.5 SOLDERING…………………………………………………..32 2.2.2.6 MASKING……………………………………………………..32 2.2.3 PCB LAYOUT………………………………………………………32 Chapter 3 COMPONENT LIST……………………………………………..34 3.1 COMPONENT LIST…………………………………………………..35 Chapter 4 WORKING OPERATION & PROGRAMMING CODE……..36 4.1 WORKING…………………………………………………………....37 4.2 CIRCUIT DIAGRAM ………………………………………………...39 4.3 PROGRAMMING CODE…………………………………………….40 Chapter 5 ADVANTAGES & DISADVANTAGES…………………………47 5.1 ADVANTAGES………………………………………………………48 5.2 DISADVANTAGES…………………………………………………..48 Chapter 6 APPLICATIONS…………………………………………………49 6.1 APPLICATIONS……………………………………………………...50 REFERENCES……………………………………………………...51
  8. 8. 8 LIST OF FIGURES Figure 1 Gsm Modem………………………………………………………….15 Figure 2 Pin configuration of Atmega…………………………………………18 Figure3 LCD………………………………………………………………….. 21 Figure4 Different types of relay……………………………………………….24 Figure 5 (a) pin connection of uln 2803………………………………………26 Figure 5 (b) plastic package…………………………………………………...26 Figure 6 PCB Layout of soldering side………………………………………28 Figure 7 PCB Layout of Component side…………………………………...28 Figure 8 PCB Designing process……………………………………………..29 Figure 9 PCB cleaning processs ……………………………………………..31 Figure 10 Block Diagram……………………………………………………39 Figure 11 Circuit Diagram..............................................................................40
  9. 9. 9 CHAPTER 1 INTRODUCTION
  10. 10. 10 INTRODUCTION 1.1 Introduction In today’s fast changing world, everything is becoming compact, portable and mobile. The mobile handsets for communication are the biggest advancement in the area. These have made our lives much simpler and connected. Today almost everyone is familiar with it’s usage, and is able to draw advantage from it. The technologies for mobile communication have been ever evolving. Each had there share of pro’s and con’s. The Global System for Mobile communication (originally Groupe Spécial Mobile) represents the second generation of mobile communications. It is a digital telephony system, used in most parts of the world, starting from Finland in 1991 till now, with more than 690 mobile networks providing GSM services across 213 countries. It uses time division multiple access technique (TDMA).GSM digitizes and compresses data, then sends it down a channel with other streams of user data, each in its own time slot. It operates at either the 900 MHz or 1800 MHz frequency band. GSM provides with Subscribers Identity Module(SIM) to every user.It is a detachable card which identifies user’s account to the network and provides authentication, that allows appropriate billing. The unique roaming features of GSM allow cellular subscribers to use their services in any GSM service area in the world in which their provider has a roaming agreement. The idea behind the project is to utilize the mobile nature of communication and application provided by the GSM technology, namely SMS.SMS stands for Short Messaging Service .Short Message Service is an integrated paging service that lets GSM cellular
  11. 11. 11 subscribers send and receive data right on their cellular phone's LED display, up to a maximum of 160 characters. The use of SMS makes the understanding and use of the project quite simple to the user. 1.2 Motivation As an engineering student a project is required as part of the final year work. The project chosen is the activation of HomeAutomation via mobile technology. This was selected because of incorporating mobile technology with controlling of appliances which we believe is the next important step to realize the Home Automation. 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. 1.3 Problem Statement 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. 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.
  12. 12. 12 CHAPTER 2 EQUIPMENT & PCB DESGINING
  13. 13. 13 2.1 EQUIPMENTS: The different major equipments used in system are enlisted below: a) GSM modem b) Microcontroller (ATEMEGA 168) c) LCD d) Relay e) ULN2803 2.1.1 GSM MODEM : A GSM modem is a specialized type of modem which accepts a SIM card, and operates over a subscription to a mobile operator, just like a mobile phone. From the mobile operator perspective, a GSM modem looks just like a mobile phone. A GSM modem exposes an interface that allows applications such as NowSMS to send and receive messages over the modem interface. The mobile operator charges for this message sending and receiving as if it was performed directly on a mobile phone. To perform these tasks, a GSM modem must support an ―extended AT command set‖ for sending/receiving SMS messages, as defined in the ETSI GSM 07.05 and and 3GPP TS 27.005 specifications. GSM modems can be a quick and efficient way to get started with SMS, because a special subscription to an SMS service provider is not required. In most parts of the world, GSM modems are a cost effective solution for receiving SMS messages, because the sender is paying for the message delivery. A GSM modem can be a dedicated modem device with a serial, USB or Bluetooth connection, such as the Falcom Samba 75 used in this document. (Other
  14. 14. 14 manufacturers of dedicated GSM modem devices include Wavecom, Multitech and iTegno.) SIM 300 is a Tri band GSM/GPRS engine that works on frequencies 900MHz, DCS 1800 and 1900MHz. With tiny configuration of 40mmx33mmx2.9mm, SIM 300 can meet almost all the space requirements in your applications, such as smart phone, PDA phone and other mobile devices. The physical interface to the mobile application is a 60 pin board t board connector, which provides all hardware interfaces between the module and customers’ boards except the RF antenna interfaces.You can turn on the module by driving the PWRKEY to a low level voltage for period time. The automatic power on circuit illustrate as following figure. The PWRKEY pin is the NO.34 pin of the module interface. The value of the capacitor C155 is recommended as Fig 1 GSM MODEM
  15. 15. 15 2.1.2ATMEGA 168: 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. Microcontrollers are designed for embedded applications, in contrast to the microprocessors used in personal computers or other general purpose applications. . 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 The Atmel®AVR® core combines a rich instruction set with 32 general purpose working registers. All the 32 registers are directly connected to the Arithmetic Logic Unit (ALU), allowing two independent registers to be accessed in one single instruction executed in one clock cycle. The resulting architecture is more code efficient while achieving throughputs up to ten times faster than conventional CISC microcontrollers. The ATmega8 provides the following features: 8 Kbytes of In-System Programmable Flash with Read-While-Write capabilities, 512 bytes of EEPROM, 1 Kbyte of SRAM, 23 general purpose I/O lines, 32 general purpose working registers, three flexible Timer/Counters with compare modes, internal and external interrupts, a serial programmable USART, a byte oriented Twowire Serial
  16. 16. 16 Interface, a 6-channel ADC (eight channels in TQFP and QFN/MLF packages) with 10-bit accuracy, a programmable Watchdog Timer with Internal Oscillator, an SPI serial port, and five software selectable power saving modes. The Idle mode stops the CPU while allowing the SRAM, Timer/Counters, SPI port, and interrupt system to continue functioning. The Powerdown mode saves the register contents but freezes the Oscillator. Pin Descriptions 1. VCC Digital supply voltage. 2 GND Ground. 3 Port B (PB7:0) XTAL1/XTAL2/TOSC1/TOSC2 Port B is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for each bit). The Port B output buffers have symmetrical drive characteristics with both high sink and source capability. As inputs, Port B pins that are externally pulled low will source current if the pull-up resistors are activated. The Port B pins are tri-stated when a reset condition becomes active, even if the clock is not running
  17. 17. 17 ATmega 8 Fig2 Pin configuration of ATmega 8
  18. 18. 18 4. Port C (PC5:0) Port C is a 7-bit bi-directional I/O port with internal pull-up resistors (selected for each bit). The PC5..0 output buffers have symmetrical drive characteristics with both high sink and source capability. As inputs, Port C pins that are externally pulled low will source current if the pull-up resistors are activated. The Port C pins are tri-stated when a reset condition becomes active, even if the clock is not running. 5. PC6/RESET If the RSTDISBL Fuse is programmed, PC6 is used as an I/O pin. Note that the electrical characteristics of PC6 differ from those of the other pins of Port C. If the RSTDISBL Fuse is unprogrammed, PC6 is used as a Reset input. A low level on this pin for longer than the minimum pulse length will generate a Reset. 6. Port D (PD7:0) Port D is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for each bit). The Port D output buffers have symmetrical drive characteristics with both high sink and source capability. As inputs, Port D pins that are externally pulled low will source current if the pull-up resistors are activated. The Port D pins
  19. 19. 19 are tri-stated when a reset condition becomes active, even if the clock is not running. 7. AVCC AVCC is the supply voltage pin for the A/D Converter, PC3:0, and ADC7:6. It should be externally connected to VCC, even if the ADC is not used. If the ADC is used, it should be connected to VCC through a low-pass filter. 8. AREF AREF is the analog reference pin for the A/D Converter. 9.ADC7:6 In the TQFP and QFN/MLF package, ADC7:6 serve as analog inputs to the A/D converter. These pins are powered from the analog supply and serve as 10-bit ADC channels.
  20. 20. 20 2.1.3 LIQIUD CRYSTAL DISPLAY(LCD): A liquid crystal display (LCD) is a flat panel display, electronic visual display, or video display that uses the light modulat. LCDs do not emit light directly.LCDs are used in a wide range of applications ,including computer monitors, television, instrument panels, aircraft cockpit displays, signage, etc. They are common in consumer devices such as video players, gaming Fig3 LCD devices, clocks, watches, calculators, and telephones. This LCD's typically have 14 data pins and 2 for the LED backlight. Character LCDs use a standard 14-pin interface and those with backlights have 16 pins. There is also be a single backlight pin, with the other connection via Ground or VCC pin. The two backlight pins may precede the pin 1. The nominal backlight voltage is around 4.2V at 25˚C using a VDD 5V capable model. Fig 3.LCD
  21. 21. 21 2.1.3.1 Features : a) 5 ´ 8 and 5 ´ 10 dot matrix possible b)Low power operation support: 2.7 to 5.5V c) Wide range of liquid crystal display driver power 3.0 to 11V d) 80 ´ 8-bit display RAM (80 characters max.) 2.1.4 Relays: Relays are electromechanical devices, which are used as a switch. Current flowing through the coil of the relay creates a magnetic field which attracts a lever and changes the switch contacts. The main advantages of using relay as a switch is that, they provide electrical isolation between inputs with the help of magnetic coupling and also we can handle a large power using a relay. There are different types of relays are available and they can be categorized in various ways. For example relays can be SPST, SPDT, DPST, DPDT etc. SPDT stands for Single Pole A relay will switch one or more poles, each of whose contacts can be thrown by energizing the coil in one of three ways:  Normally-open (NO) contacts connect the circuit when the relay is activated; the circuit is disconnected when the relay is inactive. It is also called aForm
  22. 22. 22 A contact or "make" contact. NO contacts can also be distinguished as "early- make" or NOEM, which means that the contacts will close before the button or switch is fully engaged.  Normally-closed (NC) contacts disconnect the circuit when the relay is activated; the circuit is connected when the relay is inactive. It is also called aForm B contact or "break" contact. NC contacts can also be distinguished as "late-break" or NCLB, which means that the contacts will stay closed until the button or switch is fully disengaged.  Change-over (CO), or double-throw (DT), contacts control two circuits: one normally-open contact and one normally-closed contact with a common terminal. It is also called a Form C contact or "transfer" contact ("break before make"). If this type of contact utilizes a "make before break" functionality, then it is called a Form D contact. The following designations are commonly encountered:  SPST – Single Pole Single Throw. These have two terminals which can be connected or disconnected. Including two for the coil, such a relay has four terminals in total. It is ambiguous whether the pole is normally open or normally closed. The terminology "SPNO" and "SPNC" is sometimes used to resolve the ambiguity.
  23. 23. 23  SPDT – Single Pole Double Throw. A common terminal connects to either of two others. Including two for the coil, such a relay has five terminals in total.  DPST – Double Pole Single Throw. These have two pairs of terminals. Equivalent to two SPST switches or relays actuated by a single coil. Including two for the coil, such a relay has six terminals in total. The poles may be Form A or Form B (or one of each).  DPDT – Double Pole Double Throw. These have two rows of change-over terminals. Equivalent to two SPDT switches or relays actuated by a single coil. Such a relay has eight terminals, including the coil. Fig 4.Different types of relay
  24. 24. 24 2.1.5 ULN 2803: The eight NPN Darlington connected transistors in this family of arrays are ideally suited for interfacing between low logic level digital circuitry (such as TTL, CMOS or PMOS/NMOS) and the higher current/voltage requirements of lamps, relays, printer hammers or other similar loads for a broad range of computer, industrial, and consumer applications. All devices feature open–collector outputs and freewheeling clamp diodes for transient Suppression. The ULN2803 is designed to be compatible with standard families while the ULN2804 is optimized for 6 to 15 volt high level CMOS or PMOS. MAXIMUM RATINGS (TA = 25°C and rating apply to any one device in the package, unless otherwise noted.) Rating Symbol Value Unit Output Voltage VO 50 V Input Voltage VI 30 V Collector Current – Conti. IC 500 mA Base Current – Continuous IB 25 Ma
  25. 25. 25 (B) (A) Fig 5 (A)pin connection of uln 2803 (B) plastic package
  26. 26. 26 2.2PCB (PRINTED CIRCUIT BOARD) DESIGNING: A printed circuit board, or PCB, is used to mechanically support and electrically connect electronic components using conductive pathways, tracks or traces etched from copper sheets laminated onto a non-conductive 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) PCBs are inexpensive, and can be highly reliable. They require much more layout effort and higher initial cost than either wire-wrapped or point-to-point constructed circuits, but are much cheaper and faster for high-volume production. Much of the electronics industry's PCB design, assembly, and quality control needs are set by standards.
  27. 27. 27 2.2.1 LAYOUT OF THE PROJECT PCB 2.2.1.A Solder side of the PCB Fig6: PCB Layout of soldering side 2.2.1.b Component side of the PCB: 0 Fig 7:PCB Layout of Component side
  28. 28. 28 2.2.2PCB-DESIGNING PCB Designing includes the following steps:- Fig8 : PCB Designing process CLEANSING ETCHING DRILLING PROCESSING PRINTING SOLDERING MASKING
  29. 29. 29 2.2.2.1PROCESSING The layout of a PCB has to incorporate all the information on the board before one can go on to the artwork preparation. This means that a concept that clearly defines all the details of the circuit and partly also of the final equipment, is a prerequisite before the actual layout can start. The detail circuit diagram is very important for the layout designer and he must also be familiar with the design concept and with the philosophy behind the equipment. The General Considerations are- a-) Layout scale:- Depending on the accuracy required, artwork should be produced at a 1:1 or 2:1 or even 4:1 scale. The layout is best prepared on the same scale as the artwork. This prevents all the problems which might be caused by redrawing of layout to the artwork scale. b-) Grid system or Graph Paper: - It is commonly accepted practice to use these for designing. c-) Board types:-There are two side of a PCB board – Component side & Solder side. Depending on these board are classified as- Single-sided Boards: - These are used where costs have to be kept at a minimum & a particular Circuit can be accommodated on such board. To jump over conductor tracks, components have to be utilized. If this is not
  30. 30. 30 feasible, jumper wires are used. (Jumper wires should be less otherwise double-sided PCB should be considered. Double-sided Boards: - These are made with or without plated through holes. Plated through holes are fairly expensive. 2.2.2.2CLEANING The cleaning of the copper surface prior to resist application is an essential step for any type of PCB process using etches or plating resist.After scrubbing with the abrasive, a water rinse will remove most of the remaining slurry. Fig 9: PCB cleaning process Scrubbing Water Rinse Wet Brushing Acid dip Final Rinse Drying Pumice/ Acid Slurry Tap Water Tap Water Hydrochloric Acid-HCl De-ionized Water Oven or Blowing of air.
  31. 31. 31 2.2.2.3 ETCHING It is of utmost importance to choose a suitable Etchant Systems. There are many factors to be considered:-  Etching speed  Copper solving capacity  Etchant price  Pollution character We have uses FeCl3 (Conc. 120 g/litre 0.1 M) for etching. 2.2.2.4 DRILLING The importance of hole drilling into PCB’s has further gone with electronic component miniaturization and its need for smaller holes diameters (diameters less than half the board thickness) and higher package density. The following hole diameter tolerances have been generally accepted wherever no other specifications are mentioned. Hole Diameter (D) <= 1mm + / - 0.05 mm Hole Diameter (D) > 3 mm + / – 0.1 mm
  32. 32. 32 2.2.2.5 SOLDERING Flux should be removed after Soldering. It is done through washing by 0.5—1 % HCl followed by Neutralization in dilute alkali to remove corrosive flux.Non- corrosive is removed by Iso-Propanal. 2.2.2.6 MASKING It is done for the protection of conductor track from Oxidation. 2.2.3 PCB LAYOUT A PCB layout is required to place components on the PCB so that the component area can be minimized and the components can be placed in an efficient manner. The components can be placed in two ways, either manually or by software. The manual procedure is quiet cumbersome and is very inefficient. The other method is by the use of computer software. This method is advantageous as it saves time and valuable copper area. There are various software’s available for this purpose like-  Express PCB  Pad2pad  Protel PCB  PCB design e.t.c.
  33. 33. 33 Many of them are loaded with auto routing and auto placement facility. The software that we have used here is EXPRESS PCB. This software has a good interface, easy editing options and a wide range of components. Express P.C.B. Express PCB is a very easy to use Windows application for laying out printed circuit boards. There are two parts to Express PCB, Express SCH for drawing schematics and Express PCB for designing circuit boards. We downloaded the software from the website www.expresspcb.com. There are lots of functions available in the software. This software is free of cost and it is very easy to use. The different layers of the PCB can be viewed by just a click of a button on the interface. And we easily get its print on paper which is utilized for further processing. We can design single sided PCB as well as Double Sided PCB with this Software.
  34. 34. 34 CHAPTER 3 COMPONENT LIST
  35. 35. 35 3.COMPONENT PART LIST The list of component used is enlisted below : COMPONENT MODEL QUANTITY GSM modem SIM 300 1 Microcontroller ATMEGA 168 1 Interfacing device ULN 2803 1 Relay JIH JIK 4 LCD HD44780U 1 LED 6 Variable resistance 1 Voltage Regulator LM 7805 1 Diode IN 4007 2 Resistance 1Kohm 6 Resistance 10Kohm 1 Crystal oscillator(10 MHz) 1 Ceramic capacitor 104/AEC 1 Ceramic capacitor 33/AEC 2 Connector 9 Connecting wires Relay JQC-3FC 4
  36. 36. 36 CHAPTER 4 WORKING OPERATION & PROGRAMMING CODE
  37. 37. 37 4 WORKING OPERATION & PROGRAMMING CODE This chapter deals with working of ―sms based control system using GSM MODEM‖. This chapter also introduces programming used in microcontroller. 4.1 WORKING: The idea behind this project is to use the existing GSM infrastructure. So, all the operations involve the gsm system also. As we send any sms, it goes through the gsm system. Any sent sms can be received if we use a SIM card and gsm module. To operate any gsm modem, we have to use the AT commands to operate them. For example, if any sms arrives the gsm modem sends the serial data in ASCII format. We can read these data if we connect the modem with the serial port of the microcontroller at the baud rate of 9600. As the microcontroller comes to know that a sms has been arrived, it can sent a proper AT command to read the sms. The reading of sms returns the mobile no of sender, the time and much more information. We have to select the sms part of the message. The starting string of the sms is used as the password. As the password is matched, then the sms arrival is assumed to be valid by the microcontroller otherwise, it ignores the sms.Working of ―sms based device control system using GSM MODEM‖ is very simple.It can be simply understood by its block diagram &circuit diagram.
  38. 38. 38 Fig 10.BLOCK DIAGRAM
  39. 39. 39 4.2 CIRCUIT DIAGRAM : Fig10. circuit diagram
  40. 40. 40 4.3 PROGRAMMING CODE: ATMEGA 168 operate for both analog as well as digital signal.programming of this microcontroller is done in compiler ARDUINO which is open source free compiler.Programing code is written below: // all the sms should start with # and terminate with *. #include <LiquidCrystal.h> #include <NewSoftSerial.h> #define led_pin 8 #define buzz_pin 9 LiquidCrystal lcd(2, 3, 4, 5, 6, 7); NewSoftSerial gsm(18,19);// connect the gsm module here String str=""; //String sent_sms="ok"; String status_string="OK"; //String sms_arrival="+CMTI: "+ String(char(34)) + "SM" + String(char(34)); //String mob_no=""; String sms=""; const char sms_end='*'; int stage=0; char ch; int i=-1; void setup()
  41. 41. 41 { lcd.begin(16, 2); // lcd.print("GSM BASED SYSTEM"); indicate(1000); gsm.begin(2400);// keep the speed of the modem slow to handle the data easily gsm.print("atnr"); // ATTENTION delay(100); gsm.print("ate0nr"); // ECHO OFF delay(100); gsm.print("at+cmgf=1nr");// SMS FORMAT TEXT delay(100); gsm.print("at+cnmi=2,1,0,1,0nr"); // indicates the arrival of new message delay(1000); gsm.flush(); // CLEAR THE INITIAL DATA OF MODEM delay(1000); gsm.print("at+cmgd=1nr"); // CLEAR THE LOCATION 1 pinMode(11,OUTPUT); digitalWrite(11,LOW); pinMode(14,OUTPUT); pinMode(15,OUTPUT); pinMode(17,OUTPUT); pinMode(16,OUTPUT); lcd.clear(); lcd.print("DEVICE CONTROL"); } void loop()
  42. 42. 42 { while(stage==0) // hold here unless otherwise any sms arrives { if(gsm.available()) { ch=char(gsm.read()); str+=ch; i=str.indexOf("+CMTI: "); if(i>=0) // only when sms gets arrived { //Serial.println("SMS ARRIVED"); lcd.clear(); lcd.print("SMS ARRIVED"); str=""; gsm.print("at+cmgr=1nr");// comman to read the sms stage=1;// now we shall read the sms i=-1 indicate(100); lcd.clear(); } } } while(stage==1) { if(gsm.available()) { ch=gsm.read(); // Serial.print(ch); lcd.print(ch);
  43. 43. 43 str+=ch; if(ch==sms_end)// termination character found {stage=2; indicate(100); } } } while(stage==2) { for(i=((str.indexOf('#')+1));(i<str.indexOf('*'));i++) // sms starts with # and ends with * { sms+=str.charAt(i); } indicate(1000); lcd.clear(); lcd.print("GSM BASED SYSTEM"); lcd.setCursor(0,1); lcd.print(sms); indicate(200); for(int n=0;n<=3;n++) { int pin=14+n; int data=sms[n]-'0'; digitalWrite(pin,data); }
  44. 44. 44 //****************************** str="";// clear the string gsm.print("at+cmgd=1nr");//clear the locatin 1 }// stage 2 while(stage==3) { if(gsm.available()) { ch=gsm.read(); // Serial.print(ch); str+=ch; if((str.indexOf("OK")>0)) { str=""; status_string="OK"; // mob_no=""; sms=""; stage=4; i=-1; indicate(100); delay(2000); send_sms(); delay(1000); } } }// stage 3
  45. 45. 45 while(stage==4) // { if(gsm.available()) { ch=gsm.read(); Serial.print(ch); str+=ch; if((str.indexOf("OK")>0)) { str=""; stage=0; lcd.clear(); lcd.print("DEVICE CONTROL"); } } } }//main loop void indicate(int i) { digitalWrite(led_pin, HIGH); digitalWrite(buzz_pin, HIGH); delay(i); digitalWrite(led_pin, LOW); digitalWrite(buzz_pin, LOW); }
  46. 46. 46 void send_sms() { gsm.print("ATnr"); gsm.print("AT+CMGS="); gsm.print(char(34)); gsm.print("+9197932022 58"); gsm.print(char(34)); gsm.print("nr"); delay(100); gsm.print("OK"); gsm.print(char(26)); // ascii code for ctrl^z // sent_sms="OK"; //
  47. 47. 47 CHAPTER 5 ADVANTAGES & DISADVANTAGES
  48. 48. 48 5 ADVANTAGES & DISADVANTAGE This project is made with best of capabilities and dedication. Details were taken care of in preparing it. The problems encountered in various steps were taken into account and eliminated to much extent so that they may not harm the project functioning. Also certain areas were thought of before hand and worked upon, so as to prevent them from becoming a limitation for the project. But, as it is that every system is not perfect in all the aspects. They have some associated limitations. Here are presented the advantages, in general and comparative of the counterparts, and disadvantages of the project. 5.1ADVANTAGES: 1. Devices can be controlled from long distances. 2. Economical design 3. Can be easily implemented in homes 4. Can be used by everyone with just the knowledge of text SMS 5. Format of the SMS is simple to understand and write. 5.2DISADVANTAGES: 1. The system is network dependent. Hence, network congestion can reduce the 00 reliability of the system. 2. User can make mistake while typing the message format.
  49. 49. 49 CHAPTER 6 APPLICATIONS
  50. 50. 50 6.1 APPLICATIONS The previous chapter deal with stated merits and de-merits of the project, the project can be put for use in following fields- 1. Home automation, which was the seed for developing the idea of project. 2. Remote device control. a) This will help to eliminate need of human personnel attending the device till it has to be switched off/on. Based on experience of approximate time to switch on/off ,he/she can control the device, saving time. b) It will also help to control device while attending to other work. c) User can control device in case of forgetting to do so while leaving for some other place. 3. Energy conservation 4. Irrigation systems
  51. 51. 51 REFERNCES: 1. Paper of M.J Vanderwerff on ―activation of home automation system via mobile technology‖ 2. Wikipedia-GSM technology 3. Data sheet of ATMEGA 168 4. www.motorola.com-interfacing device information 5. Dr. Aditya Trivedi-Prof. IIIT Gwalior 6. Labsguru workshop –programming details

×