gps vehicle track

168
GPS VEHICLE TRACKING & THEFT PREVENTION SYSTEM INTRODUCTION “Surveillance system using phone line for security and tracking”. Based on the above statement, it is targeted that this project will serve as good indication of how important it is to curb car theft in the country. Surveillance is specified to car alarm system and the means of sending the data to the owner of the vehicle using SMS when the alarm is triggered. Due to the inefficient conventional car security system, the possibility of the car can be stolen is high. The main reason is that the alarm is limited to the audible distance. Somehow if there is another way of transmitting the alarm to the car owner, tracking the vehicle ,knowing the exactly that the car is been stolen at the same time that is not limited to the audible and line of sight, the system can be upgraded. SMS is a good choice of the communication to replace the conventional alarm, because it can be done and does not require much cost. Although most of people know GPS can provide more security for the car but the main reason people does not apply it because the cost. Advance car security system is too expensive. Cost for the gadget is too high. Besides that, people also must pay for the service monthly. Tracking systems were first developed for the shipping industry because they wanted to determine where each vehicle was at any given time. Passive systems were developed in the beginning to fulfill these requirements. For the applications which require

Upload: karthik-dm

Post on 24-Nov-2015

62 views

Category:

Documents


2 download

DESCRIPTION

GPS Vehicle Track

TRANSCRIPT

GPS VEHICLE TRACKING & THEFT PREVENTION SYSTEMINTRODUCTION Surveillance system using phone line for security and tracking. Based on the above statement, it is targeted that this project will serve as good indication of how important it is to curb car theft in the country. Surveillance is specified to car alarm system and the means of sending the data to the owner of the vehicle using SMS when the alarm is triggered. Due to the inefficient conventional car security system, the possibility of the car can be stolen is high. The main reason is that the alarm is limited to the audible distance. Somehow if there is another way of transmitting the alarm to the car owner, tracking the vehicle ,knowing the exactly that the car is been stolen at the same time that is not limited to the audible and line of sight, the system can be upgraded. SMS is a good choice of the communication to replace the conventional alarm, because it can be done and does not require much cost. Although most of people know GPS can provide more security for the car but the main reason people does not apply it because the cost. Advance car security system is too expensive. Cost for the gadget is too high. Besides that, people also must pay for the service monthly. Tracking systems were first developed for the shipping industry because they wanted to determine where each vehicle was at any given time. Passive systems were developed in the beginning to fulfill these requirements. For the applications which require real time location information of the vehicle, these systems cant be employed because they save the location information in the internal storage and location information can only be accessed when vehicle is available. To achieve automatic Vehicle Location system that can transmit the location information in real time. Active systems are developed. Real time vehicular tracking system incorporates a hardware device installed in the vehicle (In- Vehicle Unit) and a remote Tracking server. The information is transmitted to Tracking server using GSM/GPRS modem on GSM network by using SMS or using direct TCP/IP connection with Tracking server through GPRS. Tracking server also has GSM/GPRS modem that receives vehicle location information via GSM network and stores this information in database. This information is available to authorized users of the system via website over the internet.

GPS receiver calculates its position by precisely timing the signals sent by GPS satellites high above the Earth. Each satellite continually transmits messages that include The time the message was transmitted. Precise orbital information the general system health and rough orbits of all GPS satellites. The receiver uses the messages it receives to determine the transit time of each message and computes the distance to each satellite. These distances along with the satellites' locations are used with the possible aid of trilateration depending on which algorithm is used, to compute the position of the receiver. This position is then displayed, perhaps with a moving map display or latitude and longitude; elevation information may be included. Many GPS units show derived information such as direction and speed, calculated from position changes. GPS tracking systems are used to track anyone and any-thing these days. Technology has rapidly advanced in the past few years and it has become very easy for the average person to use a tracking system. If you have a vehicle, then you may want to place a GPS tracking system under your dash or in your glove compartment. This way, if your car ever gets stolen, you will be able to locate it within seconds and you can catch the culprit. If you have a small child, you will want to have a tracking system in place in case they get lost or wander off. Every second counts with a lost or abducted child, so a tracking de-vice is imperative to avoid a possible disastrous and heartbreaking outcome. If you have valuable items in your home like jewelry, or electronics you will want a GPS tracking system in case they are ever stolen. There are also various tracking systems that can locate items inside buildings and parking garages. If you have a teenager son or daughter, you will want to use a GPS tracking system to make sure that they are driving responsibly and they are going where they told you they were going. If you suspect your spouse or significant other of cheating, a good tracking system will be able to confirm or absolve your suspicions.

ABSTRACTDeveloping Automatic Vehicle Location system using GPS for positioning information and GSM/GPRS or information transmission with following features. Acquisition of vehicles location information (latitude longitude) after specified time interval when user send request through SMS. Transmission of vehicles location and other information to the user mobile after specified interval of time through GSM. The objective of the project is to build an additional feature to the present security system that will allow the owner of the vehicle to stop the vehicle by sending SMS when there has been an intrusion into the vehicle. To provide a solution to avoid car stolen in the lower cost than advance security car system (GPS).

BLOCK DIAGRAM

CIRCUIT DIAGRAM

DESCRIPTIONWhen all required information is extracted and processed, it needs to be transmitted to a remote Tracking Server which will be able to display this information to the end user. For real time tracking of vehicle, reliable data transmission to remote server is very important. Wireless network is required to transmit vehicle information to remote server. Existing GSM network is selected to transmit vehicle information to remote server because of broad coverage of GSM network. It is also cost effective rather than to deploy own network for transmission of vehicle information. For data transmission over GSM network GSM modem is required. GSM modem can send and receive data SMS text messages and GPRS data over GSM network. Location data is transferred to microcontroller through serial interface. After processing of the data provided by GPS receiver, microcontroller transmits this information to remote location using GSM/GPRS modem. Microcontroller controls the operation of GSM/GPRS modem through serial interface using AT commands. Microcontroller is acting as Central Processing Unit for In-Vehicle unit. All operations of the In-Vehicle unit are to be controlled by the microcontroller. AT89S52 microcontroller needs instructions to operate the whole system. These instructions are provided to microcontroller by writing the software into microcontrollers flash memory. It reads the software instruction by instruction and performs the action as required by instruction. When user sends SMS to GSM the controller sends GPS information to the user through SMS. When user sends stop command by reply SMS the microcontroller stops the vehicle.Microcontroller is acting as Central Processing Unit for In-Vehicle unit. All operations of the In-Vehicle unit are to be controlled by the microcontroller. Microcontroller needs instructions to operate the whole system. These instructions are provided to microcontroller by writing the software into microcontrollers flash memory. It reads the software instruction by instruction and performs the action as required by instruction.

HARDWARE

REGULATED POWER SUPPLY

The regulated DC supply for the IC s and other parts of the circuit is provided by the separate DC power supply. Parts of power supplyA block diagram of a power supply system which converts a 230V AC mains supply into a regulated 5V DC supply is shown below:

The transformer used here is a step-down transformer which converts 230v AC into 12v AC.A full wave bridge rectifier made around the diodes converts the ac supply into a pulsating dc supply. Here the bridge consists of four IN4001 silicon diodes which are capable of delivering current up to 1 amps.

The ripple content in the rectifier output is smoothened by adding a capacitor filter in parallel to the output. The value of capacitor may be from 100 to 4700 microfarads. Higher the chosen value more is the filtering. The 12v dc is regulated to 5v dc using a 3-terminal series pass regulator with the input pin (pin1) to output of rectifier, output pin(pin3) to the supply output. The common pin (pin2) is connected to the supply ground. The output of the regulator will be 5volts.

MICROCONTROLLER

GENERAL Generally Microcontrollers have a CPU, Memory, Addressing Circuits, Interrupt handling circuits an internal UART, Ports, timers. The microcontroller models vary in data sizes from 4 to 32 bits. Four bit units are produced in huge volumes for very simple applications. 8-bit access is more versatile then others 16-32 bit words are used in high speed application in signal processing

PRACTICAL IMPLEMENTATION OF CONTROLLER To develop a microcontroller application, a development system is required. A microcontroller kit along with an assembler usually constitutes a development system. Serial and parallel communication devices like RS232, data encoder, Data decoder and vice versa.

ADVANTAGES OF MICROCONTROLLER

Increased reliability through a small part count. Reduced stock levels, as one microcontroller replaces several parts. Simplified product assembly. Greater product flexibility and adaptability. Rapid product changes or development by changing the product and not hardware

DESCRIPTION OF MICROCONTROLLER The AT89S51 is a low-power, high-performance CMOS 8-bit microcontroller with 4K bytes of In-System Programmable Flash memory. The device is manufactured using Atmels high-density nonvolatile memory technology and is compatible with the industry- Standard 80C51 instruction set and pin-out. The on-chip Flash allows the program memory to be reprogrammed in-system or by a conventional nonvolatile memory programmer. By combining a versatile 8-bit CPU with In-System Programmable Flash on a monolithic chip, the Atmel AT89S51 is a powerful microcontroller which provides a highly-flexible and cost-effective solution to many embedded control applications.The AT89S51 provides the following standard features: 4K bytes of Flash, 128 bytes of RAM, 32 I/O lines, Watchdog timer, two data pointers, two 16-bit timer/counters, a five vector two-level interrupt architecture, a full duplex serial port, on-chip oscillator, and clock circuitry. In addition, the AT89S51 is designed with static logic for operation down to zero frequency and supports two software selectable power saving modes. The Idle Mode stops the CPU while allowing the RAM, timer/counters, serial port, and interrupt system to continue functioning. The Power-down mode saves the RAM contents but freezes the oscillator, disabling all other chip functions until the next external interrupt or hardware reset.

Fig: Architecture of Microcontroller

Special Function Registers A map of the on-chip memory area called the Special Function Register (SFR) space. Note that not all of the addresses are occupied, and unoccupied addresses may not be implemented on the chip. Read accesses to these addresses will in general return random data, and write accesses will have an indeterminate effect.

Interrupt Registers The individual interrupt enable bits are in the IE register. Two priorities can be set for each of the five interrupt sources in the IP register.

Dual Data Pointer RegistersTo facilitate accessing both internal and external data memory, two banks of 16-bit Data Pointer Registers are provided: DP0 at SFR address locations 82H- 83H and DP1 at 84H-85H. Bit DPS = 0 in SFR AUXR1 selects DP0 and DPS = 1 selects DP1. The user should ALWAYS initialize the DPS bit to the appropriate value before accessing the respective Data Pointer Register.

Power off FlagThe Power off Flag (POF) is located at bit 4 (PCON.4) in the PCON SFR. POF is set to 1 during power up. It can be set and rest under software control and is not affected by reset.

Memory Organization MCS-51 devices have a separate address space for Program and Data Memory. Up to 64K bytes each of external Program and Data Memory can be addressed.

Program Memory If the EA pin is connected to GND, all program fetches are directed to external memory. On the AT89S51, if EA is connected to VCC, program fetches to addresses 0000H through FFFH are directed to internal memory and fetches to addresses 1000H through FFFFH are directed to external memory.

Data Memory The AT89S51 implements 128 bytes of on-chip RAM. The 128 bytes are accessible via direct and indirect addressing modes. Stack operations are examples of indirect addressing, so the 128 bytes of data RAM are available as stack space.

Interrupts The AT89S51 has a total of five interrupt vectors: two external interrupts (INT0 and INT1), two timer interrupts (Timers 0 and 1), and the serial port interrupt. Each of these interrupt sources can be individually enabled or disabled by setting or clearing a bit in Special Function Register IE. IE also contains a global disable bit, EA, which disables all interrupts at once.

Note that Table 4 shows that bit positions IE.6 and IE.5 are unimplemented. User software should not write 1s to these bit positions, since they may be used in futureAT8products.

The flags, TF0 an Timer 0 and Timer 1 flag TF1, are set at S5P2 of the cycle in which the timers overflow. The values are then polled by the circuitry in the next cycle. AT89S51 PIN CONFIGURATIONS

89S52 FEATURES

Compatible with MCS51 Products 4K Bytes of In-System Programmable (ISP) Flash Memory Endurance: 1000Write/Erase Cycles 4.0V to 5.5V operating Range Fully Static Operation: 0Hz to 33 MHz Three- Level Program Memory Lock 128 x 8-Bit Internal RAM 32 Programmable I/O Lines Two 16-bit Timers/Counters Six Interrupt Sources Full Duplex UART Serial Channel Low-Power Idle and Power-Down Modes Interrupt Recovery from Power-Down Modes Watchdog Timer Dual Data Pointer Power-off Flag Fast Programming Time Flexible ISP Programming (Byte and Page Mode)

BASIC CIRCUIT CONNECTION:

GND Ground (all packages except 42-PDIP; for 42-PDIP GND connects only the logic core and the embedded program memory). VCC Supply voltage (all packages except 42-PDIP).Port 0 Port 0 is an 8-bit open drain bi-directional I/O port. As an output port, each pin can sink eight TTL inputs. When 1s are written to port 0 pins, the pins can be used as high-impedance inputs. Port 0 can also be configured to be the multiplexed low-order address/data bus during accesses to external program and data memory. In this mode, P0 has internal pull-ups. Port 0 also receives the code bytes during Flash programming and outputs the code bytes during program verification. External pull-ups are required during program verification.Port 1 Port 1 is an 8-bit bi-directional I/O port with internal pull-ups. The Port 1 output buffers can sink/source four TTL inputs. When 1s are written to Port 1 pins, they are pulled high by the internal pull-ups and can be used as inputs. As inputs, Port 1 pins that are externally being pulled low will source current (IIL) because of the internal pull-ups. Port 1 also receives the low-order address bytes during Flash programming and verification.

Port 2 Port 2 is an 8-bit bi-directional I/O port with internal pull-ups. The Port 2 output buffers can sink/source four TTL inputs. When 1s are written to Port 2 pins, they are pulled high by the internal pull-ups and can be used as inputs. As inputs, Port 2 pins that are externally being pulled low will source current (IIL) because of the internal pull-ups. Port 2 emits the high-order address byte during fetches from external program memory and during accesses to external data memory that use 16-bit addresses (MOVX @ DPTR). In this application, Port 2 uses strong internal pull-ups when emitting 1s. During accesses to external data memory that use 8-bit addresses (MOVX @ RI), Port 2 emits the contents of the P2 Special Function Register.Port 2 also receives the high-order address bits and some control signals during Flash programming and verification.

Port 3 Port 3 is an 8-bit bi-directional I/O port with internal pull-ups. The Port 3 output buffers can sink/source four TTL inputs. When 1s are written to Port 3 pins, they are pulled high by the internal pull-ups and can be used as inputs. As inputs, Port 3 pins that are externally being pulled low will source current (IIL) because of the pull-ups. Port 3 receives some control signals for Flash programming and verification. Port 3 also serves the functions of various special features of the AT89S51, as shown in the following table.

RST Reset input. A high on this pin for two machine cycles while the oscillator is running resets the device. This pin drives High for 98 oscillator periods after the Watchdog times out. The DISRTO bit in SFR AUXR (address 8EH) can be used to disable this feature. In the default state of bit DISRTO, the RESET HIGH out feature is enabled.

ALE/PROG Address Latch Enable (ALE) is an output pulse for latching the low byte of the address during accesses to external memory. This pin is also the program pulse input (PROG) during Flash programming. In normal operation, ALE is emitted at a constant rate of 1/6 the oscillator frequency and may be used for external timing or clocking purposes. Note, however, that one ALE pulse is skipped during each access to external data memory. If desired, ALE operation can be disabled by setting bit 0 of SFR location 8EH. With the bit set, ALE is active only during a MOVX or MOVC instruction. Otherwise, the pin is weakly pulled high. Setting the ALE-disable bit has no effect if the microcontroller is in external execution mode.

PSEN Program Store Enable (PSEN) is the read strobe to external program memory. When the AT89S51 is executing code from external program memory, PSEN is activated twice each machine cycle, except that two PSEN activations are skipped during each access to external data memory.

EA/VPP External Access Enable. EA must be strapped to GND in order to enable the device to fetch code from external program memory locations starting at 0000H up to FFFFH. Note, however, that if lock bit 1 is programmed, EA will be internally latched on reset.EA should be strapped to VCC for internal program executions. This pin also receives the 12-volt programming enable voltage (VPP) during Flash programming.XTAL1 Input to the inverting oscillator amplifier and input to the internal clock operating circuit.XTAL2 Output from the inverting oscillator amplifier

SPECIAL FEATURES OF MICROCONTROLLER

Compatible with MCS-51 Products 4K Bytes of In-System Programmable (ISP) Flash Memory Endurance: 1000 Write/Erase Cycles 4.0V to 5.5V Operating Range Fully Static Operation: 0 Hz to 33 MHz Three-level Program Memory Lock 128 x 8-bit Internal RAM 32 Programmable I/O Lines Two 16-bit Timer/Counters Low-power Idle and Power-down Modes Interrupt Recovery from Power-down Mode Watchdog Timer Dual Data Pointer Power-off Flag Fast Programming Time Flexible ISP Programming (Byte and Page Mode). Direct, indirect and relative addressing modes. Power-On Reset (POR). Power-up Timer (PWRT) and Oscillator Start-up Timer (OST). High performance RISC CPU All single cycle instruction except for program branches which are two cycle

LCD INTERFACING WITH MICROCONTROLLERS INTRODUCTION The most commonly used Character based LCDs are based on Hitachi's HD44780 controller or other which are compatible with HD44580. In this tutorial, we will discuss about character based LCDs, their interfacing with various microcontrollers, various interfaces (8-bit/4-bit), programming, special stuff and tricks you can do with these simple looking LCDs which can give a new look to your application.

PIN DESCRIPTION

The most commonly used LCDs found in the market today are 1 Line, 2 Line or 4 Line LCDs which have only 1 controller and support at most of 80 characters, whereas LCDs supporting more than 80 characters make use of 2HD44780 controllers. Most LCDs with 1 controller has 14 Pins and LCDs with 2 controller has 16 Pins (two pins are extra in both for back-light LED connections). Pin description is shown in the table below.

Fig :Character LCD type HD44780 Pin diagram

Pin No.NameDescription

Pin no. 1D7Data bus line 7 (MSB)

Pin no. 2D6Data bus line 6

Pin no. 3D5Data bus line 5

Pin no. 4D4Data bus line 4

Pin no. 5D3Data bus line 3

Pin no. 6D2Data bus line 2

Pin no. 7D1Data bus line 1

Pin no. 8D0Data bus line 0 (LSB)

Pin no. 9EN1Enable signal for row 0 and 1 (1stcontroller)

Pin no. 10R/W0 = Write to LCD module1 = Read from LCD module

Pin no. 11RS0 = Instruction input1 = Data input

Pin no. 12VEEContrast adjust

Pin no. 13VSSPower supply (GND)

Pin no. 14VCCPower supply (+5V)

Pin no. 15EN2Enable signal for row 2 and 3 (2ndcontroller)

Pin no. 16NCNot Connected

Table 1: Character LCD pins with 2 Controller

INSTRUCTION REGISTER (IR) AND DATAREGISTER(DR) There are two 8-bit registers in HD44780 controller Instruction and Data register. Instruction register corresponds to the register where you send commands to LCD e.g. LCD shift command, LCD clear, LCD address etc. and Data register is used for storing data which is to be displayed on LCD. When send the enable signal of the LCD is asserted, the data on the pins is latched in to the data register and data is then moved automatically to the DDRAM and hence is displayed on the LCD. Data Register is not only used for sending data to DDRAM but also for CGRAM, the address where you want to send the data, is decided by the instruction you send to LCD. We will discuss more on LCD instruction set further in this tutorial.

COMMANDS ANDINSTRUCTION SETOnly the instruction register (IR) and the data register (DR) of the LCD can be controlled by the MCU. Before starting the internal operation of the LCD, control information is temporarily stored into these registers to allow interfacing with various MCUs, which operate at different speeds, or various peripheral control devices. The internal operation of the LCD is determined by signals sent from the MCU. These signals, which include register selection signal (RS), read/write signal (R/W), and the data bus (DB0 to DB7), make up the LCD instructions

There are four categories of instructions that: Designate LCD functions, such as display format, data length, etc. Set internal RAM addresses Perform data transfer with internal RAM Perform miscellaneous functions

DISPLAY DATA RAM (DDRAM)Display data RAM (DDRAM) stores display data represented in 8-bit character codes. Its extended capacity is 80 X 8 bits, or 80 characters. The area in display data RAM (DDRAM) that is not used for display can be used as general data RAM. So whatever you send on the DDRAM is actually displayed on the LCD. For LCDs like 1x16, only 16 characters are visible, so whatever you write after 16 chars is written in DDRAM but is no visible to the user.

Figures below will show you the DDRAM addresses of 1 Line, 2 Line and 4Line LCDs

Figure3.4: DDRAMAddress for 1 Line LCD

Figure 3.5: DDRAM Address for 2 Line LCD

Figure 3.6: DDRAM Address for 4 Line LCD

CGROM - Character Generator ROMNow you might be thinking that when you send an ascii value to DDRAM, how the character is displayed on LCD? so the answer is CGROM. The character generator ROM generates 5 x 8 dot or 5 x 10 dot character patterns from 8-bit character codes (see Figure 5 and Figure 6 for more details). It can generate 208 5 x 8 dot character patterns and 32 5 x 10 dot character patterns. User defined character patterns are also available by mask-programmed ROM.As you can see in both the code maps, the character code from 0x00 to 0x07 is occupied by the CGRAM characters or the user defined characters. If user want to display the fourth custom character then the code to display it is 0x03 i.e. when user send 0x03 code to the LCD DDRAM then the fourth user created character orpatterned willbe displayed on the LCD.

CHARACTER GENERATOR RAM(CGRAM)As clear from the name, CGRAM area is used to create custom characters in LCD. In the character generator RAM, the user can rewrite character patterns by program. For 5 x 8 dots, eight character patterns can be written, and for 5 x 10 dots, four character patterns can be written. BF-BusyFlag. Busy Flag is an status indicator flag for LCD. When we send a command or data to the LCD for processing, this flag is set (i.e. BF =1) and as soon as the instruction is executed successfully this flag is cleared (BF = 0). This is helpful inproducing an exact amount of delay for the LCD processing.

Figure 5: LCD characters code map for 5x8 dots

Figure 6: LCD characters code map for 5x10 dotsAs we can see in both the code maps, the character code from 0x00 to 0x07 is occupied by the CGRAM characters or the user defined characters. If user wants to display the fourth custom character then the code to display it is 0x03 i.e. when user sends 0x03 code to the LCD DDRAM then the fourth user created character or pattern Will be displayed on the LCD.

BF-BUSY-FLAGBusy Flag is an status indicator flag for LCD. When we send a command or data to the LCD for processing, this flag is set (i.e BF =1) and as soon as the instruction is executed successfully this flag is cleared (BF = 0). This is helpful in producing and exact amount of delay for the LCD processing.

To read Busy Flag, the condition RS = 0 and R/W = 1 must be met and The MSB of the LCD data bus (D7) act as busy flag. When BF = 1 means LCD is busy and will not accept next command or data and BF = 0 means LCD is ready for the next command or data to the process.

INSTRUCTION REGISTER (IR) AND DATA REGISTER (DR)There are two 8-bit registers in HD44780 controller Instruction and Data register. Instruction register corresponds to the register where you send commands to LCD e.g LCD shift command, LCD clear, LCD address etc. and Data register is used for storing data which is to be displayed on LCD. when send the enable signal of the LCD is asserted, the data on the pins is latched in to the data register and data is then moved automatically to the DDRAM and hence is displayed on the LCD.Data Register is not only used for sending data to DDRAM but also for CGRAM, the address where you want to send the data, is decided by the instruction you send to LCD.

LCD-INITIALIZATION

Before using the LCD for display purpose, LCD has to be initialized either by the internal reset circuit or sending set of commands to initialize the LCD. It is the user who has to decide whether an LCD has to be initialized by instructions or by internal reset circuit.

INITIALIZATION BY INTERNAL RESET CIRCUIT

An internal reset circuit automatically initializes the HD44780U when the power is turned on. The following instructions are executed during the initialization. The busy flag (BF) is kept in the busy state until the initialization ends (BF = 1). The busy state lasts for 10 ms after VCC rises to 4.5 V. Display clear Function set:DL = 1; 8-bit interface dataN = 0; 1-line displayF = 0; 5 x 8 dot character font Display on/off control:D = 0; Display offC = 0; Cursor offB = 0; Blinking off Entry mode set:I/D = 1; Increment by 1S = 0; No shift

Note: If the electrical characteristics conditions listed under the table Power Supply Conditions Using Internal Reset Circuit are not met, the internal reset circuit will not operate normally and will fail to initialize the HD44780U. For such a case, initial-ization must be performed by the MCU as explained in the section, Initializing by Instruction.

As mentioned in the Note, there is certain condition that has to be met, if user wants to use initialization by internal reset circuit. These conditions are shown in the Table 5 below.

Table 5: Power Supply condition for Internal Reset circuit

Figure 7 shows the test conditions which are to be met for internal reset circuit to be active.

Figure 7: Internal Power Supply reset

Now the problem with the internal reset circuit is, it is highly dependent on power supply, to meet this critical power supply conditions is not hard but are difficult to achieve when you are making a simple application. So usually the second method i.e. Initialization by instruction is used and is recommended most of the time.

INITIALIZATION BY INSTRUCTIONS

Initializing LCD with instructions is really simple. Given below is a flowchart that describles the step to follow, to initialize the LCD.

Figure 8: Flow chart for LCD initialization

As you can see from the flow chart, the LCD is initialized in the following sequence...1) Send command 0x30 - Using 8-bit interface2) Delay 20ms3) Send command 0x30 - 8-bit interface4) Delay 20ms5) Send command 0x30 - 8-bit interface6) Delay 20ms7) Send Function set - see Table 4 for more information8) Display Clear command9) Set entry mode command - explained below

The first 3 commands are usually not required but are recommended when you are using 4-bit interface. So you can program the LCD starting from step 7 when working with 8-bit interface. Function set command depends on what kind of LCD you are using and what kind of interface you are using (see Table 4 in LCD Command section).r

LCD ENTRY MODEFrom Table 3 in command section, you can see that the two bits decide the entry mode for LCD, these bits are:a) I/D - Increment/Decrement bitb) S - Display shift.With these two bits we get four combinations of entry mode which are 0x04,0x05,0x06,0x07 (see table 3 in LCD Command section). So we get different results with these different entry modes. Normally entry mode 0x06 is used which is No shift and auto increment.LCD INTERFACING WITH MICROCONTROLLERS 4-BIT MODE

INTRODUCTION

Till now whatever we discussed in the previous part of ths LCD tutorial, we were dealing with 8-bit mode. Now we are going to learn how to use LCD in 4-bit mode. There are many reasons why sometime we prefer to use LCD in 4-bit mode instead of 8-bit. One basic reason is lesser number of pins are needed to interface LCD.

In 4-bit mode the data is sent in nibbles, first we send the higher nibble and then the lower nibble. To enable the 4-bit mode of LCD, we need to follow special sequence of initialization that tells the LCD controller that user has selected 4-bit mode of operation. We call this special sequence as resetting the LCD. Following is the reset sequence of LCD.

Wait for abour 20mS Send the first init value (0x30) Wait for about 10mS Send second init value (0x30) Wait for about 1mS Send third init value (0x30) Wait for 1mS Select bus width (0x30 - for 8-bit and 0x20 for 4-bit) Wait for 1mS

The busy flag will only be valid after the above reset sequence. Usually we do not use busy flag in 4-bit mode as we have to write code for reading two nibbles from the LCD. Instead we simply put a certain amount of delay usually 300 to 600uS. This delay might vary depending on the LCD you are using, as you might have a different crystal frequency on which LCD controller is running. So it actually depends on the LCD module you are using. So if you feel any problem running the LCD, simply try to increase the delay. This usually works. For me about 400uS works perfect.LCD CONNECTIONS IN 4-BIT MODE

Above is the connection diagram of LCD in 4-bit mode, where we only need 6 pins to interface an LCD. D4-D7 are the data pins connection and Enable and Register select are for LCD control pins. We are not using Read/Write (RW) Pin of the LCD, as we are only writing on the LCD so we have made it grounded permanently. If you want to use it.. then you may connect it on your controller but that will only increase another pin and does not make any big difference. Potentiometer RV1 is used to control the LCD contrast. The unwanted data pins of LCD i.e. D0-D3 are connected to ground.

SENDING DATA/COMMAND IN 4-BIT MODE

We will now look into the common steps to send data/command to LCD when working in 4-bit mode. As i already explained in 4-bit mode data is sent nibble by nibble, first we send higher nibble and then lower nibble. This means in both command and data sending function we need to separate the higher 4-bits and lower 4-bits.The common steps are: Mask lower 4-bits Send to the LCD port Send enable signal Mask higher 4-bits Send to LCD port Send enable signal

Table 3: Command and Instruction set for LCD type HD44780

Although looking at the table you can make your own commands and test them. Below is a brief list of useful commands which are used frequently while working on the LCD.

No.InstructionHexDecimal

1Function Set: 8-bit, 1 Line, 5x7 Dots0x3048

2Function Set: 8-bit, 2 Line, 5x7 Dots0x3856

3Function Set: 4-bit, 1 Line, 5x7 Dots0x2032

4Function Set: 4-bit, 2 Line, 5x7 Dots0x2840

5Entry Mode0x066

6Display off Cursor off(clearing display without clearing DDRAM content)0x088

7Display on Cursor on0x0E14

8Display on Cursor off0x0C12

9Display on Cursor blinking0x0F15

10Shift entire display left0x1824

12Shift entire display right0x1C30

13Move cursor left by one character0x10 16

14Move cursor right by one character0x1420

15Clear Display (also clear DDRAM content)0x011

16Set DDRAM address or coursor position on display0x80+add*128+add*

17Set CGRAM address or set pointer to CGRAM location0x40+add**64+add**

Table 4: Frequently used commands and instructions for LCD

* DDRAM address given in LCD basics section see Figure 2,3,4** CGRAM address from 0x00 to 0x3F, 0x00 to 0x07 for char1 and so on..

GPS-634R (ROM base)

65 channels with ultra-high sensitiveSmart GPS Antenna module

Technical Data Sheet

Functional Description

IntroductionGPS-634R is a highly integrated smart GPS module with a ceramic GPS patch antenna. The antenna is connected to the module via an LNA. The module is with 51 channel acquisition engine and 14 channel track engine, which be capable of receiving signals from up to 65 GPS satellites and transferring them into the precise position and timing information that can be read over either UART port or RS232 serial port. Small size and high-end GPS functionality are at low power consumption, Both of the LVTTL-level and RS232 signal interface are provided on the interface connector, supply voltage of 3.6V~6.0V is supported. The smart GPS antenna module is available as an off-the-shelf component, 100% tested. The smart GPS antenna module can be offered for OEM applications with the versatile adaptation in form and connection. Additionally, the antenna can be tuned to the final systems circumstances.

Features

65 channels to acquire and track satellites simultaneously Industry-leading TTFF speed Tracking sensitivity reaches -161 dBm 0.5 PPM TCXO for quick cold start Integral LNA with low power control SBAS (WAAS/EGNOS) capable Cold start _ 29 sec under clear Sky Hot start _ 1 sec under clear Sky Accuracy 5m CEP Operable at 3.6V-6V Both of RS232 and UART interface at CMOS level Small form factor of 32 mm W x 32 mm Lx 8 mm H Mountable without solder process 6 pins wafer connector

Applications

Automotive and Marine Navigation Automotive Navigator Tracking Emergency Locator Geographic Surveying Personal PositioninG

CHARACTERISTICS

General Specification

The smart GPS antenna modules are characterized by the following parameters.

Serial Port SettingsThe default configuration within the standard GPS firmware is: Standard configuration of serial port: Supporting 4800/9600 baud rate (Default Value: 9600), 8 data bits, no parity, 1 stop bit, no flow Control.

Improved TTFFIn order to improve the TTFF (Time To First Fix), has been built with the back-up battery (SEIKO) to support the RTC with a back-up power when no system power is available.

ConnectorThe connector mounted on the GPS-634R is the Molexs connector type; the part number is 51021-0600. The mating plugs part number is 53261-0671.

NMEA protocolThe serial interface protocol is based on the National Marine Electronics Associations NMEA 0183 ASCII interface specification. This standard is fully defined in NMEA 0183, Version 3.01 The standard may be obtained from NMEA.

GGA-GLOBAL POSITIONING SYSTEM FIX DATATime, position and fix related data for a GPS receiver.Structure:$GPGGA,hhmmss.sss,ddmm.mmmm,a,dddmm.mmmm,a,x,xx,x.x,x.x,M,x.x,M,x.x,xxxx*hh 1 2 3 4 5 6 7 8 9 10 11 12 13

GLL - LATITUDE AND LONGITUDE, WITH TIME OF POSITION FIX AND STATUSLatitude and longitude of current position, time, and status.Structure:$GPGLL,ddmm.mmmm,a,dddmm.mmmm,a,hhmmss.sss,A,a*hh1 2 3 4 5 6 7 8Example:$GPGLL,4250.5589,S,14718.5084,E,092204.999,A,A*2D

GSA - GPS DOP AND ACTIVE SATELLITESGPS receiver operating mode, satellites used in the navigation solution reported by the GGA or GNS sentence and DOP values.

Structure:$GPGSA,A,x,xx,xx,xx,xx,xx,xx,xx,xx,xx,xx,xx,xx,x.x,x.x,x.x*hh1 2 3 3 3 3 3 3 3 3 3 3 3 3 4 5 6 7

Example:$GPGSA,A,3,01,20,19,13,,,,,,,,,40.4,24.4,32.2*0A

GSV - GPS SATELLITE IN VIEWNumbers of satellites in view, PRN number, elevation angle, azimuth angle, and C/No. Four satellites details are transmitted per message. Additional satellite in view information is sending in subsequent GSV messages.Structure:$GPGSV,x,x,xx,xx,xx,xxx,xx,,xx,xx,xxx,xx *hh1 2 3 4 5 6 7 4 5 6 7 8Example:$GPGSV,3,1,09,28,81,225,41,24,66,323,44,20,48,066,43,17,45,336,41*78$GPGSV,3,2,09,07,36,321,45,04,36,257,39,11,20,050,41,08,18,208,43*77

RMC - RECOMMANDED MINIMUM SPECIFIC GPS/TRANSIT DATATime, date, position, course and speed data provided by a GNSS navigation receiver.Structure:$GPRMC,hhmmss.sss,A,dddmm.mmmm,a,dddmm.mmmm,a,x.x,x.x,ddmmyy,x.x,a,a*hh1 2 3 4 5 6 7 8 9 10 11 12 13Example:$GPRMC,092204.999,A,4250.5589,S,14718.5084,E,0.00,89.68,211200,,A*25

VTG - COURSE OVER GROUND AND GROUND SPEEDThe Actual course and speed relative to the ground.Structure:GPVTG,x.x,T,x.x,M,x.x,N,x.x,K,a*hh1 2 3 4 5 6Example:$GPVTG,89.68,T,,M,0.00,N,0.0,K,A*5F

GSM MODEM

INTRODUCTION TO GSM / GPRS WIRELESS MODEMS

What is a GSM Modem?A GSM modem is a wireless modem that works with a GSM wireless network. A wireless modem behaves like a dial-up modem. The main difference between them is that a dial-up modem sends and receives data through a fixed telephone line while a wireless modem sends and receives data through radio waves.A GSM modem can be an external device or a PC Card / PCMCIA Card. Typically, an external GSM modem is connected to a computer through a serial cable or a USB cable. A GSM modem in the form of a PC Card / PCMCIA Card is designed for use with a laptop computer. It should be inserted into one of the PC Card / PCMCIA Card slots of a laptop computer.Like a GSM mobile phone, a GSM modem requires a SIM card from a wireless carrier in order to operate.As mentioned in earlier sections of this SMS tutorial, computers use AT commands to control modems. Both GSM modems and dial-up modems support a common set of standard AT commands. You can use a GSM modem just like a dial-up modem.In addition to the standard AT commands, GSM modems support an extended set of AT commands. These extended AT commands are defined in the GSM standards. With the extended AT commands, you can do things like: Reading, writing and deleting SMS messages. Sending SMS messages. Monitoring the signal strength. Monitoring the charging status and charge level of the battery. Reading, writing and searching phone book entries.The number of SMS messages that can be processed by a GSM modem per minute is very low -- only about six to ten SMS messages per minute.

What is a GPRS Modem?A GPRS modem is a GSM modem that additionally supports the GPRS technology for data transmission. GPRS stands for General Packet Radio Service. It is a packet-switched technology that is an extension of GSM. (GSM is a circuit-switched technology.) A key advantage of GPRS over GSM is that GPRS has a higher data transmission speed.GPRS can be used as the bearer of SMS. If SMS over GPRS is used, an SMS transmission speed of about 30 SMS messages per minute may be achieved. This is much faster than using the ordinary SMS over GSM, whose SMS transmission speed is about 6 to 10 SMS messages per minute. A GPRS modem is needed to send and receive SMS over GPRS. Note that some wireless carriers do not support the sending and receiving of SMS over GPRS.If you need to send or receive MMS messages, a GPRS modem is typically needed.Which is Better: Mobile Phone or GSM / GPRS Modem?In general, a GSM/GPRS modem is recommended for use with a computer to send and receive messages. This is because some mobile phones have certain limitations comparing to GSM/GPRS modems. Some of the limitations are described below:What is a concatenated SMS message?A concatenated SMS message is a message that contains more than 140 bytes. (A normal SMS message can only contain at most 140 bytes.) Concatenated SMS works like this: the sender's mobile device breaks a message longer than 140 bytes into smaller parts. Each of these parts are then fitted in a single SMS message and sent to the recipient. When these SMS messages reach the destination, the recipient's mobile device will combine them back to one message.

What is the cause of the problem?When the mobile phone receives the SMS messages that are parts of a concatenated SMS message, it combines them to one message automatically. The correct behavior should be: when the mobile phone receives the SMS messages that are parts of a concatenated SMS message, it forwards them to the computer without combining them. Many mobile phone models cannot be used with a computer to receive MMS messages. Because when they receive a MMS notification, they handle it automatically instead of forwarding it to the computer. A mobile phone may not support some AT commands, command parameters and parameter values. For example, some mobile phones do not support the sending and receiving of SMS messages in text mode. So, the AT command "AT+CMGF=1" (it instructs the mobile phone to use text mode) will cause an error message to be returned. Usually GSM/GPRS modems support a more complete set of AT commands than mobile phones. Most SMS messaging applications have to be available 24 hours a day. (For example, an SMS messaging application that provides ringtone downloading service should be running all the time so that a user can download ringtones any time he/she wants.) If such SMS messaging applications use mobile phones to send and receive SMS messages, the mobile phones have to be switched on all the time. However, some mobile phone models cannot operate with the battery removed even when an AC adaptor is connected, which means the battery will be charged 24 hours a day.Besides the above issues, mobile phones and GSM/GPRS modems are more or less the same for sending and receiving SMS messages from a computer. Actually, you can consider an AT-command-enabled mobile phone as "GSM/GPRS modem + keypad + display + ...".There is not much difference between mobile phones and GSM/GPRS modems in terms of SMS transmission rate, since the determining factor for the SMS transmission rate is the wireless network.

THEORY OF OPERATION The protocol used by GSM modems for setup and control is based on the Hayes AT-Command set. The GSM modem specific commands are adapted to the services offered by a GSM modem such as: text messaging, calling a given Phone number, deleting memory locations etc. Since the main objective for this application note is to show how to send and receive text messages, only a subset of the AT-Command set needs to be implemented. The European Telecommunication Standard Institute (ETSI) GSM 07.05 defines the AT-Command interface for GSM compatible modems. From this document some selected commands are chosen, and presented briefly in this section. This command subset will enable the modem to send and receive SMS messages. For further details, please consult GSM 07.05.

AT-Command set The following section describes the AT-Command set. The commands can be tried out by connecting a GSM modem to one of the PCs COM ports. Type in the test-command, adding CR + LF (Carriage return + Line feed = \r\n) before executing. Also see chapter 3.1 for further details. Table 2-1 gives an overview of the implemented AT-Commands in this application. The use of the commands is described in the later sections.

Table 2-1. AT-Command set overview

The following formats are used in Table 2-2 through 2-9:

Character string in quotation marks is the actual text sent to modem.

Optional commands and response parameters are enclosed in brackets.

Status (AT) The AT command is a status request used for testing if a compatible modem is connected and that the serial interface is working properly.

Table 2-2. AT command and possible responses

Echo off (ATE0) The ATE0 command is used to config the communication. By default, GSM modems are set to echo any received command back with an acknowledgement. An example of this is shown below. AT\r\n //Command sent to modem AT\r\nOK\r\n //Response from modem with echo enabled After sending AT, the modem replies with AT\r\rOK\r\n. With echo off, ATE0, the modem would have answered \r\nOK\r\n when executing AT. The echo off command will reduce traffic on the serial line. The ATE1 command will enable echo again.

Table 2-3. ATE0 command and possible responses

New Message Indication (AT+CNMI) AT+CNMI configures how the modem signals arrival of new messages to the connected terminal device and how they are stored in the modem. This feature is useful when it comes to reading new messages. Instead of polling the modem periodically for arrival of new messages, AT+CNMI can tell when a new message has arrived. The AVR will catch such indication, and set a flag. This ensures that the modem only takes up CPU resources when necessary.

Table 2-4. AT+CNMI command and possible responses

Notes:

1. [mode] integer type: how messages are buffered.

2. [mt] integer type: indication of new SMS, set to 1.

3. [bm] integer type: Not in use.

4. [ds] integer type: Not in use.

5. [bfr] integer type: Not in use.

What values [mode], [mf], [bm], [ds] and [bfr] could take will be different from modem to modem. This should be tested off line with modem connected to the PC. An example is given below: AT+CNMI=?\r\n //Possible value request +CNMI: (0,1),(0,1),(0,2),(0,2),(1) //Possible parameter values OK //Command executed OK

Preferred Message Storage (AT+CPMS)The AT+CPMS command sets the target memory location for storing sent, read, deleted and received SMS messages. Most modems have multiple storage types:

SM: SIM card memory.

ME: Mobile Equipment storage. Dedicated storage within the modem for text messages only.

MT: Collection of all storage connected to the modem: SM, ME or others. The phone will chose one appropriate if this option is enabled.

Table 2-5. AT+CPMS command and possible responses

Notes:

1. [M1] string type: Memory from which messages are read and deleted.

2. [M2] string type: Memory to which messages are written and sent.

3. [M3] string type: Memory in which received messages are stored, if forwarding to pc is not set.

[used] integer type: is number of messages currently in x. [total] integer type: is total number of message locations in x.

Message format(AT+CMGF) The AT+CMGF command is used to set input and output format of SMS messages. Two modes are available: PDU mode: reading and sending SMS is done in a special encoded format. Text mode: reading and sending SMS is done in plain text. PDU mode is described later in section 2.2. This compressed format saves message payload and is default on most modems. PDU mode is implemented in the source code for this application note, it is possible to use text mode to reduce code footprint if the connected modem supports this. In text mode header fields as sender address, message length, validation period etc. can be read out in plain text together with the sent message.

Table 2-6. AT+CMGF command and possible responses

Read Message (AT+CMGR) The AT+CMGR command is used to read a message from a given memory location. Execution of AT+CMGR returns a message at [index] from selected memory [M1] (See section 2.1.4 for memory setup). The status of the message and the entire compressed message (PDU) is returned. To get any useful information out of the compressed message it should be decompressed. The PDU format and the compression and decompression is described in section 2.2.2.

Table 2-7. AT+CMGR command and possible responses

Notes:

1. [index] integer type: Read message from location [index].

2. [stat]: integer type: Status of message in memory: READ, UNREAD, SENT and UNSENT.

3. [alpha] integer type: Manufacturer specific field. Not used.

4. [length] integer type: Length of compressed message.

5. [pdu] string type: Compressed message.

Send Message(AT+CMGS) This command enables the user to send SMS messages. Section 2.2.3 describes how to build such messages. How to include user defined text and recipient telephone number. After the user defined fields are set, the message can be compressed and sent using the AT+CMGS command. An example usage of AT+CMGS is given in section 2.2.3.

Table 2-8. AT+CMGS command and possible responses

Notes:

1. [length] integer type: Length of message.

2. CR = Carriage return

3. [pdu] string type: Compressed message

4. Ctrl-Z: Command terminator. ASCII character 26 (dec).

Delete Message(AT+CMGD) This command is used to delete a received stored message from [M1] (See Table 2-5). Table 2-9. AT+CMGD command and possible responses

Notes: 1. [index] integer type: Index of message to delete.

This concludes the presentation of the implemented AT-Command set. More commands are discussed in ETSI standard GSM 07.05, and proposed as a reference when working with applications interfacing GSM compatible modems together with manufacturers datasheet.

Error codes Many of the commands in the implemented subset can terminate with an error message related to the modem or network. These could be errors such as:

Memory failure.

Invalid recipient number.

Network timeout.

SIM busy or wrong.

Operation not allowed.

No network service.

These error messages can be useful, and could be implemented as a part of the application. It is possible to extend the handling of the error codes, but this is beyond the scope of this application note. We will just catch the ERROR message, and repeat the command. If more advanced error handling is desired one should refer to the modem datasheet.

INTERFACING THE GSM MODEM FROM A PC

All commands given can be tested having a GSM compatible modem connected to a PC using a suitable data cable.

Hardware setup and communication settings To test the available modem and how it responds to AT-Commands, connect it to a PCs COM port. This application note assumes that the phone will be connected using a RS232 data cable, though IrDA could be used if available.

Figure 3-1.Communication settings

Now the connected system should enable sending AT-Commands from the terminal window. Test with AT to verify this. Connecting the same RS232 data cable to the AVR Butterfly, a suitable adapter has to be made. Outputs from the level-shifter on the AVR Butterfly are routed to a 3x1 header, and not directly compatible with the RS232 cable. An adapter is easily made out of a male DSUB9 connector and two 2-wire cables (Supplied with the STK500). Pin-out and wiring for such an adapter is shown in Table 3-1and Figure 3-2.

Table 3-1. Pin chart for USART connection.

Figure 3-2. Schematics for serial adapter

INTER-OPERATOR SMS MESSAGESSuppose you and your friend are using the mobile phone service of wireless network operator A and wireless network operator B respectively. The transmission of an SMS message from you to your friend involves two wireless networks. This SMS message is called an inter-operator SMS message. Typically, the cost for sending an inter-operator SMS message from a mobile phone is higher than that for sending an intra-operator SMS message.

Transmission Process of Inter-operator SMS MessagesThe transmission of an inter-operator SMS message involves one or more SMS centers. Generally, there are two different ways for the transmission of inter-operator SMS messages. In the first way, signaling interconnections are set up between two wireless networks. When the originator SMS center receives an inter-operator SMS message, it gets the routing information from the recipient wireless network and delivers the SMS message to the recipient mobile phone directly. The following figure illustrates the transmission process:

The first way can be used if the two wireless networks involved in the transmission of the inter-operator SMS message are based on similar technologies. However, if this is not true, the second way has to be used. For example, when an SMS message is sent from a GSM network to a CDMA network. In the second way, the originator SMS center and the recipient SMS center are interconnected through an SMS gateway or with a communication protocol that is supported by both SMS centers. The SMS message first reaches the originator SMS center, which will then forward the SMS message towards the recipient SMS center. The recipient SMS center will be responsible for sending the SMS message to the recipient mobile phone and storing the SMS message if the recipient mobile phone is offline. The following figure illustrates the transmission process:

Intra-operator SMS MessagesIf both you and your friend are using the mobile phone service of the same wireless network operator, the transmission of an SMS message from you to your friend will involve only one wireless network operator. This SMS message is called an intra-operator SMS message.Typically, the cost for sending an intra-operator SMS message from a mobile phone is lower than that for sending other kinds of SMS messages such as inter-operator SMS messages. Some wireless network operators allow their subscribers to send unlimited intra-operator SMS messages free of charge.

Transmission Process of Intra-operator SMS MessagesThe transmission of an intra-operator SMS message involves only one SMS center. After leaving the sender, the intra-operator SMS message reaches the SMS center. The SMS center then delivers the SMS message to the recipient mobile phone. If the recipient mobile phone is offline, the SMS center stores the SMS message. It will deliver the SMS message when the recipient mobile phone is online. If the SMS message's validity period expires and the recipient mobile phone is still offline, the SMS center will remove the SMS message.When the SMS center receives the message delivery report from the recipient mobile phone or removes the SMS message (for example, when the validity period expires), it sends a status report to the sender if the sender requested one earlier.The following figure illustrates the transmission process of an intra-operator SMS message:

SMS Center / SMSCAn SMS center (SMSC) is responsible for handling the SMS operations of a wireless network. When an SMS message is sent from a mobile phone, it will reach an SMS center first. The SMS center then forwards the SMS message towards the destination. An SMS message may need to pass through more than one network entity (e.g. SMSC and SMS gateway) before reaching the destination. The main duty of an SMSC is to route SMS messages and regulate the process. If the recipient is unavailable (for example, when the mobile phone is switched off), the SMSC will store the SMS message. It will forward the SMS message when the recipient is available.

Very often an SMSC is dedicated to handle the SMS traffic of one wireless network. A network operator usually manages its own SMSC(s) and locates them inside its wireless network system. However, it is possible for a network operator to use a third-party SMSC that is located outside the wireless network system.

We must know the address of the wireless network operator's SMSC in order to use SMS messaging with your mobile phone. Typically an SMSC address is an ordinary phone number in the international format. A mobile phone should have a menu option that can be used to configure the SMSC address. Normally, the SMSC address is pre-set in the SIM card by the wireless network operator, which means you do not need to make any changes to it.

SMS GatewayOne problem of SMS messaging is that SMSCs developed by different companies use their own communication protocol and most of these protocols are proprietary. For example, Nokia has an SMSC protocol called CIMD whereas another SMSC vendor, CMG, has an SMSC protocol called EMI. We cannot connect two SMSCs if they do not support a common SMSC protocol. To deal with this problem, an SMS gateway is placed between two SMSCs. This is illustrated in the following figure. The SMS gateway acts as a relay between the two SMSCs. It translates one SMSC protocol to another one. This way can be used by two different wireless carriers to interconnect their SMSCs for purposes such as enabling the exchange of inter-operator SMS messages.

Figure 1. An SMS gateway acts as a relay between two SMS centers.

Besides wireless carriers, content providers and SMS application developers may also find an SMS gateway useful. Let's consider the following situation. Suppose you are the developer of an SMS text messaging application. To send and receive SMS text messages on your server, one way is to connect to the SMSCs of the wireless carriers. Different wireless carriers may use SMSCs from different vendors, which means your SMS text messaging application may need to support multiple SMSC-specific protocols. (This is illustrated in the following figure). As a result, the SMS text messaging application's complexity and development time increases.

Figure 2. An SMS text messaging application connects to SMSCs without an SMS gateway.

To deal with the above problem, an SMS gateway can be set up to handle the connections to the SMSCs. Now the SMS text messaging application only needs to know how to connect to the SMS gateway. To support more SMSCs, you just need to modify the settings of the SMS gateway. No change to the source code of the SMS text messaging application is required. The use of an SMS gateway can greatly shorten the SMS text messaging application's development time.To connect to an SMS gateway, you can use an SMSC protocol such as SMPP and CIMD. Some SMS gateways support an HTTP / HTTPS interface. HTTP / HTTPS is easier to use than SMSC protocols. The drawback is that there may be fewer SMS features to use. For example, an SMS gateway may not support the sending of picture messages through the HTTP / HTTPS interface.

Figure 3. An SMS text messaging application connects to SMSCs through an SMS gateway.

Besides using a direct connection to the SMSC of a wireless carrier, another way to send and receive SMS text messages on a computer is to use a mobile phone or GSM/GPRS modem. To do this, your SMS text messaging application has to know how to communicate with the mobile phone or GSM/GPRS modem using AT commands.Some SMS gateways are capable of handling the connections to mobile phones and GSM/GPRS modems. To send and receive SMS text messages with a mobile phone or GSM/GPRS modem, the SMS text messaging application only needs to know how to talk to the SMS gateway and does not need to know anything about AT commands. More details about GSM/GPRS modems and AT commands will be provided in later sections of this SMS tutorial.

Figure 4. An SMS text messaging application connects to a pool of mobile phones or GSM/GPRS modems through an SMS gateway.

Writing SMS Messages to Memory / Message Storage (AT+CMGW)The AT command +CMGW (command name in text: Write Message to Memory) is used to write an SMS message to memory (i.e. message storage). The memory/message storage area to which SMS messages are written is specified by the +CPMS AT command (command line in text: Preferred Message Storage).

Syntax of the +CMGW AT Command in SMS Text ModeIn SMS text mode, the syntax of the +CMGW AT command is: (Optional parameters are enclosed in square brackets.)+CMGW[=address[,address_type[,message_status]]]sms_message_bodyBefore we discuss each of the parameters, let's see an example that gives you some idea of how an actual command line should look like:AT+CMGW="+85291234567",145,"STO UNSENT"This is an example for illustrating the syntax of the +CMGW AT command in SMS text mode.

The address ParameterThe first parameter of the +CMGW AT command, address, specifies the destination address to send the SMS message to. Usually it is a mobile number formatted using the typical ISDN / telephony numbering plan (ITU E.164/E.163). For example, "+85291234567" and "91234567". Note that the value passed to the address parameter should be a string, i.e. it should be enclosed in double quotes.

The address parameter is optional and so it can be omitted. Later when you want to send the SMS message out, you can specify the destination address by the +CMSS AT command (command name in text: Send Message from Storage).

The address type ParameterThe second parameter of the +CMGW AT command, address_type, specifies the type of the address assigned to the address parameter. Two values are commonly used. They are 129 and 145: 129. Meaning: The value of address is formatted using the typical ISDN / telephony numbering plan (ITU E.164/E.163) but it is not sure whether the value of address is an international number, a national number or a number of other types. Example addresses: "85291234567", "91234567". 145. Meaning: The value of address is formatted using the typical ISDN / telephony numbering plan (ITU E.164/E.163) and it is an international number. Example address: "+85291234567".As address type is an optional parameter, it can be omitted. If you do so, the GSM/GPRS modem or mobile phone will use the default value of the address type parameter, which is: 129 if the value of address does not start with a "+" character. For example, "85291234567". 145 if the value of address starts with a "+" character. For example, "+85291234567".

The message status ParameterThe third parameter of the +CMGW AT command, message status, specifies the status of the SMS message to be written. The SMS specification has defined four status values: REC UNREAD. It refers to the message status "received unread". REC READ. It refers to the message status "received read". STO UNSENT. It refers to the message status "stored unsent". This is the default value. STO SENT. It refers to the message status "stored sent".Note that the value assigned to the message status parameter should be a string. Thus, it should be enclosed in double quotes.As message status is an optional parameter, it can be omitted. If you do so, the GSM/GPRS modem or mobile phone will use the default value of the message status parameter, which is "STO UNSENT".The Character, which represents the carriage return character, follows the message_status parameter. When the GSM/GPRS modem or mobile phone receives the carriage return character, it will send back a prompt formed by these four characters: the carriage return character, the linefeed character, the ">" character and the space character. If you don't understand what this means, don't worry. This should be clear to you when you see the example in the section "Example Demonstrating How to Use the +CMGW AT Command to Write SMS Text Messages to Message Storage in SMS Text Mode".The sms_message_body ParameterThe fourth parameter of the +CMGW AT command, sms_message_body, specifies the SMS message body to be written to the memory/message storage area. Entering the character will cancel the +CMGW AT command. If you don't understand what this means, see the example in the section "Example Demonstrating How to Use the +CMGW AT Command to Write SMS Text Messages to Message Storage in SMS Text Mode".

The CharacterWhen you finish entering the SMS message body, you have to enter the character to mark the end of the SMS message body. The GSM/GPRS modem or mobile phone will then attempt to write the SMS message to the memory/message storage area.SMSC Number Stored with the SMS Message (SMS Text Mode)In SMS text mode, the +CMGW AT command does not have a parameter that allows you to specify an SMSC number. (Note that the +CMGW AT command does have such parameter when the GSM/GPRS modem or mobile phone is operating in SMS PDU mode.) However, when an SMS message is written to message storage, an SMSC number is actually stored with it. The SMSC number stored is the one specified by the +CSCA AT command (command name in text: Service Centre Address). Later if you send the SMS message, it will be transmitted through this SMSC. Once an SMS message has been written to message storage, it is not possible to change the SMSC number stored with the SMS message by using AT commands.Note that it is possible that the command behavior on your mobile device is slightly different from what was described above.More information about this issue is available in the "SMSC Number to be Used by the +CMSS AT Command to Send SMS Messages" section of this SMS tutorial.Format of the Information Response of the +CMGW AT Command in SMS Text ModeIf the GSM/GPRS modem or mobile phone writes the SMS message to the message storage area successfully, it will return an information response to the computer / PC. In SMS text mode, the information response of the +CMGW AT command has the following format:+CMGW: index

index is an integer that tells us the memory location to which the SMS message was written in the message storage area. Example Demonstrating How to Use the +CMGW AT Command to Write SMS Text Messages to Message Storage in SMS Text ModeNow let's see a more detailed example that demonstrates how to use the +CMGW AT command to write SMS text messages to message storage in SMS text mode and how the +CMGW AT command should be used together with other AT commands.Instructing the GSM/GPRS Modem or Mobile Phone to Operate in SMS Text ModeFirst, enter the command line "AT+CMGF=1" in a terminal program (for example, HyperTerminal in Microsoft Windows) to instruct the GSM/GPRS modem or mobile phone to operate in SMS text mode. This step is necessary because the default mode is SMS PDU mode. Below shows the response returned from Nokia 6021 to HyperTerminal after the execution of the command line "AT+CMGF=1":AT+CMGF=1OKThe final result code OK indicates the +CMGF AT command was executed successfully. If the final result code ERROR is returned, it is likely that the GSM/GPRS modem or mobile phone does not support SMS text mode. To check whether the GSM/GPRS modem or mobile phone supports SMS text mode, enter the command line "AT+CMGF=?" in the terminal program. Here is the response returned from Nokia 6021 to HyperTerminal:AT+CMGF=?+CMGF: (0,1)

OKThe values in the parentheses indicate the modes that the GSM/GPRS modem or mobile phone can operate in. The value 0 represents SMS PDU mode and the value 1 represents SMS text mode. From the above response, we know that Nokia 6021 can operate in either SMS PDU mode or SMS text mode. See the section titled "Selecting the Operating Mode (AT+CMGF)" of this SMS tutorial if you want to learn further details about the +CMGF AT command.Selecting the Message Storage Area to Write SMS Text Messages toSecond, use the AT command +CPMS (command name in text: Preferred Message Storage) to select the message storage area to write SMS text messages to. For example, to instruct the GSM/GPRS modem or mobile phone to use the message storage area in the SIM card for the AT command +CMGW, assign the string value "SM" to the second parameter of the +CPMS AT command, like this:AT+CPMS="ME","SM"The first parameter of the +CPMS AT command is used to select the message storage area for reading and deleting SMS messages. It has no use to us here. So, it does not matter what value is assigned to the first parameter.Now press the Enter key on the keyboard and you should see something similar to this:AT+CPMS="ME","SM"+CPMS: 2, 150, 2,10,4,160

OKDetailed information about the +CPMS AT command is available in the earlier section "Preferred Message Storage (AT+CPMS)" of this SMS tutorial.Setting the SMSC Number to be Stored with the SMS Text MessageThird, use the AT command +CSCA (command name in text: Service Centre Address) to set the SMSC number to be stored with the SMS text message. Later if you send the SMS text message, it will be transmitted via the SMSC at this number. Usually the default setting is correct and you do not need to make any changes. Below demonstrates how to use the +CSCA AT command to set "+85290000000" as the SMSC number:

AT+CSCA="+85290000000"OKDetailed information about the +CSCA AT command can be found in the "Setting or Reading the Service Center Address / SMSC Address (AT+CSCA)" section of this SMS tutorial.Writing Text MessagesFourth, you can now use the +CMGW AT command to write a text message to the message storage area. Suppose you want the destination mobile phone number to be +85291234567 and the message status to be "stored unsent", you should enter something like this in the terminal program:AT+CMGW="+85291234567",145,"STO UNSENT"Then, press the Enter key of the keyboard to send a carriage return character to the GSM/GPRS modem or mobile phone. The GSM/GPRS modem or mobile phone will send back a prompt formed by four characters. They are the carriage return character, the linefeed character, the ">" character and the space character. If all characters are to be displayed, the characters you have sent to and received from the GSM/GPRS modem or mobile phone so far are:AT+CMGW="+85291234567",145,"STO UNSENT">However, the carriage return character and linefeed character have special meanings to a terminal program. When a terminal program sees a carriage return character, it moves the cursor to the beginning of the current line. When it sees a linefeed character, it moves the cursor to the same position on the next line. So, here is what you will actually see in a terminal program such as HyperTerminal:AT+CMGW="+85291234567",145,"STO UNSENT">If you want to cancel the write command at this point, press the Esc key on the keyboard. The GSM/GPRS modem or mobile phone will then return the OK final result code. Here shows the response returned from Nokia 6021:

AT+CMGW="+85291234567",145,"STO UNSENT">OKSome mobile devices return a slightly different response. One example is Philips 598:AT+CMGW="+85291234567",145,"STO UNSENT">

OKIf you do not want to cancel the write command, enter the body of the SMS text message that you want to write to the message storage area. Press Enter on the keyboard if you want to start a new line. When finished, press Ctrl+z on the keyboard. The GSM/GPRS modem or mobile phone then attempts to write the text message to the message storage area and returns a response to the computer / PC. Suppose the SMS text message is "It is easy to write text messages.". Below shows what you should see in a terminal program:AT+CMGW="+85291234567",145,"STO UNSENT"> It is easy to write text messages.+CMGW: 3

OKThe value in the information response is the index that indicates the location where the SMS text message is stored in the message storage area. In the above example, the information response tells us that the SMS text message "It is easy to write text messages." has been written to the memory location at index 3.The final result code OK tells us the execution of the +CMGW AT command is successful. If it fails, the GSM/GPRS modem or mobile phone will return either the final result code ERROR or +CMS ERROR. For example, if the message storage area is out of storage space, the GSM/GPRS modem or mobile phone will return +CMS error 322, like this:

AT+CMGW="+85291234567",145,"STO UNSENT"> It is easy to write text messages.+CMS ERROR: 322Syntax of the +CMGW AT Command in SMS PDU ModeIn SMS PDU mode, the syntax of the +CMGW AT command is: (Optional parameters are enclosed in square brackets.)+CMGW=TPDU_length[,message_status]SMSC_number_and_TPDUBefore we discuss each of the parameters, let's see an example that gives you some idea of how an actual command line should look like:AT+CMGW=42,207915892000000F001000B915892214365F7000021493A283D0795C3F33C88FE06CDCB6E32885EC6D341EDF27C1E3E97E72EThe TPDU_length ParameterThe first parameter of the +CMGW AT command, TPDU_length, specifies the length (in octets. 1 octet = 8 bits) of the TPDU (Transfer Protocol Data Unit) assigned to the SMSC_number_and_TPDU parameter. In the earlier example command line, the value assigned to the SMSC_number_and_TPDU parameter is:07915892000000F001000B915892214365F7000021493A283D0795C3F33C88FE06CDCB6E32885EC6D341EDF27C1E3E97E72EIt can be divided into two parts. The following part is the TPDU:01000B915892214365F7000021493A283D0795C3F33C88FE06CDCB6E32885EC6D341EDF27C1E3E97E72EThe TPDU is coded in hexadecimal format. Each character represents 4 bits, i.e. 1/2 octet. The TPDU has 84 characters and so there are totally 42 octets. That's why the value assigned to the TPDU_length parameter is 42.

The message_status ParameterThe second parameter of the +CMGW AT command, message_status, specifies the status of the SMS message to be written. The SMS specification has defined four status values: 0. It refers to the message status "received unread". 1. It refers to the message status "received read". 2. It refers to the message status "stored unsent". This is the default value. 3. It refers to the message status "stored sent".As message_status is an optional parameter, it can be omitted. If you do so, the GSM/GPRS modem or mobile phone will use the default value of the message_status parameter, which is 2.Note: To some mobile devices (for example, Sony Ericsson T68i and Philips 598), an error will occur if the TPDU type is SMS-SUBMIT and the message_status parameter value is 0 or 1, or if the TPDU type is SMS-DELIVER and the message_status parameter value is 2 or 3.The Character, which represents the carriage return character, follows the message_status parameter. When the GSM/GPRS modem or mobile phone receives the carriage return character, it will send back a prompt formed by these four characters: the carriage return character, the linefeed character, the ">" character and the space character. If you don't understand what this means, don't worry. This should be clear to you when you see the example in the section "Example Demonstrating How to Use the +CMGW AT Command to Write SMS Text Messages to Message Storage in SMS PDU Mode".The SMSC_number_and_TPDU ParameterThe third parameter of the +CMGW AT command, SMSC_number_and_TPDU, specifies the SMSC number and the TPDU in hexadecimal format. Entering the character will cancel the +CMGS AT command. If you don't understand what this means, see the example in the section "Example Demonstrating How to Use the +CMGW AT Command to Write SMS Text Messages to Message Storage in SMS PDU Mode".In the earlier example command line, the value assigned to the SMSC_number_and_TPDU parameter is:07915892000000F001000B915892214365F7000021493A283D0795C3F33C88FE06CDCB6E32885EC6D341EDF27C1E3E97E72EHere is some of the information encoded in the above hexadecimal sequence: TPDU type: SMS-SUBMIT SMSC number: +85290000000 Destination phone number: +85291234567 Text message: "It is easy to send text messages."If you want to learn how the hexadecimal sequence is coded, please go to the section titled "Some Explanation about the Coding of the SMSC_number_and_TPDU Parameter Value of the +CMGS AT Command" of this SMS tutorial.Besides the TPDU type SMS-SUBMIT, the +CMGW AT command accepts other TPDU types such as SMS-DELIVER.The CharacterWhen you finish entering the value for the SMSC_number_and_TPDU parameter, you have to enter the character to mark the end of the value. The GSM/GPRS modem or mobile phone will then attempt to write the SMS message to the message storage area.

MAX232DUAL EIA-232 DRIVERS/RECEIVERS

Meet or Exceed TIA/EIA-232-F and ITU Recommendation V.28 Operate With Single 5-V Power Supply Operate Up to 120 kbit/s Two Drivers and Two Receivers 30-V Input Levels Low Supply Current . . . 8 mA Typical Designed to be Interchangeable With

Maxim MAX232 ESD Protection Exceeds JESD 22 2000-V Human-Body Model (A114-A) Applications1. TIA/EIA-232-F2. Battery-Powered Systems3. Terminals4. Modems5. Computers

DESCRIPTIONThe MAX232 is a dual driver/receiver that includes a capacitive voltage generator to supply EIA-232 voltage levels from a single 5-V supply. Each receiver converts EIA-232 inputs to 5-V TTL/CMOS levels. These receivers have a typical threshold of 1.3 V and a typical hysteresis of 0.5 V, and can accept 30-V inputs. Each driver converts TTL/CMOS input levels into EIA-232 levels.Function Tables

Each Receiver

Logic Diagram (Positive Logic)

Absolute maximum ratings over operating free-air temperature range (unless otherwise noted)Input supply voltage range, VCC (see Note 1) . . . . . . . . . . . . . . . . . . . . 0.3 V to 6 VPositive output supply voltage range, VS+ . . . . . . . . . . .. . . . . . .. . . . . . . VCC 0.3 V to 15 VNegative output supply voltage range, VS . . . . .. . . . .. . . . . . . . . . . . . . 0.3 V to 15 VInput voltage range, VI: Driver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 0.3 V to VCC + 0.3 VReceiver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . 30 VOutput voltage range, VO: T1OUT, T2OUT . . . . . . . . . . . . . . . . . . VS 0.3 V to VS+ + 0.3 VR1OUT, R2OUT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 0.3 V to VCC + 0.3 VShort-circuit duration: T1OUT, T2OUT . . . . . . . . . . . . .. . . . . . UnlimitedPackage thermal impedance, JA (see Note 2): D package . . . . . . . . . . . . . . 73C/WDW package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57C/WN package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67C/WNS package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64C/WLead temperature 1,6 mm (1/16 inch) from case for 10 seconds . . . . . . . . . 260CStorage temperature range, Tstg . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65C to 150C

Recommended Operating Conditions

Electrical Characteristics over Recommended Ranges Of Supply Voltage

Electrical Characteristics over Recommended Ranges of Supply Voltage

Switching characteristics, VCC = 5 V, TA = 25oC

Electrical characteristics over recommended ranges of supply voltage

Switching characteristics, VCC = 5 V, TA = 25C

Parameter Measurement Information

Figure 1. Receiver Test Circuit and Waveforms for tPHL and tPLH Measurements

Parameter Measurement Information

Figure 2. Driver Test Circuit and Waveforms for tPHL and tPLH Measurements

Application Information

RELAY AND RELAY DRIVER5.1 RELAYS A relay is an electrical switch that opens and closes under the control of another electrical circuit. In the original form, the switch is operated by an electromagnet to open or close one or many sets of contacts. A relay is able to control an output circuit of higher power than the input circuit, in the form of an electrical amplifier.

5.2 RELAY OPERATION When a current flows through the coil, the resulting magnetic field attracts an armature that is mechanically linked to a moving contact. The movement either makes or breaks a connection with a fixed contact. When the current to the coil is switched off, the armature is returned by a force approximately half as strong as the magnetic force to its relaxed position. Usually this is a spring, but gravity is also used commonly in industrial motor starters. Most relays are manufactured to operate quickly. In a low voltage application, this is to reduce noise. In a high voltage or high current application, this is to reduce arcing.

If the coil is energized with DC, a diode is frequently installed across the coil, to dissipate the energy from the collapsing magnetic field at deactivation, which would otherwise generate a spike of voltage and might cause damage to circuit components. Some automotive relays already include that diode inside the relay case. Alternatively a contact protection network, consisting of a capacitor and resistor in series, may absorb the surge. If the coil is designed to be energized with AC, a small copper ring can be crimped to the end of the solenoid. This "shading ring" creates a small out-of-phase current, which increases the minimum pull on the armature during the AC cycle.

5.2.1 Coil Voltage The relay's coil voltage rating and resistance must suit the circuit powering the relay coil. Many relays have a coil rated for a 12V supply but 5V and 24V relays are also readily available. Some relays operate perfectly well with a supply voltage which is a little lower than their rated value.

5.2.2 Coil Resistance The circuit must be able to supply the current required by the relay coil. We can use Ohm's law to calculate the current.

5.2.3 Switch Ratings (Voltage and Current) The relay's switch contacts must be suitable for the circuit they are to control. We will need to check the voltage and current ratings. Note that the voltage rating is usually higher for AC, for example: "5A at 24V DC or 125V AC".

5.2.4 Switch Contact Arrangement (SPDT, DPDT) Most relays are SPDT or DPDT which are often described as "single pole changeover" (SPCO) or "double pole changeover" (DPCO).

5.3 Types of Relays:

1) Electromagnetic relay 2) Reed relay 3) Mercury-wetted relay 4) Polarized relay 5) Machine tool relay 6) Contactor relay 7) Solid state contactor relay 8) Buchholz relay 9) Forced-guided contacts relay 10) Solid-state relay 11) Overload protection relay

In our project we are using Electro Magnetic Relay. Now the electro Magnetic Relay is described below

5.3.1 Electromagnetic Relay Fig 5.2 Electro Magnetic Relay

The electromagnetic relay consists of a multi-turn coil, wound on an iron core, to form an electromagnet. When the coil is energized, by passing current through it, the core becomes temporarily magnetized. The magnetized core attracts the iron armature. The armature is pivoted which causes it to operate one or more sets of contacts. When the coil is de-energized the armature and contacts are released. The coil can be energized from a low power source such as a transistor while the contacts can switch high powers such as the mains supply. The relay can also be situated remotely from the control source. Fig 5.3 Operation of Electro Magnetic RelayRelays can generate a very high voltage across the coil when switched off. This can damage other components in the circuit. To prevent this a diode is connected across the coil. The cathode of the diode is connected to the most positive end of the coil.

5.3.2 Poles and Throws Contact arrangements- polesThe primary difference between a control relay and a contractor are the number and size of contacts. The contacts in a control relay are relatively small currents used in control circuits. Another difference is that, unlike a contractor relay is used to control a difference circuit. On the other hand, with a contractor the contacts work together to start and stop a motor or other device.The term pole is used to describe the number if isolated circuits that the relay can control at once. A single pole can control one circuit, a double pole, and two and so on. A relay can have normally open normally closed and combinations of both.

Contact arrangements- ThrowsThrows is the number of different closed- contact positions per pole. In other words, throws describes the total number of different circuits each pole controls.

5.4 CONSIDERATIONS FOR RELAY APPLICATIONS

Number and type of contacts - normally open, normally closed, changeover (double-throw). In the case of changeover, there are two types. This style of relay can be manufactured two different ways. "Make before Break" and "Break before Make". The old style telephone switch required Make-before-break so that the connection didn't get dropped while dialing the number. The railroad still uses them to control railroad crossings. Rating of contacts - small relays switch a few amperes, large contactors are rated for up to 3000 amperes, alternating or direct current. Voltage rating of contacts - typical control relays rated 300 VAC or 600 VAC, automotive types to 50 VDC, special high-voltage relays to about 15,000 V. Coil voltage - machine-tool relays usually 24 VAC or 120 VAC, relays for switchgear may have 125 V or 250 VDC coils, "sensitive" relays operate on a few mill amperes. Package/enclosure - open, touch-safe, double-voltage for isolation between circuits, explosion proof, outdoor, oil-splash resistant. Mounting - sockets, plug board, rail mount, panel mount, through-panel mount, enclosure for mounting on walls or equipment Switching time - where high speed is required. "Dry" contacts - when switching very low level signals, special contact materials may be needed such as gold-plated contacts. Contact protection - suppress arcing in very inductive circuits. Coil protection - suppress the surge voltage produced when switching the coil current. Isolation between coil circuit and contacts. Aerospace or radiation-resistant testing, special quality assurance. Expected mechanical loads due to acceleration - some relays used in aerospace applications are designed to function in shock loads of 50 g or more. Accessories such as timers, auxiliary contacts, pilot lamps, test buttons.

5.5 TRANSISTOR RELAY DRIVER

Here NPN transistor switch is used for interfacing the digital IC and relays. When the output of the IC is low the base current I B be 0, so the transistor is in cut-off region and thus the relay remains OFF. When output of IC is high then the base current flow through the transistor and transistor is in saturation. Then the relay gets energized due to conduction of transistor.

Fig 5.6(a) Relay Driver

Fig 5.6(b) Relay Driver operation

Protection diodeIf the load is a motor, relay or solenoid (or any other device with a coil) a diode must be connected across the load to protect the transistor from the brief high voltage produced when the load is switched off. The diagram shows how a protection diode is connected 'backwards' across the load, in this case a relay coil.

Fig 5.7 Protection Diode ArrangementsCurrent flowing through a coil creates a magnetic field which collapses suddenly when the current is switched off. The sudden collapse of the magnetic field induces a brief high voltage across the coil which is very likely to damage transistors and ICs. The protection diode allows the induced voltage to drive a brief current through the coil (and diode) so the magnetic field dies away quickly rather than instantly. This prevents the induced voltage becoming high enough to cause damage to transistors and ICs.

5.5.1 TransistorA bipolar transistor is basically a two PN junctions connected Back-to-back within the same piece of semiconductor material and sharing a common P- or N-doped semiconductor region. There are two types of bipolar transistor, the NPN and the PNP. NPN type unit is a P-doped semiconductor material sandwiched between two layers of N-doped material. The composition of a PNP transistor is just the opposite of that, (i.e. the N- and P-doped materials in the transistor are interchanged). It follows then that biasing considerations for NPN units are also opposite from those for the PNP unit. A transistor has three legs: a collector, an emitter and a base. Below are the symbols f