Documente Academic
Documente Profesional
Documente Cultură
The main aim of this project is to control the computer system and electrical devices using a mobile phone with GSM technology. Instead of using mouse, one can use this device from certain distance. This device can perform all the functions that mouse carries like, Left-click, Right-click and movement of the curser.
This project consists of a mobile phone for controlling the PC and electrical devices from a remote location. User has to operate the PC within the visible distance. For example user can operate the PC kept at railway stations or waiting halls with his mobile phone. This project consists of Microcontroller based control system attached to the PC. A GSM modem is connected to the microcontroller as input device. GSM modem receives the respective message from the mobile phone and converts them into a four-bit signal. This four bit data is then fed to the microcontroller for further processing. Based on this the microcontroller sends information to the application running on PC through a RS232 serial cable interface. The software running inside the pc takes the responsibility of controlling the mouse pointer and other application in PC.
Automated sensors and remote communication aims at building a highly automated wireless system, which can be monitored with the help of a remote mobile. The employment of the GSM mobile into the project makes the device to overcome distance limitation.
INDEX
1. INTRODUCTION 2. EMBEDDED SYSTEMS 3. POWER SUPPLY 4. MICRO CONTROLLER 5. SERIAL COMMUNICATION
01 05 07 10 36 45 51 59 61 63 68 75
CONCLUSION BIBLIOGRAPHY
LIST OF FIGURES
1.1 BLOCK DIAGRAM OF PROJECT
02 03 04 06 07 08 09 09 11 12 14 14 19 23 36 40 41 42
3.1 BLOCK DIAGRAM OF POWER SUPPLY 3.2 BRIDGE WAVE RECTIFIER 3.3 VOLTAGE REGULATOR 3.4 CIRCUIT DIAGRAM OF POWER SUPPLY 4.1 BLOCK DIAGRAM OF 89C51 MICRO CONTROLLER 4.2 PIN CONFIGURATION OF MICROCONTROLLER 4.3 RESET SWITCH 4.4 DESCRIPTION OF XTAL1 AND XTAL2 PINS 4.5 INTERNAL RAM MEMORY 4.5 INTERNAL AND EXTERNAL DATA MEMORY 5.1 SERIAL COMMUNICATION TRANSMISSION METHOD 5.2 BLOCK DIAGRAM OF RS 232 5.3 PIN DIAGRAM OF RS232 CONNECTOR 5.4 MAX 232 IC
5.5 RS232 CABLE 6.1 ELECTROMECHANICAL RELAY 6.2 INTERNAL STRUCTURE OF RELAY 6.3 LATCHING RELAY 6.4 SOLID STATE RELAY 6.5 SOLID STATE CONTACTOR 7.1 GSM NETWORK STRUCTURE 8.1 LED 8.2 INTERNAL CIRCUIT OF A MANUAL SWITCH 8.3 SWITCHES 9.1 LIQUID CRYSTAL DISPLAY 9.2 SHOWING LCD PINS
43 45 45 47 49 49 56 59 60 60 61 62
1. INTRODUCTION
The aim of the project is to control the operations of the PC and other home appliances which were present in the home with the help of the mobile. The major building blocks of this project are: 1. Mobile phone. 2. Microcontroller. 3. Electromagnetic Relay. 4. GSM modem 5. LCD Display. 6. Serial communication interface (RS232) 7. MAX232 driver. And also we used the
Operation
This project consists of a mobile phone for controlling the PC and electrical devices from a remote location. User has to operate the PC within the visible distance. For example user can operate the PC kept at railway stations or waiting halls with his mobile phone. This project consists of Microcontroller based control system attached to the PC. A GSM modem is connected to the microcontroller as input device. GSM modem receives the respective message from the mobile phone and converts them into a four-bit signal. This four bit data is then fed to the microcontroller for further processing. Based on this the microcontroller sends information to the application running on PC through a RS232 serial cable interface. The software running inside the pc takes the responsibility of controlling the mouse pointer and other application in PC.
Automated sensors and remote communication aims at building a highly automated wireless system, which can be monitored with the help of a remote mobile. The employment of the GSM mobile into the project makes the device to overcome distance limitation.
Block diagram:
Power supply
LCD display
LED indicat or
8051 MICROCONTROLLER
RS232
RS232
COMPUTE R
GSM MODEM
SCHEMATIC DIAGRAM:
SNAPSHOT:
Mobile Phone Controlled PC With Control Electronic Devices 8
2. EMBEDDED SYSTEMS
Mobile Phone Controlled PC With Control Electronic Devices 9
An Embedded System is a special-purpose computer system designed to perform one or a few dedicated functions often with real-time computing constraints. It is usually embedded as part of a complete device including hardware and mechanical parts.. Embedded system controls many of the common devices. Physically, embedded systems range from portable devices such as digital watches and MP4 players. Now it ranges to large stationary installations like traffic lights, factory controllers, or the systems controlling nuclear power plants. Complexity varies from low, with a single microcontroller chip, to very high with multiple units, peripherals and networks mounted inside a large chassis or enclosure. Embedded processors can be broken into two broad categories: ordinary microprocessors (P) and microcontrollers (C), which have many more peripherals on chip, reducing cost and size. Embedded systems are designed to do some specific task, rather than be a generalpurpose computer for multiple tasks. Some also have real-time performance constraints that must be met, for reason such as safety and usability; others may have low or no performance requirements, allowing the system hardware to be simplified to reduce costs. Examples of Embedded Systems
Automatic teller machines (ATMs) Cellular telephones and telephone switches Home automation products, such as thermostats, air conditioners, sprinklers, and security monitoring systems Handheld calculators and computers Household appliances, including microwave ovens, washing machines, television sets, DVD players and recorders Medical equipment Industrial controllers for remote machine operation. An embedded system is not always a separate block - very often it is physically builtin to the device it is controlling the software written for embedded systems is often called
10
firmware, and is stored in read-only memory or Flash memory chips rather than a disk drive. It often runs with limited computer hardware resources: small or no keyboard, screen, and little memory. User Interfaces Embedded systems range from no user interface at all - dedicated only to one task - to full user interfaces similar to desktop operating systems in devices such as PDAs. A full graphical screen, with touch sensing or screen-edge buttons provides flexibility while minimizing space used the meaning of the buttons can change with the screen, and selection involves the natural behavior of pointing at what's desired. The rise of the World Wide Web has given embedded designers another quite different option providing a web page interface over a network connection. This avoids the cost of a sophisticated display, yet provides complex input and display capabilities when needed, on another computer. This is successful for remote, permanently installed equipment. In particular, routers take advantage of this ability.
3. POWER SUPPLY
Mobile Phone Controlled PC With Control Electronic Devices 11
The power supply unit is used to provide a constant 5V of DC supply from a 230V of AC supply. These 5V DC will acts as power to different standard circuits. It mainly uses 3 devices 1. Bridge wave rectifier 2. Voltage regulator
Figure 3.1: Block Diagram Of Power Supply BRIDGE WAVE RECTIFIER A rectifier is an electrical device that converts alternating current (AC) to direct current (DC), a process known as rectification. The term rectifier describes a diode that is being used to convert AC to DC. A bridge-wave rectifier converts the whole of the input waveform to one of constant polarity (positive or negative) at its output. Bridge-wave rectifier converts both polarities of the input waveform to DC (direct current), and is more efficient. However, in a circuit with a center tapped transformer (9-0-9) is used.
12
For single-phase AC, if the transformer is center-tapped, then two diodes back-toback(i.e. anodes-to-anode or cathode-to-cathode) can form a full-wave rectifier. Many windings are required on the transformer secondary to obtain the same output voltage. In this only two diodes are activated at a time i.e. D1 and D3 activate for positive cycle and D2 and D4 activates for negative half cycle. D2 and D4 convert negative cycle to positive cycle as it as negative supply and negative cycle as positive cycle at its output. VOLTAGE REGULATOR This is most common voltage regulator that is still used in embedded designs. LM7805 voltage regulator is a linear regulator. With proper heat sink these LM78xx types can handle even more than 1A current. They also have Thermal overload protection, Short circuit protection. This will connect at the output of rectifier to get constant Dc supply instead of ripple voltages. It mainly consists of 3 pins 1. Input voltage 2. Output voltage 3. Ground The capacitor C2 is used to get thee ripple voltage as input to regulator instead of full positive cycles.
Vr = I load/Xc
13
For some devices we require 12V/9V/4V Dc supply at that time we go for 7812/7809/7804 regulator instead of 7805 regulator. It also have same feature and pins has 7805 regulator except output is of 12V/9V/4V instead of 5V. The general circuit diagram for total power supply to any embedded device is as shown below.
General Description:
The P89V51RD2 are 80C51 microcontrollers with 16kB Flash and 1024 bytes of data RAM. A key feature of the P89V51RD2 is its X2 mode option. The design engineer can choose to run the application with the conventional 80C51 clock rate (12 clocks per
Mobile Phone Controlled PC With Control Electronic Devices 14
machine cycle) or select the X2 mode (6 clocks per machine cycle) to achieve twice the throughput at the same clock frequency. Another way to benefit from this feature is to keep the same performance by reducing the clock frequency by half, thus dramatically reducing the EMI. The Flash program memory supports both parallel programming and in serial InSystem Programming (ISP). Parallel programming mode offers gang-programming at high speed, reducing programming costs and time to market. ISP allows a device to be reprogrammed in the end product under software control. The capability to field/update the application firmware makes a wide range of applications possible. The P89V51RD2 is also In-Application Programmable (IAP), allowing the Flash program memory to be reconfigured even while the application is running.
Features
80C51 Central Processing Unit 5 V Operating voltage from 0 MHz to 40 MHz 16/32/64 kB of on-chip Flash user code memory with ISP and IAP Supports 12-clock SPI (Serial Peripheral Interface) and enhanced UART PCA (Programmable Counter Array) with PWM and Capture/Four 8-bit I/O ports with Programmable watchdog timer Eight interrupt sources with four priority levels Second DPTR register Low EMI mode (ALE inhibit) TTL- and CMOS-compatible logic levels Brown-out detection Low power modes Power-down mode with external interrupt wake-up Idle mode
15
Pin configuration:
16
17
PIN 18: PORT 1: (p1.0 to P1.7): Port 1 is an 8-bit bi-directional I/O port with internal pull-ups. The Port 1 pins are pulled high by the internal pull-ups when 1s are written to them and can be used as inputs in this state. As inputs, Port 1 pins that are externally pulled LOW will source current (IIL) because of the internal pull-ups. P1.5, P1.6, P1.7 have high current drive of 16 mA. Port 1 also receives the low-order address bytes during the external host mode programming and verification. P1.0: T2: External count input to Timer/Counter 2 or Clock-out from Timer/Counter 2 P1.1: T2EX: Timer/Counter 2 capture/reload trigger and direction control P1.2: ECI: External clock input. This signal is the external clock input for the PCA. P1.3: CEX0: Capture/compare external I/O for PCA Module 0. Each capture/compare module connects to a Port 1 pin for external I/O. When not used by the PCA, this pin can handle standard I/O. P1.4: SS: Slave port select input for SPI. CEX1: Capture/compare external I/O for PCA Module 1 P1.5: MOSI: Master Output Slave Input for SPI CEX2: Capture/compare external I/O for PCA Module 2 P1.6: MISO: Master Input Slave Output for SPI CEX3: Capture/compare external I/O for PCA Module 3 P1.7: SCK: Master Output Slave Input for SPI CEX4: Capture/compare external I/O for PCA Module 4 PIN 9: RESET SIGNAL: High logical state on this input halts the MCU and clears all the registers. Bringing this pin back to logical state zero starts the program a new as if the power had just been turned on. In another words, positive voltage impulse on this pin resets the MCU. Depending on the device's purpose and environs, this pin is usually connected to the push-button, reset-upon-start circuit or a brown out reset circuit (covered in the previous chapter). The image shows one simple circuit for safe reset upon starting the controller. It is utilized in situations when power fails to reach its optimal voltage.
Mobile Phone Controlled PC With Control Electronic Devices 18
Figure 4.3: Reset Switch PIN 10-17: Port 3: Port 3 is an 8-bit bidirectional I/O port with internal pull-ups. Port 3 pins are pulled HIGH by the internal pull-ups when 1s are written to them and can be used as inputs in this state. As inputs, Port 3 pins that are externally pulled LOW will source current (IIL) because of the internal pull-ups. Port3 also receives some control signals and a partial of high-order address bits during the external host mode programming and verification. P3.0: RXD: serial input port P3.1: TXD: serial output port P3.2: INT0: external interrupt 0 input P3.3: INT1: external interrupt 1 input P3.4: T0: external count input to Timer/Counter 0 P3.5: T1: external count input to Timer/Counter 1 P3.6: WR: external data memory write strobe P3.7: RD: external data memory read strobe PIN 18: XTAL2: Crystal 2: Output from the inverting oscillator amplifier.
19
PIN 19: XTAL1: Crystal 1: Input to the inverting oscillator amplifier and input to the internal clock generator circuits.
PIN 20 : Ground PIN 21-28: ( P2.0 toP2.7): Port 2: Port 2 is an 8-bit bi-directional I/O port with internal pull-ups. Port 2 pins are pulled HIGH by the internal pull-ups when 1s are written to them and can be used as inputs in this state. As inputs, Port 2 pins that are externally pulled LOW will source current (IIL) because of the internal pull-ups. Port 2 sends the high-order address byte during fetches from external program memory and during accesses to external Data Memory that use 16-bit address (MOVX@DPTR). In this application, it uses strong internal pull-ups when transitioning to 1s. Port 2 also receives some control signals and a partial of high-order address bits during the external host mode programming and verification. PIN 29: Program Store Enable: PSEN is the read strobe for external program memory. When the device is executing from internal program memory, PSEN is inactive (HIGH). When the device 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. A forced HIGH-to-LOW input transition on the PSEN pin while the RST input is continually held HIGH for more than 10 machine cycles will cause the device to enter external host mode programming. PIN 30: Address Latch Enable: ALE is the output signal for latching the low byte of the address during an access to external memory. This pin is also the programming pulse input
Mobile Phone Controlled PC With Control Electronic Devices 20
(PROG) for flash programming. Normally the ALE[1] is emitted at a constant rate of 16 the crystal frequency[2] and can be used for external timing and clocking. One ALE pulse is skipped during each access to external data memory. However, if AO is set to 1, ALE is disabled. PIN 31: External Access Enable: EA must be connected to VSS in order to enable the device to fetch code from the external program memory. EA must be strapped to VDD for internal program execution. However, Security lock level 4 will disable EA, and program execution is only possible from internal program memory. The EA pin can tolerate a high voltage of 12 V. PIN 32 TO 39: P0.0 P0.7: Port 0: Port 0 is an 8-bit open drain bi-directional I/O port. Port 0 pins that have 1s written to them float, and in this state can be used as highimpedance inputs. Port 0 is also the multiplexed low-order address and data bus during accesses to external code and data memory. In this application, it uses strong internal pullups when transitioning to 1s. Port 0 also receives the code bytes during the external host mode programming, and outputs the code bytes during the external host mode verification. External pull-ups are required during program verification or as a general purpose I/O port. PIN 40: VDD: Power supply Special function registers Remark: Special Function Registers (SFRs) accesses are restricted in the following ways: User must not attempt to access any SFR locations not defined. Accesses to any defined SFR locations must be strictly for the functions for the SFRs. SFR bits labeled -, 0 or 1 can only be written and read as follows: - Unless otherwise specified, must be written with 0, but can return any value
Mobile Phone Controlled PC With Control Electronic Devices 21
when read (even if it was written with 0). It is a reserved bit and may be used in future derivatives. 0 must be written with 0, and will return a 0 when read. 1 must be written with 1, and will return a 1 when read.
22
A software reset is used to accomplish this control transfer and as a result the SWR bit will remain set. Therefore the user's code will need to clear the SWR bit in order to access the IAP routines in Block However, caution must be taken when dynamically changing the BSEL bit. Since this will cause different physical memory to be mapped to the logical program address space, the user must avoid clearing the BSEL bit when executing user code within the address range 0000H to 1FFFH.
SWR (FCF.1)
BSEL (FCF.0)
23
Power-on reset code execution At initial power up, the port pins will be in a random state until the oscillator has started and the internal reset algorithm has weakly pulled all pins high. Powering up the device without a valid reset could cause the MCU to start executing instructions from an indeterminate location. Such undefined states may inadvertently corrupt the code in the flash. A system reset will not affect the 1 kB of on-chip RAM while the device is running, however, the contents of the on-chip RAM during power up are indeterminate. When power is applied to the device, the RST pin must be held high long enough for the oscillator to start up (usually several milliseconds for a low frequency crystal), in addition to two machine cycles for a valid power-on reset. An example of a method to extend the RST signal is to implement a RC circuit by connecting the RST pin to VDD through a 10 F capacitor and to VSS through an 8.2KW resistor as shown in the above table. Note that if an RC circuit is being used, provisions should be made to ensure the VDD rise time does not exceed 1 millisecond and the oscillator start-up time does not exceed 10 milliseconds. For a low frequency oscillator with slow start-up time the reset signal must be extended in order to account for the slow start-up time. This method maintains the necessary relationship between VDD and RST to avoid programming at an indeterminate location, which may cause corruption in the code of the flash. The power-on detection is designed to work during initial power up, before the voltage reaches the brown-out detection level. The POF flag in the PCON register is set to indicate an initial power up condition. The POF flag will remain active until cleared by software. Following a power-on or external reset the P89V51RB2/RC2/RD2 will force the SWR and BSEL bits (FCF[1:0]) = 00. This causes the bootblock to be mapped into the lower 8 kB of code memory and the device will execute the ISP code in the boot block and attempt to autobaud to the host. If the autobaud is successful the device will remain in ISP mode. If, after approximately 400 ms, the autobaud is unsuccessful the boot block code will check to see if the SoftICE flag is set (from a previous programming operation). If the
Mobile Phone Controlled PC With Control Electronic Devices 24
SoftICE flag is set the device will enter SoftICE mode. If the SoftICE flag is cleared, the bootcode will execute a software reset causing the device to execute the user code from block 0 starting at address 0000h. Note that an external reset applied to the RST pin has the same effect as a power-on reset.
Software reset
A software reset is executed by changing the SWR bit (FCF.1) from 0 to 1. A software reset will reset the program counter to address 0000H and force both the SWR and BSEL bits (FCF[1:0]) =10. This will result in the lower 8 kB of the user code memory being mapped into the user code memory space. Thus the user's code will be executed starting at address 0000h. A software reset will not change WDTC.2 or RAM data. Other SFRs will be set to their reset values.
25
26
The device has four sections of internal data memory: 1. The lower 128 bytes of RAM (00H to 7FH) are directly and indirectly addressable. 2. The higher 128 bytes of RAM (80H to FFH) are indirectly addressable. 3. The special function registers (80H to FFH) are directly addressable only. 4. The expanded RAM of 768 bytes (00H to 2FFH) is indirectly addressable by the move external instruction (MOVX) and clearing the EXTRAM bit. Since the upper 128 bytes occupy the same addresses as the SFRs, the RAM must be accessed indirectly. The RAM and SFRs space are physically separate even though they have the same addresses. When instructions access addresses in the upper 128 bytes (above 7FH), the MCU determines whether to access the SFRs or RAM by the type of instruction given. If it is indirect, then RAM is accessed. If it is direct, then an SFR is accessed. See the examples below. Indirect Access: MOV@R0, #data; R0 contains 90H Register R0 points to 90H which is located in the upper address range. Data in#data is written to RAM location 90H rather than port 1.
Direct Access: MOV90H, #data; write data to P1 Data in #data is written to port 1. Instructions that write directly to the address write to the SFRs. To access the expanded RAM, the EXTRAM bit must be cleared and MOVX instructions must be used. The extra 768 bytes of memory is physically located on the chip and logically occupies the first 768 bytes of external memory (addresses 000H to 2FFH).
Mobile Phone Controlled PC With Control Electronic Devices 27
When EXTRAM = 0, the expanded RAM is indirectly addressed using the MOVX instruction in combination with any of the registers R0, R1 of the selected bank or DPTR. Accessing the expanded RAM does not affect ports P0, P3.6 (WR), P3.7 (RD), or P2. With EXTRAM = 0, the expanded RAM can be accessed as in the following example. Expanded RAM Access (Indirect Addressing only): MOVX@DPTR, A DPTR contains 0A0H DPTR points to 0A0H and data in A is written to address 0A0H of the expanded RAM rather than external memory. Access to external memory higher than 2FFH using the MOVX instruction will access external memory (0300H to FFFFH) and will perform in the same way as the standard 8051, with P0 and P2 as data/address bus, and P3.6 and P3.7 as write and read timing signals. When EXTRAM = 1, MOVX @Ri and MOVX @DPTR will be similar to the standard 8051. Using MOVX @Ri provides an 8-bit address with multiplexed data on Port 0. Other output port pins can be used to output higher order address bits. This provides external paging capabilities. Using MOVX @DPTR generates a 16-bit address. This allows external addressing up the 64 kB. Port 2 provides the high-order eight address bits (DPH), and Port 0 multiplexes the low order eight address bits (DPL) with data. Both MOVX @Ri and MOVX @DPTR generates the necessary read and write signals (P3.6 - WR and P3.7 - RD) for external memory use. Table 9 shows external data memory RD, WR operation with EXTRAM bit. The stack pointer (SP) can be located anywhere within the 256 bytes of internal RAM (lower 128 bytes and upper 128 bytes). The stack pointer may not be located in any part of the expanded RAM.
28
29
erasing or programming of the Flash memory that may be used. First, the Flash may be programmed or erased in the end-user application by calling low-level routines through a common entry point (IAP). Second, the on-chip ISP boot loader may be invoked. This ISP boot loader will, in turn, call low-level routines through the same common entry point that can be used by the end-user application. Third, the Flash may be programmed or erased using the parallel method by using a commercially available EPROM programmer which supports this device.
In-System Programming (ISP) In-System Programming is performed without removing the microcontroller from the system. The In-System Programming facility consists of a series of internal hardware resources coupled with internal firmware to facilitate remote programming of the P89V51RB2/RC2/RD2 through the serial port. This firmware is provided by Philips and embedded within each P89V51RB2/RC2/RD2 device. The Philips In-System Programming facility has made in-circuit programming in an embedded application possible with a minimum of additional expense in components and circuit board area. The ISP function uses five pins (VDD, VSS, TxD, RxD, and RST). Only a small connector needs to be available to interface your application to an external circuit in order to use this feature.
Using the In-System Programming The ISP feature allows for a wide range of baud rates to be used in your application, independent of the oscillator frequency. It is also adaptable to a wide range of oscillator frequencies. This is accomplished by measuring the bit-time of a single bit in a received character. This information is then used to program the baud rate in terms of timer counts based on the oscillator frequency. The ISP feature requires that an initial character (an
30
uppercase U) be sent to the P89V51RB2/RC2/RD2 to establish the baud rate. The ISP firmware provides auto-echo of received characters. The P89V51RB2/RC2/RD2 will accept up to 32 data bytes. The AAAA string represents the address of the first byte in the record. If there are zero bytes in the record, this field is often set to 0000. The RR string indicates the record type. A record type of 00 is a data record. A record type of 01 indicates the end-of-file mark. In this application, additional record types will be added to indicate either commands or data for the ISP facility. The maximum number of data bytes in a record is limited to 32 (decimal). ISP commands are summarized in Table given below.. As a record is received by the P89V51RB2/RC2/RD2, the information in the record is stored internally and a checksum calculation is performed. The operation indicated by the record type is not performed until the entire record has been received. Should an error occur in the checksum, the P89V51RB2/RC2/RD2 will send an X out the serial port indicating a checksum error. If the checksum calculation is found to match the checksum in the record, then the command will be executed. In most cases, successful reception of the record will be indicated by transmitting a . character out the serial port.
Using the serial number This device has the option of storing a 31-byte serial number along with the length of the serial number (for a total of 32 bytes) in a non-volatile memory space. When ISP mode is entered, the serial number length is evaluated to determine if the serial number is in use. If the length of the serial number is programmed to either 00H or FFH, the serial number is considered not in use. If the serial number is in use, reading, programming, or erasing of the user code memory or the serial number is blocked until the user transmits a verify serial number record containing a serial number and length that matches the serial number and length previously stored in the device. The user can reset the serial number to
31
all zeros and set the length to zero by sending the reset serial number' record. In addition, the reset serial number record will also erase all user code.
Mode 0 Serial data enters and exits through RxD and TxD outputs the shift clock. Only 8 bits are transmitted or received, LSB first. The baud rate is fixed at 6 of the CPU clock frequency. UART configured to operate in this mode outputs serial clock on TxD line no matter whether it sends or receives data on RxD line. Mode 1 10 bits are transmitted (through TxD) or received (through RxD): a start bit (logical 0), 8 data bits (LSB first), and a stop bit (logical 1). When data is received, the stop bit is stored in RB8 in Special Function Register SCON. The baud rate is variable and is determined by the Timer 1/2 overflow rate. Mode 2 11 bits are transmitted (through TxD) or received (through RxD): start bit (logical 0), 8 data bits (LSB first), a programmable 9th data bit, and a stop bit (logical 1). When data is transmitted, the 9th data bit (TB8 in SCON) can be assigned the value of 0 or (e.g. the parity bit (P, in the PSW) could be moved into TB8). When data is received, the 9th data bit goes into RB8 in Special Function Register SCON, while the stop bit is ignored. The baud rate is programmable to either 116 or 132 of the CPU clock frequency, as determined by the SMOD1 bit in PCON. Mode 3 11 bits are transmitted (through TxD) or received (through RxD): a start bit (logical 0), 8 data bits (LSB first), a programmable 9th data bit, and a stop bit (logical 1). In fact,
32
Mode 3 is the same as Mode 2 in all respects except baud rate. The baud rate in Mode 3 is variable and is determined by the Timer 12 overflow rate. UARTs The UART operates in all standard modes. Enhancements over the standard 80C51 UART include Framing Error detection, and automatic address recognition.
The microcontroller consists of eight bit Arithmetic Logic Unit (ALU). Associated Register Array means registers like register A, register B, PSW (program status word), SP (stack pointer), and a 16-bit PC (program counter) and a 16-bit DPTR (data pointer) register, 8-bit four PORT registers, Two 8-bit timer registers TCON and TMOD, Two serial communication 8-bit registers SCON and SBUF, power mode register PCON, and two interrupt registers IP and IE.
ADDR. (HEX.)
80 81 P0 SP DPTR 82 83 87 88 89 8A 8B 8C DPL DPH PCON TCON TMOD TL0 TL1 TH0
MARK
PORT 0
FULL NAME
STACK POINTER DATA POINTER DATA LOW POINTER DATA HIGH POINTER POWER CONTROL TIMER/COUNTER CONTROL TIMER/COUNTER MODE CONTROL TIMER/COUNTER0 LOW BYTE TIMER/COUNTER1 LOW BYTE TIMER/COUNTER0 HIGH BYTE
33
8D 90 98 99 A0 A8 B0 B8 D0 E0 F0
TIMER/COUNTER1 HIGH BYTE PORT 1 SERIAL PORT CONTROL SERIAL DATA PORT PORT 2 INTERRUPT ENABLE PORT 3 INTERRUPT PRIORITY CONTROL PROGRAM STATUS WORD ACCUMULATOR B REGISTER
ACCUMULATOR
The Accumulator, as its name suggests, is used as a general register to accumulate the results of a large number of instructions. It can hold an 8-bit (1-byte) value and is the most versatile register, the microcontroller has due to the shear number of instructions that make use of the accumulator. Accumulator holds a source of operand and stores the result of the arithmetic operations such as addition, subtraction, multiplication and division. The accumulator has several exclusive functions such as rotate, parity computation; testing for 0, sign acceptor etc. and so on.
DPL/DPH (Data Pointer Low/High, Addresses 82h/83h) The SFRs DPL and DPH work together to represent a 16-bit value called the Data Pointer. The data pointer is used in operations regarding external RAM and some
34
instructions involving code memory. Since it is an unsigned two-byte integer value, it can represent values from 0000h to FFFFh (0 through 65,535 decimal).
SCON (Serial Control, Addresses 98h, Bit-Addressable) The Serial Control SFR is used to configure the behavior of the 8051's on-board serial port. This SFR controls the baud rate of the serial port, whether the serial port is activated to receive data, and also contains flags that are set when a byte is successfully sent or received. Bit addressable.
REN TB 8 RB 8
set or cleared by software to enable or disable reception. not widely used. not widely used.
TI transmits interrupt flag. Set by hardware at the beginning of the stop bit in mode 1. It must be cleared by software. RI received interrupts flag. Set by hardware halfway through the stop bit time in mode 1. It must be cleared by software. SM0 0 0 SM1 0 1 Serial mode 0 Synchronous mode 8-bit data, 1 start bit, 1 stop bit, variable baud rate 1 0 9- bit data, 1 start bit, 1 stop bit, fixed baud rate
Mobile Phone Controlled PC With Control Electronic Devices 35
9- bit data, 1 start bit, 1 stop bit, variable baud rate Table 4.3: Modes of SCON
SBUF (Serial Control, Addresses 99h) The Serial Buffer SFR is used to send and receive data via the on-board serial port. Any value written to SBUF will be sent out the serial port's TXD pin. Likewise, any value which the 8051 receives via the serial port's RXD pin will be delivered to the user program via SBUF. In other words, SBUF serves as the output port when written to and as an input port when read from.
TCON (Timer Control, Addresses 88h, Bit-Addressable) The Timer Control SFR is used to configure and modify the way in which the 8051's two timers operate. This SFR controls whether each of the two timers is running or stopped and contains a flag to indicate that each timer has overflowed. Additionally, some non-timer related bits are located in the TCON SFR. These bits are used to configure the way in which the external interrupts are activated and also contain the external interrupt flags which are set when an external interrupt has occurred.
TMOD (Timer Mode, Addresses 89h) The Timer Mode SFR is used to configure the mode of operation of each of the two timers. Using this SFR your program may configure each timer to be a 16-bit timer, an 8-bit auto reload timer, a 13-bit timer, or two separate timers. Additionally, you may configure the timers to only count when an external pin is activated or to count "events" that are indicated on an external pin.
36
TIMER 0 AND TIMER 1 The "timer or "counter "function is selected by control bits C/T in the special function register TMOD. These two timer/counters have for operating modes, which are selected by bit-pairs (M1/M0) in TMOD. Modes 0, 1, and 2 are the same for both timers/counters. Mode 3 is different.
TL0/TH0 (Timer 0 Low/High, Addresses 8Ah/8Ch) These two SFRs, taken together, represent timer 0. Their exact behavior depends on how the timer is configured in the TMOD SFR; however, these timers always count up. What is configurable is how and when they increment in value.
GATE:
When set, start and stop of timer by hardware When reset, start and stop of timer by software
C/T :
M1
M0
MODE
OPERATING MODE
37
0 1
1 0
1 2
These two SFRs, taken together, represent timer 1. Their exact behavior depends on how the timer is configured in the TMOD SFR; however, these timers always count up. What is configurable is how and when they increment in value. Address =88H.
Bit addressable.
TF:Timer overflow flag: Set by hardware when the timer/counter overflows. It is cleared by hardware, as the processor vectors to the interrupt service routine. TR: timer run control bit: Set or cleared by software to turn timer or counter on/off.
IE: set by CPU when the external interrupt edge (H-to-L transition) is detected. It is cleared by CPU when the interrupt is processed. IT: set/cleared by software to specify falling edge/low-level triggered external interrupt.
controllers, there is no specific SFR register for designating pins as input or output. Instead, the port itself is in charge: 0=output, 1=input. If particular pin on the case is needed as output, the appropriate bit of I/O port should be cleared. This will generate 0V on the specified controller pin. Similarly, if particular pin on the case is needed as input, the appropriate bit of I/O port should be set. This will designate the pin as input, generating +5V as a side effect (as with every TTL input). PORT 0 Port 0 has two-fold role: if external memory is used, it contains the lower address byte (addresses A0-A7); otherwise all bits of the port are either input or output. Another feature of this port comes to play when it has been designated as output. Unlike other ports, Port 0 lacks the "pull up" resistor (resistor with +5V on one end). This seemingly insignificant change has the following consequences: When designated as input, pin of Port 0 acts as high impedance offering the infinite input resistance with no "inner" voltage. When designated as output, pin acts as "open drain". Clearing a port bit grounds the appropriate pin on the case (0V). Setting a port bit makes the pin act as high impedance. Therefore, to get positive logic (5V) at output, external "pull up" resistor needs to be added for connecting the pin to the positive pole. Therefore, to get one (5V) on the output, external "pull up" resistor needs to be added for connecting the pin to the positive pole.
PORT 1
This is "true" I/O port, devoid of dual function characteristic for Port 0. Having the "pull up" resistor, Port 1 is fully compatible with TTL circuits. This is input/output port 1. Each bit of this SFR corresponds to one of the pins on the microcontroller. For example, bit 0 of port 1 is pin P1.0, bit 7 is pin P1.7. Writing a value of 1 to a bit of this SFR will send a high level on the corresponding I/O pin whereas a value of 0 will bring it to a low level.
PORT 2
39
When external memory is used, this port contains the higher address byte (addresses A8 A15), similar to Port 0. Otherwise, it can be used as universal I/O port. This is input/output port 2. Each bit of this SFR corresponds to one of the pins on the microcontroller. For example, bit 0 of port 2 is pin P2.0, bit 7 is pin P2.7. Writing a value of 1 to a bit of this SFR will send a high level on the corresponding I/O pin whereas a value of 0 will bring it to a low level.
PORT 3 Beside its role as universal I/O port, each pin of Port 3 has an alternate function. In order to use one of these functions, the pin in question has to be designated as input, i.e. the appropriate bit of register P3 needs to be set. From a hardware standpoint, Port 3 is similar to Port 0.
40
5. SERIAL COMMUNICATION
In order to connect micro controller or a PC to any modem a serial port is used. Serial, is a very common protocol for device communication that is standard on almost every PC .Most computers including RS-232 based serial ports. Serial is also a common communication protocol that is used by many devices for instrumentation. In serial communication, the data is sent one bit at a time in contrast parallel communication, in which the data is sent a byte or more at time. Serial communication uses a single data line where as the parallel communication uses 8 bit data line , this makes serial communication not only inexpensive but also makes it possible for two computers located in two different cities to communicate over the telephone. Serial data communication uses two methods, asynchronous and synchronous. the synchronous method transfers a block of data at a time while the asynchronous transfers a single byte at a time. The 8051 have an in built UART (Universal Asynchronous Receiver-Transmitter). Typically, serial is used to transmit ASCII data. Communication is completed using 3 transmission lines: (1) Transmitter, (2) Receiver and (3) Ground. Since serial is asynchronous, the port is able to transmit data on one line while receiving data on another. Other lines are available for handshaking, but are not required. The important characteristics are Data Transfer Rate, Start and Stop bits, Data bits and Parity bits. For two ports to communicate, these parameters must match.
Space Stop Bit
0
D7
0 0
0 1
Start Bit D0
41
Data Transfer Rate The rate of data transfer in serial data communication is stated in bps (bits per second) or baud rate. However the baud rate and bps are not necessarily equal. Baud rate is defined as the number of signal changes per second. In modems, there are occasions when a single change of signal transfers several bits of data .As far as conductor wire is considered bps and baud rate is the same.
Data Framing Asynchronous serial data communication is used for character oriented transmissions, each character is placed in between start and stop bits. This is called framing .In data framing for asynchronous communications , the data ,such as ASCII characters ,are packed in between a start bit and a stop bit .The start bit is always one bit but the stop bit can be one or more bits .The start bit is always 0(low) whereas stop bit is 1(high).Since the data is clocked across the lines and each device has its own clock , it is possible for the two devices to come out slightly out of synchronous .Therefore ,the stop bits not only indicate the end of transmission but also give the computers some room for error in clock speeds .The more the stop bits the greater the lenience in synchronizing the different clocks, but slower the data transmission rate.
Parity Bits In order to maintain data integrity, parity bit of the character byte is included in the data frame .The parity bit is odd or even .In the case of an odd parity bit the number of data bits, including the parity bits has an odd number of 1s.Similarly, in an even parity bit system the total number of bits, including the parity bits has an even number of 1s.UART chips allow programming of the parity bit for odd-, even- and no- parity options.
42
43
The output signal level usually swings between +12V and -12V. The dead area between +3v and -3v is designed to absorb line noise. In the various RS-232-like definitions this dead area may vary. This can cause problems when using pin powered widgets - line drivers, converters, modems etc. These types of units need enough voltage & current to power them selfs up. Typical URART (the RS-232 I/O chip) allows up to 50ma per output pin so if the device needs 70ma to run we would need to use at least 2 pins for power. The number of output lines, the type of interface driver IC, and the state of the output lines are important considerations. The types of driver ICs used in serial ports can be divided into three general categories:
Drivers which require plus (+) and minus (-) voltage power supplies such as the 1488 series of interface integrated circuits. (Most desktop and tower PCs use this type of driver.) Low power drivers which require one +5 volt power supply. This type of driver has an internal charge pump for voltage conversion. (Many industrial microprocessor controls use this type of driver.) Low voltage (3.3 v) and low power drivers which meet the EIA-562 Standard. (Used on notebooks and laptops.)
Data is transmitted and received on pins 2 and 3 respectively. Data Set Ready (DSR) is an indication from the Data Set (i.e., the modem or DSU/CSU) that it is on. Similarly, DTR indicates to the Data Set that the DTE is on. Data Carrier Detect (DCD) indicates that a good carrier is being received from the remote modem. Pins 4 RTS (Request to Send - from the transmitting computer) and 5 CTS (Clear to Send - from the Data set) are used to control. In most Asynchronous situations, RTS and CTS are constantly on throughout the communication session. However where the DTE is connected to a multipoint line. RTS is used to turn carrier on the modem on and
Mobile Phone Controlled PC With Control Electronic Devices 44
off. On a multipoint line, its imperative that only one station is transmitting at a time (because they share the return phone pair). When a station wants to transmit, it raises RTS. The modem turns on carrier, typically waits a few milliseconds for carrier to stabilize, and then raises CTS. The DTE transmits when it sees CTS up. When the station has finished its transmission, it drops RTS and the modem drops CTS and carrier together.
Clock signals (pins 15, 17, & 24) are only used for synchronous communications. The modem or DSU extracts the clock from the data stream and provides a steady clock signal to the DTE. The transmit and receive clock signals do not have to be the same, or even at the same baud rate. To allow compatibility among data communication equipment made by various Manufacturers, an interfacing standard called RS232 was set by the Electronics. Industries Association in 1960.Today, RS232 is the most widely used serial I/O interfacing standard. RS232 standard is not TTL compatible; therefore it requires a line driver such as MAX232chip to convert RS232 voltage levels to TTL levels and vice versa. One advantage of the MAX 232 chip is that it uses +5V power source that has same source voltage as that of 8051.
System
Max 232
TTL L O G
TTL Logic
RS232 Logic
Level Converter
45
13
14
RS232P (DB25)
25
RS232 PINS Pin - Description 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. Protective ground Transmitted data (TxD) Received data (RxD) Request to send (RTS) Clear to send (CTS) Data set ready (DSR) Signal ground (GND) Data carrier detect (DCD) Reserved for data setting Reserved for data setting Unassigned Secondary data carrier Secondary clear send Secondary transmitted data Transmit signal element timing
46
16. 17. 18. 19. 20. 21. 22. 23. 24. 25.
Secondary received data Receive signal element timing Unassigned Secondary request to send Data terminal ready (DTR) Signal quality detector Ring indicator Data signal rate select Transmit signal element timing Unassigned
47
48
49
6. 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. It was invented by Joseph Henry in 1835. Because a relay is able to control an output circuit of higher power than the input circuit, it can be considered to be, in a broad sense, a form of an electrical amplifier.
Fig 6.2: Internal structure of a Relay A simple electromagnetic relay, such as the one taken from a car in the first picture, is an adaptation of an electromagnet. It consists of a coil of wire surrounding a soft iron core, an iron yoke, which provides a low reluctance path for magnetic flux, a moveable iron armature, and a set, or sets, of contacts; two in the relay pictured. The
Mobile Phone Controlled PC With Control Electronic Devices 50
armature is hinged to the yoke and mechanically linked to a moving contact or contacts. It is held in place by a spring so that when the relay is de-energised there is an air gap in the magnetic circuit. In this condition, one of the two sets of contacts in the relay pictured is closed, and the other set is open. Other relays may have more or fewer sets of contacts depending on their function. The relay in the picture also has a wire connecting the armature to the yoke. This ensures continuity of the circuit between the moving contacts on the armature, and the circuit track on the Printed Circuit Board (PCB) via the yoke, which is soldered to the PCB. When an electric current is passed through the coil, the resulting magnetic field attracts the armature, and the consequent movement of the movable contact or contacts either makes or breaks a connection with a fixed contact. If the set of contacts was closed when the relay was de-energised, then the movement opens the contacts and breaks the connection, and vice versa if the contacts were open. When the current to the coil is switched off, the armature is returned by a force, approximately half as strong as the magnetic force, to its relaxed position. Usually this force is provided by a spring, but gravity is also used commonly in industrial motor starters. Most relays are manufactured to operate quickly. In a low voltage application, this 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 voltage spike dangerous 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. By analogy with the functions of the original electromagnetic device, a solid-state relay is made with a thyristor or other solid-state switching device. To achieve electrical
51
isolation an optocoupler can be used which is a light-emitting diode (LED) coupled with a photo transistor.
TYPES OF RELAYS
LATCHING RELAY:
Latching relay, dust cover removed, showing pawl and ratchet mechanism. The ratchet operates a cam, which raises and lowers the moving contact arm, seen edge-on just below it. The moving and fixed contacts are visible at the left side of the image. A latching relay has two relaxed states (bistable). These are also called "impulse", "keep" or "stay" relays. When the current is switched off, the relay remains in its last state. This is achieved with a solenoid operating a ratchet and cam mechanism, or by having two opposing coils with an over-center spring or permanent magnet to hold the armature and contacts in position while the coil is relaxed, or with a remanent core. In the ratchet and cam example, the first pulse to the coil turns the relay on and the second pulse turns it off. In the two coil example, a pulse to one coil turns the relay on and a pulse to the opposite coil turns the relay off. This type of relay has the advantage that it consumes power only for an instant, while it is being switched, and it retains its last setting across a power
Mobile Phone Controlled PC With Control Electronic Devices 52
outage. A remanent core latching relay requires a current pulse of opposite polarity to make it change state. Reed relay A reed relay has a set of contacts inside a vacuum or inert gas filled glass tube, which protects the contacts against atmospheric corrosion. The contacts are closed by a magnetic field generated when current passes through a coil around the glass tube. Reed relays are capable of faster switching speeds than larger types of relays, but have low switch current and voltage ratings. See also reed switch. Mercury-wetted relay A mercury-wetted reed relay is a form of reed relay in which the contacts are wetted with mercury. Such relays are used to switch low-voltage signals (one volt or less) because of their low contact resistance, or for high-speed counting and timing applications where the mercury eliminates contact bounce. Mercury wetted relays are positionsensitive and must be mounted vertically to work properly. Because of the toxicity and expense of liquid mercury, these relays are rarely specified for new equipment. See also mercury switch. Polarized relay A Polarized Relay placed the armature between the poles of a permanent magnet to increase sensitivity. Polarized relays were used in middle 20th Century telephone exchanges to detect faint pulses and correct telegraphic distortion. The poles were on screws, so a technician could first adjust them for maximum sensitivity and then apply a bias spring to set the critical current that would operate the relay. Machine tool relay A machine tool relay is a type standardized for industrial control of machine tools, transfer machines, and other sequential control. They are characterized by a large number of contacts (sometimes extendable in the field) which are easily converted from normallyMobile Phone Controlled PC With Control Electronic Devices 53
open to normally-closed status, easily replaceable coils, and a form factor that allows compactly installing many relays in a control panel. Although such relays once were the backbone of automation in such industries as automobile assembly, the programmable logic controller (PLC) mostly displaced the machine tool relay from sequential control applications. Contactor relay A contactor is a very heavy-duty relay used for switching electric motors and lighting loads. High-current contacts are made with alloys containing silver. The unavoidable arcing causes the contacts to oxidize and silver oxide is still a good conductor. Such devices are often used for motor starters. A motor starter is a contactor with overload protection devices attached. The overload sensing devices are a form of heat operated relay where a coil heats a bi-metal strip, or where a solder pot melts, releasing a spring to operate auxiliary contacts. These auxiliary contacts are in series with the coil. If the overload senses excess current in the load, the coil is de-energized. Contactor relays can be extremely loud to operate, making them unfit for use where noise is a chief concern. Solid-state relay
54
Fig 6.5: 25 A or 40 A solid state contactors A solid state relay (SSR) is a solid state electronic component that provides a similar function to an electromechanical relay but does not have any moving components, increasing long-term reliability. With early SSR's, the tradeoff came from the fact that every transistor has a small voltage drop across it. This voltage drop limited the amount of current a given SSR could handle. As transistors improved, higher current SSR's, able to handle 100 to 1,200 Amperes, have become commercially available. Compared to electromagnetic relays, they may be falsely triggered by transients. Solid state contactor relay A solid state contactor is a very heavy-duty solid state relay, including the necessary heat sink, used for switching electric heaters, small electric motors and lighting loads; where frequent on/off cycles are required. There are no moving parts to wear out and there is no contact bounce due to vibration. They are activated by AC control signals or DC control signals from Programmable logic controller (PLCs), PCs, Transistortransistor logic (TTL) sources, or other microprocessor and microcontroller controls.
55
7. GSM MODEM(SIM300S)
GSM (Global System for Mobile Communications originally from Groupe Spcial Mobile) is the most popular standard for mobile telephone systems in the world. The GSM Association, its promoting industry trade organization of mobile phone carriers and manufactures, estimates that 80% of the global mobile market uses the standard. GSM is used by over 3 billion people across more than 212 countries and territories. Its ubiquity enables international roaming arrangements between mobile phone operators, providing subscribers the use of their phones in many parts of the world. GSM differs from its predecessor technologies in that both signaling and speech channels are digital, and thus GSM is considered a second generation (2G) mobile phone system. This also facilitates the wide-spread implementation of data communication applications into the system. Enhanced Data Rates for GSM Evolution (GSM EDGE) is a 3G version of the protocol. The ubiquity of implementation of the GSM standard has been an advantage to both consumers, who may benefit from the ability to roam and switch carriers without replacing phones, and also to network operators, who can choose equipment from many GSM equipment vendors. GSM also pioneered low-cost implementation of the short message service (SMS), also called text messaging, which has since been supported on other mobile phone standards as well. The standard includes a worldwide emergency telephone number feature (112). ` Newer versions of the standard were backward-compatible with the original GSM
system. For example, Release '97 of the standard added packet data capabilities by means of General Packet Radio Service (GPRS). Release '99 introduced higher speed data transmission using Enhanced Data Rates for GSM Evolution (EDGE).
HISTORY
In 1982, the European Conference of Postal and Telecommunications Administrations (CEPT) created the Groupe Spcial Mobile (GSM) to develop a standard for a mobile telephone system that could be used across Europe. In 1987, a memorandum of understanding was signed by 13 countries to develop a common cellular telephone
Mobile Phone Controlled PC With Control Electronic Devices 56
system across Europe. Finally the system created by SINTEF led by Torleiv Maseng was selected. In 1989, GSM responsibility was transferred to the European Telecommunications Standards Institute (ETSI) and phase I of the GSM specifications were published in 1990. The first GSM network was launched in 1991 by Radiolinja in Finland with joint technical infrastructure maintenance from Ericsson. By the end of 1993, over a million subscribers were using GSM phone networks being operated by 70 carriers across 48 countries.
TECHNICAL DETAILS
Cellular radio network: GSM is a cellular network, which means that mobile phones connect to it by searching for cells in the immediate vicinity. There are five different cell sizes in a GSM networkmacro, micro, pico, femto and umbrella cells. The coverage area of each cell varies according to the implementation environment. Macro cells can be regarded as cells where the base station antenna is installed on a mast or a building above average roof top level. Micro cells are cells whose antenna height is under average roof top level; they are typically used in urban areas. Picocells are small cells whose coverage diameter is a few dozen meters; they are mainly used indoors. Femtocells are cells designed for use in residential or small business environments and connect to the service providers network via a broadband internet connection. Umbrella cells are used to cover shadowed regions of smaller cells and fill in gaps in coverage between those cells. Cell horizontal radius varies depending on antenna height, antenna gain and propagation conditions from a couple of hundred meters to several tens of kilometers. The longest distance the GSM specification supports in practical use is 35 kilometers (22 mi). There are also several implementations of the concept of an extended cell, where the cell radius could be double or even more, depending on the antenna system, the type of terrain and the timing advance.
57
Indoor coverage is also supported by GSM and may be achieved by using an indoor picocell base station, or an indoor repeater with distributed indoor antennas fed through power splitters, to deliver the radio signals from an antenna outdoors to the separate indoor distributed antenna system. These are typically deployed when a lot of call capacity is needed indoors; for example, in shopping centers or airports. However, this is not a prerequisite, since indoor coverage is also provided by in-building penetration of the radio signals from any nearby cell. The modulation used in GSM is Gaussian minimum-shift keying (GMSK), a kind of continuous-phase frequency shift keying. In GMSK, the signal to be modulated onto the carrier is first smoothed with a Gaussian low-pass filter prior to being fed to a frequency modulator, which greatly reduces the interference to neighboring channels (adjacentchannel interference).
58
In some countries the GSM-900 band has been extended to cover a larger frequency range. This 'extended GSM', E-GSM, uses 880915 MHz (uplink) and 925 960 MHz (downlink), adding 50 channels (channel numbers 975 to 1023 and 0) to the original GSM-900 band. Time division multiplexing is used to allow eight full-rate or sixteen half-rate speech channels per radio frequency channel. There are eight radio timeslots (giving eight burst periods) grouped into what is called a TDMA frame. Half rate channels use alternate frames in the same timeslot. The channel data rate for all 8 channels is 270.833 kbit/s, and the frame duration is 4.615 ms. The transmission power in the handset is limited to a maximum of 2 watts in GSM850/900 and 1 watt in GSM1800/1900 VOICE CODECS GSM has used a variety of voice codecs to squeeze 3.1 kHz audio into between 6.5 and 13 kbit/s. Originally, two codecs, named after the types of data channel they were allocated, were used, called Half Rate (6.5 kbit/s) and Full Rate (13 kbit/s). These used a system based upon linear predictive coding (LPC). In addition to being efficient with bitrates, these codecs also made it easier to identify more important parts of the audio, allowing the air interface layer to prioritize and better protect these parts of the signal. GSM was further enhanced in 1997 with the Enhanced Full Rate (EFR) codec, a 12.2 kbit/s codec that uses a full rate channel. Finally, with the development of UMTS, EFR was refactored into a variable-rate codec called AMR-Narrowband, which is high quality and robust against interference when used on full rate channels, and less robust but still relatively high quality when used in good radio conditions on half-rate channels. NETWORK STRUCTURE Conventions and abbreviations In this document, the GSM engines are referred to as following term: 1. ME (Mobile Equipment); 2. MS (Mobile Station);
Mobile Phone Controlled PC With Control Electronic Devices 59
3. TA (Terminal Adapter); 4. DCE (Data Communication Equipment) or facsimile DCE(FAX modem, FAX board); In application, the controlling device controls the GSM engine by sending AT Command via its serial interface. The controlling device at the other end of the serial line is referred to as following term: 1. TE (Terminal Equipment); 2. DTE (Data Terminal Equipment) or plainly the application which is running on an embedded system; The network behind the GSM seen by the customer is large and complicated in order to provide all of the services which are required. It is divided into a number of sections and these are each covered in separate articles.
The Base Station Subsystem (the base stations and their controllers). The Network and Switching Subsystem (the part of the network most similar to The GPRS Core Network (the optional part which allows packet based Internet The Operations support system (OSS) for maintenance of the network.
a fixed network). This is sometimes also just called the core network.
connections).
60
because the purchase price of the mobile phone to the consumer is typically subsidized with revenue from subscriptions, and operators must recoup this investment before a subscriber terminates service. A subscriber may usually contact the provider to remove the lock for a fee, utilize private services to remove the lock, or make use of free or fee-based software and websites to unlock the handset themselves. In some territories (e.g., Bangladesh, Hong Kong, Pakistan) all phones are sold unlocked. In others (e.g., Belgium, Finland, New Zealand) it is unlawful for operators to offer any form of subsidy on a phone's price. GSM service security GSM was designed with a moderate level of service security. The system was designed to authenticate the subscriber using a pre-shared key and challenge-response. Communications between the subscriber and the base station can be encrypted. The development of UMTS introduces an optional Universal Subscriber Identity Module (USIM), that uses a longer authentication key to give greater security, as well as mutually authenticating the network and the user - whereas GSM only authenticates the user to the network (and not vice versa). The security model therefore offers confidentiality and authentication, but limited authorization capabilities, and no non-repudiation. GSM uses several cryptographic algorithms for security. The A5/1 and A5/2 stream ciphers are used for ensuring over-the-air voice privacy. A5/1 was developed first and is a stronger algorithm used within Europe and the United States; A5/2 is weaker and used in other countries. Serious weaknesses have been found in both algorithms: it is possible to break A5/2 in real-time with a cipher text-only attack, and in February 2008, Pico Computing, Inc revealed its ability and plans to commercialize FPGAs that allow A5/1 to be broken with a rainbow table attack. The system supports multiple algorithms so operators may replace that cipher with a stronger one. On 28 December 2009 German computer engineer Karsten Nohl announced that he had cracked the A5/1 cipher. According to Nohl, he developed a number of rainbow tables (static values which reduce the time needed to carry out an attack) and have found
Mobile Phone Controlled PC With Control Electronic Devices 62
new sources for known plaintext attacks. He also said that it is possible to build "a full GSM interceptor ... from open source components" but that they had not done so because of legal concerns. In 2010, threatpost.com reported that "A group of cryptographers has developed a new attack that has broken Kasumi, the encryption algorithm used to secure traffic on 3G GSM wireless networks. The technique enables them to recover a full key by using a tactic known as a related-key attack, but experts say it is not the end of the world for Kasumi." Kasumi is the name for the A5/3 algorithm, used to secure most 3G GSM EDGE traffic. Although security issues remain for GSM newer standards and algorithms may address this. New attacks are growing in the wild which take advantage of poor security implementations, architecture and development for smart phone applications. Some wiretapping and eavesdropping techniques hijack the audio input and output providing an opportunity for a 3rd party to listen in to the conversation. Although this threat is mitigated by the fact the attack has to come in the form of a Trojan, malware or a virus and might be detected by security software. Standards information The GSM systems and services are described in a set of standards governed by ETSI, where a full list is maintained.
GSM 07.07 "AT command set for GSM Mobile Equipment (ME)" describes
the Main AT commands to communicate via a serial interface with the GSM subsystem of the phone. For more, see Hayes command set.
3GPP TS 27.007 - AT command set for User Equipment (UE). GSM 07.05 has additional AT commands for SMS and CBS.
63
Figure8.1: Led
Leds are connect to the ports of microcontroller by using transistors and resisters. Transistor is used to decrease power dissipation and Leds are glow from external supply instead of microcontroller.
64
SWITCH
In electronics, a switch is an electronic electronics, a switch is an electrical component that can break an electrical circuit, interrupting the current or diverting it from one conductor to another. The most familiar form of switch is a manually operated electromechanical device with one or more sets of electrical contacts. Each set of contacts can be in one of two states: either 'closed' meaning the contacts are touching and electricity can flow between them, or 'open', meaning the contacts are separated and non conducting.In this at the time of switch pressed(supply applied) the voltage across resister 8.2Kohms is VCC as capacitor is short circuit. And this switches are connected to LEDs by using microcontroller program. When we release the switch the capacitor get charges to VCC.
65
66
2 Vcc 4"R/S"_Instruction(0)/data(1)
15 16
11
4 12
5 Gnd +5v 6 13 14
Vdd
10
RS
R/W
En
D0 0D D2 6 D1
D3 D4
D5 D6 D7
67
2.
69
3.
The first time you save the program a dialog box will popup and allow you to name your file and file type. Save program with filename: xxxxx.asm The File type is mentioned at last (.asm) means assembly language
4.
Select Project, New Project from the program menu Give some project name: xxxx.prj
70
5.
Click on the Add button A dialog-box appears, allowing you to add files to the project Change the file type to Assembly.
6.
Select your assembly file. Click on the Add button then close the Add dialog box.
71
72
73
USART_Init_9600();
ShiftToGsmMode();
SenStringToLcd ( 1, "GSM Modem Test.." ); while( DeleteSms() == 0){ SenStringToLcd ( 2, "Failed DelayMs( 500 ); } SenStringToLcd ( 2, "Passed " ); " );
74
DelayMs( 500 );
while(1){
ShiftToGsmMode(); retValue = 0; strcpy( messageBuffer, "\0" ); retValue = ReadSms( messageBuffer ); if( retValue == 1){
SenStringToLcd ( 1, myString4 ); index = 0; colunCount = 0; while( colunCount < 6 ){ if( messageBuffer[index] == '"' ){ colunCount++;
75
} index++; } strncpy( haCommand, &messageBuffer[index+2],6 ); haCommand[6] = '\0'; SenStringToLcd ( 2, "................" ); DelayMs( 10 ); SenStringToLcd ( 2, haCommand ); DelayMs( 250 );
SenStringToLcd ( 2, "****************"); DelayMs( 500 ); SenStringToLcd ( 1, "Command Executed"); DelayMs( 300 ); } else if ( !strcmp( haCommand, "HACMD2" ) ){
76
SenStringToLcd ( 2, "****************"); DelayMs( 500 ); SenStringToLcd ( 1, "Command Executed"); DelayMs( 300 ); } else if ( !strcmp( haCommand, "RTCLCK" ) ){
ShiftToPcMode(); DelayMs( 500 ); DelayMs( 500 ); DelayMs( 500 ); USART_Write_String( "Request Received: Right Click" ); USART_Write_A_Char( 0x0D); USART_Write_A_Char( 0x0A); SenStringToLcd ( 1, "RT CLICK REQ SNT"); SenStringToLcd ( 2, "****************"); DelayMs( 500 );
77
SenStringToLcd ( 1, "Command Executed"); ShiftToGsmMode(); DelayMs( 300 ); } else if ( !strcmp( haCommand, "LTCLCK" ) ){
ShiftToPcMode(); DelayMs( 500 ); DelayMs( 500 ); DelayMs( 500 ); USART_Write_String( "Request Received: Left Click" ); USART_Write_A_Char( 0x0D); USART_Write_A_Char( 0x0A); SenStringToLcd ( 1, "LT CLICK REQ SNT"); SenStringToLcd ( 2, "****************"); DelayMs( 500 ); SenStringToLcd ( 1, "Command Executed"); ShiftToGsmMode(); DelayMs( 300 ); } else{
78
79
ADVANTAGES:
1. 2. 3. 4. 5. Remote controlling of the computer. Controlling can be done from any phone. Any Electrical devices can be controlled. Devices switching can be done using Relay Easy and immediate access to PC.
APPLICATIONS:
1. Making our home a smart home by controlling devices using mobiles. 2. Used in shopping malls and business areas. 3. Easy and immediate access to PC 4. Used in railway stations and bus stands as remote control.
80
CONCLUSION
The controlling of the computer system and electrical devices using a mobile phone with GSM technology is successfully achieved with this device. Instead of using mouse, one can use this device from certain distance.
81
BIBILOGRAPHY
1.
second edition,2001 2. Lathi, Digital Communications, g.k publisher,2003 3. Sklar ,Digital Communications, second edition 4. M.A Mazidi & J.G Mazidi, The 8051 Microcontroller and Embedded Systems 5. Morris Mano, Digital design
WEBREFERENCES:
82