Project Report

November 4, 2017 | Author: Atanu Mandal | Category: Liquid Crystal Display, Pic Microcontroller, Embedded System, Microcontroller, Gsm
Share Embed Donate


Short Description

Download Project Report...

Description

1

CHAPTER 1

INTRODUCTION Fast transportation systems and rapid transit systems are nerves of economic developments for any nation. All developed nations have a well developed transportation system with efficient traffic control on road, rail and air. Transportation of goods, industrial products, manpower and machinery are the key factors which influence the industrial development of any country. Mismanagement and traffic congestion results in long waiting times, loss of fuel and money. It is therefore utmost necessary to have a fast, economical and efficient traffic control system for national development. The monitoring and control of city traffic is becoming a major problem in many countries. With the ever increasing number of vehicles on the road, the Traffic Monitoring Authority has to find new methods of overcoming such a problem [1-4]. The measures taken are development of new roads and flyovers in the middle of the city; building of several ring such as the inner ring road, middle ring road and outer ring road; introduction of city trains such as the light rapid transit (LRT), and monorails; restricting of large vehicles in the city during peak hours; and also development of sophisticated traffic monitoring and control systems. Growing numbers of road users and the limited resources provided by current infrastructures lead to ever increasing traveling times [5,6]. One way to improve traffic flow and safety of the current transportation system is to apply automation and intelligent control methods to roadside infrastructure and vehicles [7]. Transportation research has the goal to optimize transportation flow of people and goods. As the number of road users constantly increases, and resources provided by current infrastructures are limited, intelligent control of traffic will become a very important issue in the future.

2

1.1

Objective

1)Design of an Intelligent Traffic Light Controller which is having the capability of changing the timing interval on real time basis that is based on vehicle congestion. 2)The system should also respond to the drivers regarding the road congestion via SMS if the drivers pass requests via SMS.

1.2

Existing Method

1)Present Traffic Light Controller (TLC) is based on microcontroller and microprocessor. 2)Limitations : a)Because it uses the pre-defined hardware, b)It is functioning according to the program that does not have the flexibility of modification on real time basis. Due to the fixed time intervals of green, orange and red signals the waiting time is more and car uses more fuel.

1.3

Proposed Method

1)Intelligent Traffic Light Controller – To make traffic light controlling more efficient 2)This makes the use of Sensor Networks along with Embedded Technology. 3)The timings of Red, Green lights at each crossing of road will be intelligently decided based on the total traffic on all adjacent roads. 4)Thus, optimization of traffic light switching increases road capacity and traffic flow, and can prevent traffic congestions. 5)GSM cell phone interface is also provided for users those who wish to obtain the latest position of traffic on congested roads.

3

1.4 Block Diagram

Fig 1.1

1.5 Design Model

Fig 1.2

4

CHAPTER 2

EMBEDDED SYSTEMS

2.1 Introduction Embedded systems are computing systems with tightly coupled hardware and software integration, which are designed to perform a dedicated function. Embedded systems are present in many industries. 1) 2) 3) 4) 5) 6) 7)

Transportation Aerospace Telecommunication Robotics Home Appliance Medical Industrial purpose

Embedded System Design : We have to implement two parts in an Embedded system . It‘s depending upon the application requirements of the embedded project.

1) Hardware for speed and performance.

2)Software for flexibility.

5

2.2 Embedded system design module :

Fig 2.1 Hardware design it gives physical appearance to the embedded system depending upon the application requirements. It‘s like microcontroller, peripherals, timer, memory external panel for physical look and application required components for designing.

6

2.3 Types of Embedded Systems : 1)Standalone embedded system : A system that is completely operational without requiring external support. Example : Washing machine,digital clock. 2)Networking Embedded Systems : A group of standard alone system combined together to do one or more operations. Example : Mobile Phone,Networking Printer.

2.4 Characteristics of an Embedded System : 1.Reliability 2.Predictability 3.Performance. 4.Compactness

2.5 Embedded Tools : 1)Compiler 2)Linker 3)Debugger 4)Simulator 5)In-circuit Emulator

1)Compiler : A software-development tool that translates high-level language programs into the machine-language instructions that a particular processor can understand and execute.

7

2)Linker : A software development tool that accepts one or more object files as input and outputs a re-locatable program or executable program.

Fig 2.2

3)Debugger : A debugger is a computer program that is used to test and debug other programs. The code to be examined might alternatively be running on an instruction set .

4)Simulator : The act or process of simulating. An imitation; a sham. Assumption of a false appearance.

8

CHAPTER 3

MICROCONTROLLERS

3.1 Introduction to Microcontrollers : 

A microcontroller (also microcomputer, MCU or µC) is a small computer on a single integrated circuit consisting internally of a relatively simple CPU, clock, timers, I/O ports, and memory.



A microcomputer on a single chip, used to control some device such as an automobile engine or a toy.



Microcontroller is a computer-on-a-chip optimised to control electronic devices. It is designed specifically for specific tasks such as controling a specific system, in contrast to a general-purpose microprocessor, the kind used in a PC. ...

3.2 Basics of Microcontrollers :

Fig 3.1 A device which integrates a number of the components of a microprocessor system onto a single microchip.

9

Most microcontrollers will also combine other devices such as: 1) A Timer module to allow the microcontroller to perform tasks for certain time periods. 2) A serial I/O port to allow data to flow between the microcontroller and other devices such as a PC or another microcontroller. 3) An ADC to allow the microcontroller to accept analogue input data for processing.

3.3 Uses of Microcontroller : 1)Versatile ( Ability to store & run unique program ). 2)Inexpensive & Low power consumption. 3) One can program a mc to make decisions ( perform functions ) based on predetermined situations ( I/O line logic) & selections . 4) Ability to perform math & logic functions. ( for sophisticated logic & electronic ckts ) 5)Other programs can make mc behave like a fuzzy logic controller.Responsible for intelligence in most smart devices on consumer market.

3.4 Memory Unit : 1) Function - Store data. 2) Two Concepts : Addressing & Memory location. a) Memory consists of all memory locations. b) Addressing is nothing but selecting one of them. i.e., One end to select desired memory location & other end to wait for contents of that location.

10

3) Use : a) For reading from memory location & for writing on the memory location. b) This is done by supplying additional line called Control line ( R/W)

• If R/W=1 , Reading •

If R/W=0 , Writing

3.5 Memory Unit and Simplified Model :

Fig 3.2

3.6 Analog to Digital Converter : 1) The peripheral signals are different from the ones that microcontroller can understand ( 1‘s & 0‘s ) 2) Hence they should be converted into a mode understandable by microcontroller. This is done by ADC.

11

This block converts Analog value to Binary number & follow it through to a CPU block so that CPU block can further process it .

Fig 3.3 These are the functions performed inside the Microcontroller.After this functions,it is put into an electronic component where it will access inner blocks through the pins of this component.

3.7 BUS 1)Represents a group of 8, 16, or more lines. 2) This unit is capable of working by itself, but does not have any contact with the outside world. To remove this deficiency we add a block called PORT.

BUS Types :

12

BUS Model :

Fig 3.4

3.8 Watchdog Timer 1)In industries, often as a result of some interference our microcontroller stops executing the program , or it starts working incorrectly. 2)So to acquire flawless performance of microcontroller, we simply reset it and keep working under above occurrence. 3) Also there is no reset button to avoid this problem. 4)Hence we go for another block called Watchdog timer.

13

Watchdog Timer Model :

Fig 3.5

3.9 PIC Microcontrollers : Programmable Interface Controller is a family of Harvard architecture microcontrollers made by Microchip technology,derived from the PIC1640 originally developed by General Instrument‘s Microelectronics Division.The name PIC initially referred to ―Programmable Interface Controller‖,but shortly thereafter was renamed ―Programmable Intelligent Computer‖. PIC Microcontroller is vastly used now-a-days because of the following reasons : 1)Inbuilt Peripherals. 2) Low-cost. 3)This IC can be reprogrammed and erased up to 10,000 times. 4)Serial programming 5) Only 35 instruction .

14

3.9.1 The PIC Family: Packages PICs come in a huge variety of packages: 1)8

pin DIPs, (SMT):

12C50x (12bit) and 12C67x (14bit)

2)18pin DIPs, (SMT):

16C5X (12bit), 16Cxxx (14bit)

3)28pin DIPs, (SMT):

16C5X (12bit), 16Cxxx (14bit)

4)40pin DIPs, (SMT):

16Cxxx (14bit), 17C4x (16bit)

3.9.2 The PIC Family: Speed PIC require a clock to work. 1)Can use crystals, clock oscillators, or even an RC circuit. 2)Some PICs have a built in 4MHz RC clock 3)Instruction speed = 1/4 clock speed (Tcyc = 4 * Tclk) 12C50x

4MHz

12C67x

10MHz

16Cxxx

20MHz

16F778

12MHz,16MHz.,

3.9.3 The PIC Family: Program Memory PIC program space is different for each chip. Some examples are: 12C508

512 , 12 bit instructions

16C71C

1024 (1k), 14 bit instructions

16F877

8192 (8k), 14 bit instructions

17C766

16384 (16k) , 16 bit instructions

15

PICs have two different types of program storage: 1. EPROM (Erasable Programmable Read Only Memory): a)Needs windowed chips and UV light to erase Note: One Time Programmable (OTP) chips are EPROM chips, but with no window! b)PIC Examples: Any ‘C’ part: 12C50x, 17C7xx, etc. 2. FLASH: a)Re-writable (even by chip itself) b)Much faster to develop on! c)Finite number of writes (~100k Writes) d)PIC Examples: Any ‗F‘ part: 16F84, 16F87x, 18Fxxx (future)

3.9.4 The PIC Family: Data Memory PICs use general purpose ―file registers‖ for RAM (each register is 8bits for all PICs) Some examples are: 12C508

25 Bytes RAM

16C71C

36 Bytes RAM

16F877

368 Bytes

17C766

902 Bytes RAM

a)Don‘t forget, programs are stored in program space (not in data space), so low RAM values are OK.

3.9.5 The PIC Family: Control Registers PICs use a series of ―special function registers‖ for controlling peripherals and PIC behaviors.

16

Some examples are: 1)STATUS Bank select bits, ALU bits (zero, borrow, carry) 2) INTCON Interrupt control: interrupt enables, flags, etc. 3) TRIS

Tri-state control for digital I/O: which pins are ‗floating‘

4)TXREG UART transmit register: the next byte to transmit.

3.9.6 The PIC Family: Peripherals Different PICs have different on-board peripherals Some common peripherals are: 1)Tri-state (―floatable‖) digital I/O pins 2)Analog to Digital Converters (ADC) (8, 10 and 12bit, 50ksps) 3)Serial communications: UART (RS-232C), SPI, I2C. 4)Pulse Width Modulation (PWM) (10bit) 5)Timers and counters (8 and 16bit) 6)Watchdog timers.

3.9.7 PIC Peripherals: USART: UART Serial Communications Peripheral : Universal Synchronous/Asynchronous Receiver/Transmitter 1)Only available in 14bit and 16bit cores. 2)Interrupt on TX buffer empty and RX buffer full. Asynchronous communication: UART (RS-232C Serial) 1)Can do 300bps - 115kbps 2)8

or 9 bits, parity, start and stop bits, etc.

17

3)Outputs 5V so you need a RS232 level converter (e.g., MAX232)

Synchronous communication: i.e., with clock signal.

SPI = Serial Peripheral Interface 1) 3 wire: Data in, Data out, Clock 2)Master/Slave (can have multiple masters) 3)Very high speed (1.6Mbps) 4)Full speed simultaneous send and receive I2C = Inter IC 1)2 wire: Data and Clock

3.9.8 PIC16F Microcontroller Features The features of PIC16F Microcontrollers are mentioned below : 1)High-Performance RISC CPU 2)Operating speed: 20 MHz, 200 ns instruction cycle . 3)Operating voltage: 4.0-5.5V 4)Industrial temperature range (-40° to +85°C) . 5)15 nterrupt Sources. 6)35 ingle-word instructions . 7)All single-cycle instructions except for program branches (two-cycle)

Peripheral Features : 1)33 /O pins; 5 I/O ports 2)Timer0: 8-bit timer/counter with 8-bit Prescaler

18

3)Timer1: 16-bit timer/counter with Prescaler a)Can be incremented during Sleep via external crystal/clock

4)Timer2: 8-bit timer/counter with 8-bit period register, Prescaler and postscaler 5) Compare, PWM modules 6)Synchronous Serial Port with two modes: a)SPI Master b)I2C Master and Slave

USART. 1)Parallel Slave Port (PSP) 2)8 bits wide with external RD, WR and CS controls.

3.9.9 Dual inline package(PIN Diagram)

Fig 3.6

19

RA0-5 :

Input/Output port A

RB0-7 :

Input/Output port B

RC0-7 :

Input/Output port C

RD0-7 :

Input/Output port D

RE0-2 :

Input/Output port E

AN0-7 :

Analog input port

RX :

USART Asynchronous Receive

TX :

USART Asynchronous Transmit

SCK :

Synchronous serial clock input

SCL :

Output for both SPI and I C modes

DT :

Synchronous Data

CK :

Synchronous Clock

SDO :

SPI Data Out ( SPI mode )

SDI :

SPI Data In ( SPI mode )

SDA :

Data I/O ( I C mode )

CCP1,2 :

Capture In/Compare Out/PWM Out

OSC1/CLKIN :

Oscillator In/Ecternal Clock In

OSC2/CLKOUT :

Oscillator Out/Clock Out

2

2

3.9.10 Memory 1)Memory is an organism's ability to store, retain, and subsequently retrieve information. 2)Memory chips are simply a collection of registers , each with its own address. 3)Program Memory ----- 14 bit word length. 4)File Register Memory (Data Memory) ----- 8 bit word length.

20

Types of Memory : 1)RAM (Random Access Memory) 2)ROM (Read Only Memory). 3)EPROM (Erasable Programmable Read Only Memory). 4)EEPROM (Electrically Erasable Programmable Read Only Memory). 5)FLASH.

3.9.11 Stack 1)Stack is a section of memory ,data is added are removed in a Last-in-first out manner. 2)When a function executes, it may add some of its state data to the top of the stack. 3)A hardware stack for storing return addresses.

Stack Memory

Fig 3.7

21

CHAPTER 4 GSM (GLOBAL SYSTEMS for MOBILE COMMUNICATION)

4.1 INTRODUCTION If you are in Europe, Asia or Japan and using a mobile phone then most probably you must be using GSM technology in your mobile phone.GSM stands for Global System for Mobile Communication and is an open, digital cellular technology used for transmitting mobile voice and data services. The GSM is the name of a standardization group established in 1982 to create a common European mobile telephone standard. The GSM standard is the most widely accepted standard and is implemented globally. The GSM is a circuit-switched system that divides each 200 kHz channel into eight 25 kHz time-slots. GSM operates in the 900 MHz and 1.8GHz bands in Europe and the 1.9GHz and 850MHz bands in the US. The GSM is owns a market share of more than 70 percent of the world's digital cellular subscribers. The GSM makes use of narrowband Time Division Multiple Access (TDMA) technique for transmitting signals. The GSM was developed using digital technology. It has an ability to carry 64 kbps to 120 Mbps of data rates. Presently GSM support more than one billion mobile subscribers in more than 210 countries throughout of the world. The GSM provides basic to advanced voice and data services including Roaming service. Roaming is the ability to use your GSM phone number in another GSM network.

22

A GSM digitizes and compresses data, then sends it down through a channel with two other streams of user data, each in its own time slot. It operates at either the 900 MHz or 1,800 MHz frequency band.

4.2 Why GSM? The GSM study group aimed to provide the followings through the GSM: 1. 2. 3. 4. 5.

Improved spectrum efficiency. International roaming. Low-cost mobile sets and base stations (BSs) High-quality speech Compatibility with Integrated Services Digital Network (ISDN) and other telephone company services. 6. Support for new services.

4.3 Feature Specification Summary of GSM Cell Phone System 1.

Multiple Access Technology: FDMA / TDMA

2.

Duplex Technique: FDD

3.

Uplink frequency band: 933 - 960 MHz(basic 900 MHz band only)

4.

Downlink frequency band :890 - 915 MHz(basic 900 MHz band only)

5.

Channel spacing :200 kHz

6.

Modulation: GMSK

7.

Speech coding: Various - Original was RPE-LTP/13

8.

Speech channels per RF channel: 8

23

9.

Channel data rate: 270.833 kbps

10.

Frame duration: 4.615 mS

4.4 GSM Network A GSM network consists of several functional entities whose functions and interfaces are defined. The GSM network can be divided into following broad parts. 1. The Mobile Station(MS) 2. The Base Station Subsystem (BSS) 3. The Network Switching Subsystem (NSS) 4. The Operation Support Subsystem(OSS)

Following is the simple architecture diagram of GSM Network.

Fig 4.1

24

The added components of the GSM architecture include the functions of the databases and messaging systems: 1. Home Location Register (HLR) 2. Visitor Location Register (VLR) 3. Equipment Identity Register (EIR) 4. Authentication Center (AuC) 5. SMS Serving Center (SMS SC) 6. Gateway MSC (GMSC) 7. Chargeback Center (CBC) 8. Transcoder and Adaptation Unit (TRAU)

Following is the diagram of GSM Netwrok along with added elements.

Fig 4.2

25

The MS and the BSS communicate across the Um interface, also known as the air interface or radio link. The BSS communicates with the Network Service Switching center across the A interface.

4.5 GSM network areas: In a GSM network, the following areas are defined: Cell: Cell is the basic service area: one BTS covers one cell. Each cell is given a Cell Global Identity (CGI), a number that uniquely identifies the cell. Location Area: A group of cells form a Location Area. This is the area that is paged when a subscriber gets an incoming call. Each Location Area is assigned a Location Area Identity (LAI). Each Location Area is served by one or more BSCs. MSC/VLR Service Area: The area covered by one MSC is called the MSC/VLR service area. PLMN: The area covered by one network operator is called PLMN. A PLMN can contain one or more MSCs. Specifications for different Personal Communication Services (PCS) systems vary among the different PCS networks. The GSM specification is listed below with important characteristics.

26

Modulation: Modulation is a form of change process where we change the input information into a suitable format for the transmission medium. We also changed the information by demodulating the signal at the receiving end.The GSM uses Gaussian Minimum Shift Keying (GMSK) modulation method.

Access Methods: Because radio spectrum is a limited resource shared by all users, a method must be devised to divide up the bandwidth among as many users as possible.

GSM chose a combination of TDMA/FDMA as its method. The FDMA part involves the division by frequency of the total 25 MHz bandwidth into 124 carrier frequencies of 200 kHz bandwidth.One or more carrier frequencies are then assigned to each BS. Each of these carrier frequencies is then divided in time, using a TDMA scheme, into eight time slots. One time slot is used for transmission by the mobile and one for reception. They are separated in time so that the mobile unit does not receive and transmit at the same time.

Transmission Rate: The total symbol rate for GSM at 1 bit per symbol in GMSK produces 270.833 K symbols/second. The gross transmission rate of the time slot is 22.8 Kbps. GSM is a digital system with an over-the-air bit rate of 270 kbps.

27

Frequency Band: The uplink frequency range specified for GSM is 933 - 960 MHz (basic 900 MHz band only). The downlink frequency band 890 - 915 MHz (basic 900 MHz band only).

Channel Spacing: This indicates separation between adjacent carrier frequencies. In GSM, this is 200 kHz.

Speech Coding: GSM uses linear predictive coding (LPC). The purpose of LPC is to reduce the bit rate. The LPC provides parameters for a filter that mimics the vocal tract. The signal passes through this filter, leaving behind a residual signal. Speech is encoded at 13 kbps.

Duplex Distance: The duplex distance is 80 MHz. Duplex distance is the distance between the uplink and downlink frequencies. A channel has two frequencies, 80 MHz apart.

28

CHAPTER 5 GSM WIRELESS MODEMS

5.1 INTRODUCTION 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: 1.

Reading, writing and deleting SMS messages.

2.

Sending SMS messages.

29

3.

Monitoring the signal strength.

4.

Monitoring the charging status and charge level of the battery.

5.

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.

5.2 TYPES OF GSM / GPRS Modem for GSM 900 / GSM 1800 / GSM 1900

Fig 5.1 SIMCOM GSM Based Modem

SIMCOM GSM based Modem with most of the functions taken care on board is shown on the above figure.This GSM modem is a highly flexible plug and play GSM 900 / GSM 1800 / GSM 1900 modem for direct and easy integration RS232, voltage range for the power supply and audio interface make this device perfect solution for system integrators and single user. Voice, Data/Fax, SMS,GPRS, integrated TCP/IP stack,RTC and other features like the GSM / GPRS.

30

5.3 GSM MODEM CHARACTERISTICS : 1. Triband GSM GPRS modem (EGSM 900/1800 / 1900 MHz ) 2. Designed for GPRS, data, fax, SMS and voice applications 3. GPRS multi-slot class 10 4. GPRS mobile station class B 5. Designed for GPRS, data, fax, SMS and voice applications 6. Fully compliant with GSM Phase 2/2+ specifications 7. Built-in TCP/IP Protocol 8. Built-in RTC in the module. 9. AT Command based

5.4 SPECIFICATIONS FOR DATA : 1. GPRS class 10: max 85.6 kbps (downlink) 2. PBCCH Support 3. Coding schemes CS 1,2,3,4 4. CDS up to 14.4 kbps 5. USSD 6. Non transparent mode 7. PPP - stack

31

5.5 SPECIFICATIONS FOR SMS via GSM &GPRS : 1. Point-to-pointMO& MT 2. SMS cell Broadcast 3. Text & PDU mode

5.6 POWER SUPPLY : Use AC DC Power Adaptor with following ratings : 1. Input AC Voltage : 230V 2. OutputDC Voltage : 12V 3. OutputDC Current : 2A 4. Polarity : Centre +ve& Outside ve

5.7 GENERAL CHARACTERISTICS : 1. Input voltage : 9V-12V 2. Input current : 3mA in idle mode (only module) 3. Temperature range : Operating -20 to +55 degree Celsius; Storage -40 to +80 degree Celsius

5.8 INTERFACES : 1. RS-232 through D-TYPE 9 pin connector 2. Serial port baud rate 1200 to 115200 bps 3. RJ11 voice connector 4. Power supply through DC jacket

32

5. SMA antenna connector 6. Toggle spring/Flap Opening type SIM holder 7. LED status of GSM / GPRS module

5.9 GSM 2303R(Industrial GSM modem)

Fig 5.2

Product Description: 1. Industrial design 2. Aluminum casing 3. DB9 RS232 interface without voice function 4. Based on Wavecom module Q2303A 5. 3V SIM card slot 6. SIM Application Toolkit 7. Double tone multi-frequency function (DTMF) 8. Send and receive data and SMS 9. Antenna with high sensitivity

33

10.Always on-line 11.Comply with ETSI GSM Phase2+ 12.Dual-band:Class 4(2W @ 900MHz) Class 1(1W @ 1800MHz) 13.Input voltage:6V-36V DC 14.Input current:1A-2A 15.Standby current: 56mA 16.Working current: 100-140mA 17.Working temperature :-20 ℃-+55 ℃ 18.Storage temperature:-25 ℃ -+70 ℃ 19.Size:76*54*25mm 20.Weight:100g 21.Accessories: AC/DC adaptor, DB9 RS232 cable, antenna, 2 mounting plates, CD

5.10 How to send and receive SMS (data) via GSM modem

1. Press START button on the desktop 2. ALL PROGRAMS 3. ATTACHMENT

34

4. COMMUNICATION 5. HYPERTERMINAL 6. Enter a name, for example ABC 7. Choose a COM port 8. Choose baud rate 115200 or 9600 9. Confirm 10.Type AT and then press ENTER key 11.Type AT+CMGF=1 and then press ENTER key 12.Type AT+CMGS= SIM number of the modem and then press ENTER key 13.Write a message and then send it by pressing keys CTRL+Z 14.You will see: +CMTI:‖SM‖,1 15.Type AT+CMGR=1(read the received message) 5.11 AT COMMANDS(Short Messages commands) 5.11.1 Preferred Message Format +CMGF

Description : The message formats supported are text mode and PDU mode.In PDU mode, a complete SMS Message including all header information isgiven as a binary string (in hexadecimal format). Therefore, only the followingset of characters is allowed: {‗0‘,‘1‘,‘2‘,‘3‘,‘4‘,‘5‘,‘6‘,‘7‘,‘8‘,‘9‘, ‗A‘,‗B‘,‘C‘,‘D‘,‘E‘,‘F‘}. Each pair or characters is converted to a byte (e.g.: ‗41‘ isconverted to the ASCII

35

character ‗A‘, whose ASCII code is 0x41 or 65).In Text mode, all commands and responses are in ASCII characters.The format selected is stored in EEPROM by the +CSAS command.

Syntax: Command Syntax: AT+CMGF

5.11.2 Read message +CMGR

Description : This command allows the application to read stored and received messages. The messagesare read from the memory selected by +CPMS command.

Syntax: Command Syntax: AT+CMGR=

5.11.3 Send message +CMGS

Description : The field is the address of the terminal to which the message is sent. To send the message, simply type, character (ASCII 26). The text can contain all existing characters except and (ASCII 27).This command can be aborted using the character when entering text.In PDU mode, only hexadecimal characters are used (‗0‘…‘9‘,‘A‘…‘F‘).

36

Syntax : Command syntax in text mode : AT+CMGS= [ , ] text is entered Command syntax in PDU mode : AT+CMGS= PDU is entered

5.11.4 Delete message +CMGD

Description : This command is used to delete one or several messages from preferredmessage storage (―BM‖ SMS CB ‗RAM storage‘, ―SM‖ SMSPP storage ‗SIMstorage‘ or ―SR‖ SMS Status-Report storage).

Syntax: Command Syntax:AT+CMGD= [,]

37

CHAPTER 6 LIQUID CRYSTAL DISPLAY(LCD)

A liquid crystal display (LCD) is an electro-optical amplitude modulator realized as a thin, flat display device made up of any number of color or monochrome pixels arrayed in front of a light source or reflector. It is often utilized in battery-powered electronic devices because it uses very small amounts of electric power.

Each pixel of an LCD typically consists of a layer of molecules aligned between two transparent electrodes, and two polarizing filters, the axes of transmission of which are (in most of the cases) perpendicular to each other. With no liquid crystal between the polarizing filters, light passing through the first filter would be blocked by the second (crossed) polarizer.

The surfaces of the electrodes that are in contact with the liquid crystal material are treated so as to align the liquid crystal molecules in a particular direction. This treatment typically consists of a thin polymer layer that is unidirectional rubbed using.

38

6.1 LCD Operation :

In recent years the LCD is finding widespread use replacing LEDs (seven-segment LEDs or other multisegment LEDs). This is due to the following reasons: 1)The declining prices of LCDs.

2)The ability to display numbers, characters, and graphics. This is in contrast to LEDs, which are limited to numbers and a few characters.

3)Incorporation of a refreshing controller into the LCD, thereby relieving the CPU of the task of refreshing the LCD. In contrast, the LED must be refreshed by the CPU (or in some other way) to keep displaying the data. 4)Ease of programming for characters and graphics.

6.2 Interfacing LCD

Fig 6.1

39

6.3

Passive-matrix and active-matrix addressed LCDs

LCDs with a small number of segments, such as those used in digital watches and pocket calculators, have individual electrical contacts for each segment. An external dedicated circuit supplies an electric charge to control each segment. This display structure is unwieldy for more than a few display elements. Small monochrome displays such as those found in personal organizers, or older laptop screens have a passive-matrix structure employing super-twisted nematic (STN) or double-layer STN (DSTN) technology—the latter of which addresses a color-shifting problem with the former—and color-STN (CSTN)—wherein color is added by using an internal filter. Each row or column of the display has a single electrical circuit. The pixels are addressed one at a time by row and column addresses. This type of display is called passive-matrix addressed because the pixel must retain its state between refreshes without the benefit of a steady electrical charge. As the number of pixels (and, correspondingly, columns and rows) increases, this type of display becomes less feasible. Very slow response times and poor contrast are typical of passive-matrix addressed LCDs. High-resolution color displays such as modern LCD computer monitors and televisions use an active matrix structure. A matrix of thin-film transistors (TFTs) is added to the polarizing and color filters. Each pixel has its own dedicated transistor, allowing each column line to access one pixel. When a row line is activated, all of the column lines are connected to a row of pixels and the correct voltage is driven onto all of the column lines. The row line is then deactivated and the next row line is activated. All of the row lines are activated in sequence during a refresh operation. Active-matrix addressed displays look "brighter" and "sharper" than passive-matrix addressed displays of the same size, and generally have quicker response times, producing much better images.

40

CHAPTER 7 CRYSTAL OSCILLATOR A crystal oscillator is an electronic circuit that uses the mechanical resonance of a vibrating crystal of piezoelectric material to create an electrical signal with a very precise frequency. This frequency is commonly used to keep track of time (as in quartz wristwatches), to provide a stable clock signal for digital integrated circuits, and to stabilize frequencies for radio transmitters/receivers. 7.1 The Design Principles of Crystal Oscillators : Crystal Oscillators are usually, fixed frequency oscillators where stability and accuracy are the primary considerations. For example it is almost impossible to design a stable and accurate LC oscillator for the upper HF and higher frequencies without resorting to some sort of crystal control. Hence the reason for crystal oscillators.

7.2 A Practical Example of a Crystal Oscillator

Fig 7.1

41

7.3 Oscillator Types : The PIC16F87XA can be operated in four different oscillator modes. The user can program two configuration bits (FOSC1 and FOSC0) to select one of these four modes: • LP Low-Power Crystal • XT Crystal/Resonator • HS High-Speed Crystal/Resonator • RC Resistor/Capacitor

7.4 Crystal Oscillators/Ceramic Resonators : In XT, LP or HS modes, a crystal or ceramic resonator is connected to the OSC1/CLKI and OSC2/CLKO pins to establish oscillation. The PIC16F87XA oscillator design requires the use of a parallel cut crystal. Use of a series cut crystal may give a frequency out of the crystal manufacturer‘s specifications. When in XT, LP or HS modes, the device can have an external clock source to drive the OSC1/CLKI pin.

7.5 Notes : 1: Higher capacitance increases the stability of oscillator but also increases the start-up time. 2: Since each resonator/crystal has its own characteristics, the user should consult the resonator/crystal manufacturer for appropriate values of external components. 3: Rs may be required in HS mode, as well as XT mode, to avoid overdriving crystals with low drive level specification. 4: When migrating from other PICmicrocontroller devices, oscillator performance should be verified.

42

CHAPTER 8 INFRARED SENSORS Infrared is an energy radiation with a frequency below our eyes sensitivity, so we can not see it Even that we can not "see" sound frequencies, we know that it exist, we can listen them. Even that we can not see or hear infrared, we can feel it at our skin temperature sensors. When you approach your hand to fire or warm element, you will "feel" the heat, but you can't see it. You can see the fire because it emits other types of radiation, visible to your eyes, but it also emits lots of infrared that you can only feel in your skin.

Fig 8.1

8.1 Principle of Operation : A photodiode is a PN junction or PIN structure. When a photon of sufficient energy strikes the diode, it excites an electron thereby creating a mobile electron and a positively charged electron hole. If the absorption occurs in the junction's depletion region, or one diffusion length away from it, these carriers are swept from the junction by the built-in field of the depletion region. Thus holes move toward the anode, and electrons toward the cathode, and a photocurrent is produced.

43

1) The sender is composed of an IR LED (D2) in series with a 470 Ohm resistor, yielding a forward current of 7.5mA.

2) The receiver part is more complicated, the 2 resistors R5 and R6 form a voltage divider which provides 2.5V at the anode of the IR LED (here, this led will be used as a sensor). When IR light falls on the LED (D1), the voltage drop increases, the cathode's voltage of D1 may go as low as 1.4V or more, depending on the light intensity. The output will be High when IR light is detected, which is the purpose of the receiver.

8.2 Applications : The primary function is to recognize IR signals which are emitted from an IR transmitter. The transmitter is usually mounted on a shearer and the receivers in the shields. The latter are connected to the controller.

44

CHAPTER 9 MICROCONTROLLER CODING

9.1 Source Coding : include #include"lcd_driver_ver2a.c" #include"uart_driver_ver2.c" #include"string.h" #define receive_interrupt_flag RCIF #define new_msg_cmd 0 #define echo_cmd 1 #define config_cmd 2 #define msg_send_cmd1 3 #define msg_send_cmd2 4 #define msg_rec_cmd 5 #define msg_del_cmd 6 #define new_msg_id 7 #define ROAD_1 1 #define ROAD_2 2 #define ROAD_3 3 #define ROAD_4 4 /***************************************************************/

45

void initialise_gsm(void); void disable_echo(void); void change_text_mode(void); void read_message(void); void send_message(unsigned char *no, unsigned char *msg); void delete_message(void); void press_enter(void); void press_ctrlz(void); void change_signal1(void); void change_signal2(void); void change_signal3(void); void change_signal4(void); void initialise_timer(void); static unsigned char rec_no[15],rec_msg[15]; static unsigned char cmd_status_flag,rec_status_flag,msgno; bank1 static unsigned char status[50]=" at Road A; at Road B; at Road C; at Road D"; static unsigned char mode,cnt; /***************************************************************/ void main() { static unsigned char msg[]="Status"; TRISB = 0xF0;

46

TRISD = 0x00; PORTD = 0x00; PORTB = 0x00; mode = ROAD_1; ADCON1=0X06; initialise_uart(9600); enable_uart_interrupt(); initialise_lcd_io(); initialise_lcd(); initialise_gsm(); initialise_timer(); while(1) { if(cnt == 0) { lcd_goto(19); ldisp_no_uchar(5); } if(cnt == 10) { lcd_goto(19); ldisp_no_uchar(4); }

47

if(cnt == 20) { lcd_goto(19); ldisp_no_uchar(3); } if(cnt == 30) { lcd_goto(19); ldisp_no_uchar(2); } if(cnt == 40) { lcd_goto(19); ldisp_no_uchar(1); } if(cmd_status_flag == new_msg_id) { cmd_status_flag = 0; read_message(); lcd_goto(1); print_lcd(rec_msg); lcd_goto(21); print_lcd(rec_no);

48

if(strcmp(rec_msg,msg) == 0) { send_message(rec_no,status); } delete_message(); } } } /*************************************************************** * GSM Modem Initialisation * This is to disable the echo senging by GSM modem and * to change the modem into text format. ***************************************************************/ void initialise_gsm() { disable_echo(); change_text_mode(); } void read_message() { cmd_status_flag = msg_rec_cmd; print_uart("AT+CMGR=");

49

udisp_no_uchar(msgno); press_enter();

} void send_message(unsigned char *no, unsigned char *msg) { unsigned char c; cmd_status_flag = msg_send_cmd1; //-----sending of command--------// print_uart("AT+CMGS="); put_byte(34); //-----sending of number---------// while(*no != '\0') { put_byte(*no); no++; } put_byte(34); press_enter(); //------sending of message-------// while(rec_status_flag == 0) continue; rec_status_flag = 0;

50

while(*msg != '\0') { put_byte(*msg); DelayMs(2); msg++; } press_ctrlz(); cmd_status_flag = msg_send_cmd2; press_enter();

} void delete_message() { cmd_status_flag = msg_del_cmd; print_uart("AT+CMGD="); udisp_no_uchar(msgno); press_enter(); }

/*************************************************************** *

Sending of Carriage Return Command to GSM modem

* For Sending the CR command send the ascii value(13) through serial port ***************************************************************/

51

void press_enter() { put_byte(13); } void press_ctrlz() { put_byte(26); } void initialise_timer() { /* Configuring Timer1 in timer mode */ T1CON = 0x31;

// Enables T1 for internal clock prescaleed to 1:8,

TMR1IE = 1;

// Enables Timer1 interrupt

PEIE = 1;

// Enables all peripheral interrupts

GIE = 1;

// Enable the global interrupt

} #pragma interrupt_level 0 static void interrupt receive(void) { /* ISR to create one minute timing interrupt using Timer1 */ if(TMR1IF)

// Interrupt occurs every 0.1 secs

{ static unsigned char cnt_A,cnt_B,cnt_C,cnt_D,pre_mode;

52

TMR1ON = 0; TMR1L = 0xb0;

//Reloading the Timer1 to 15536 to create 0.1 sec

TMR1H = 0x3c; TMR1ON = 1; cnt++;

// Increments every 0.1 sec

if(RB4 == 0) cnt_A++; if(RB5 == 0) cnt_B++; if(RB6 == 0) cnt_C++; if(RB7 == 0) cnt_D++; if(cnt_A > 30) { mode = ROAD_1; status[0] = 'H'; } else if(cnt_B >

30)

{ mode = ROAD_2; status[12] = 'H'; }

53

else if(cnt_C > 30) { mode = ROAD_3; status[24] = 'H'; } else if(cnt_D > 30) { mode = ROAD_4; status[36] = 'H'; } if(cnt_A < 30) status[0] = 'L'; if(cnt_B < 30) status[12] = 'L'; if(cnt_C < 30) status[24] = 'L'; if(cnt_D < 30) status[36] = 'L'; //

status[4] = '\0'; if (cnt == 50) { cnt = 0; pre_mode = mode;

54

switch(mode) { case ROAD_1: change_signal1(); mode = ROAD_2; break; case ROAD_2: change_signal2(); mode = ROAD_3; break; case ROAD_3: change_signal3(); mode = ROAD_4; break; case ROAD_4: change_signal4(); mode = ROAD_1; break; default : break; } } if (cnt == 40)

55

{ switch(pre_mode) { case ROAD_1: cnt_A = 0; break; case ROAD_2: cnt_B = 0; break; case ROAD_3: cnt_C = 0; break; case ROAD_4: cnt_D = 0; break; default : break; } } TMR1IF = 0; } } void change_signal1()

// Clear the Timer interrupt flag

56

{ PORTB = 0x08; // makes other sections to red RD0 = 1; RD1 = 0;

// power on green light // power off yellow light

} void change_signal2() { PORTB = 0x04; // makes other sections to red RD0 = 1; RD1 = 0;

// power green light // power off yellow light

} void change_signal3() { PORTB = 0x02; // makes other sections to red RD0 = 1; RD1 = 0;

// power green light // power off yellow light

} void change_signal4() { PORTB = 0x01; // makes other sections to red RD0 = 1; RD1 = 0; }

// power green light // power ofF yellow light

57

CHAPTER 10

CONCLUSION

The improvement of town traffic condition is largely dependent on the modern ways of traffic management and control. Advanced traffic signal controllers and control system contribute to the improvement of the traffic problem. The intelligent of traffic signal controller is introduced in this project with powerful functions and hardware interface. This project has two major phases. The first stage is to design a program, which consists of reading, research, planning and designing a program. Design a traffic light using the state machine is very difficult compare to design using the logic gates. Microcontroller Assembly Language was chosen to write a program code for simulation only to get a timing diagram. After that, second phase is to continue with the hardware implementation using the gate logic and the interface light is using LED. The blinking is depending on the state machine transition. GSM Interface is also provided for sending traffic alerts signals for drivers on road and precautions be taken not to indulge in traffic congestion. It is observed that the proposed Intelligent Traffic Light Controller is more efficient than the conventional controller in respect of less waiting time, more distance traveled by average vehicles and efficient operation during emergency mode and GSM interface. Moreover, the designed system has simple architecture, fast response time, user friendliness and scope for further expansion.

58

REFERENCES [1] Liu, ―Routing finding by using knowledge about the road network‖, IEEE Transactions on System, man, and Cybernetics- Part A: Systems and Humans. Vol. 27 No. 4, 1997, pp 425-430. [2] "Task 1 - Traffic Management Studies for Reconstruction High-Volume Roadways," Innovative Pavement Research Foundation, The Texas Transportation Institute, Texas A&M University System, College Station, Texas, 2002. [3] Chen and Yang, ―Minimization of travel time and weighted number of stops in a traffic-light network‖. Transportation Research B. Vol. 34, 2000, pp 241253. [4] Sheu, ―A composite traffic flow modeling approach for incident-responsive network traffic assignment‖, Physica A. Vol. 367. 2006, pp. 461-478. [5] Abu-Lebdeh, G. and Ahmed, K., ―Assessment of operational advantages of intelligent traffic control in congested conditions‖, Presented at the 9th ITS World Congress, Chicago, October 2002. [6] Wangermann and Stengel, ―Principled negotiation between intelligent agents: a model for air traffic management‖, Journal of Artificial Intelligent in Engineering. Vol. 12. 1998, pp. 177- 187. [7] Roberto Horowitz, Pravin Varaiya ―Control Design of an Automated Highway System‖,Proceedings of the IEEE, 2005 Available at : http://www.path.berkeley.edu/ ~varaiya/ papers_ps.dir/ahsdesign.pdf. [8] Stefan Peelen, Roelant Schouten, Merlijn SteingrÄover, ―Design and Organization of Autonomous Systems:Intelligent Traffic Light Control‖,

View more...

Comments

Copyright ©2017 KUPDF Inc.
SUPPORT KUPDF