Upload
lamquynh
View
231
Download
5
Embed Size (px)
Citation preview
1
CHAPTER 1
INTRODUCTION
1.1 OVERVIEW
There are lots of efforts being made by public transport corporations to
improve public vehicle occupancy by requesting the public to use public
transport over other modes of transportation. It can be noted that if the
passenger knows with high confidence that the bus is going to come, he/she
will definitely wait rather than opting for other modes of transportation.
Efficient information can therefore help the users to choose faster and easier
connections, which saves their time. Trends in wireless technology like
Global System for Mobile communication (GSM) and RF Technology have
resulted in easier and faster communication. Thus, this Project provides a
very cost-effective solution as compared to existing technologies for
tracking public vehicles.
1.2 BACKGROUND
One of the possible reasons for people preferring private vehicles to public
vehicles are that a passenger normally does not have exact information about
the public vehicle arrival timing at their stops. By providing reliable public
vehicle arrival information to the passengers at predefined stops, public
vehicle occupancy can be improved. This is beneficial to both the passengers
and public transport corporations. Tracking of a vehicle can be expressed as
continuously monitoring of a vehicle. Tracking of buses can be useful for the
automation of existing transportation systems. By the use of tracking the
information about bus-arrival timing can be easily provided to passengers.
2
The different wireless technologies available today have resulted in the
reliable and faster communication. GSM is an open, digital cellular
technology used for transmitting mobile voice and data services. GSM has
become the world’s fastest growing mobile communication standard. GSM
networks operate in a number of different carrier frequency ranges
(separated into GSM frequency ranges for 2G and UMTS frequency bands
for 3G), with most 2G GSM networks operating in the 900 MHz or 1800
MHz bands. The GSM network is structured into a number of discrete
sections:
(i) The Base Station Subsystem (the base stations and their controllers).
(ii) The Network and Switching Subsystem (the part of the network most
similar to a fixed network). This is sometimes also just called the core
network.
(iii) The GPRS Core Network (the optional part that allows packet based
Internet connections).
(iv) Operation Support System (OSS) for maintenance of the network.
Radio-Frequency Transceiver is a wireless sensor technology, which is
based on the detection of electromagnetic signals. There is emission of radio
waves from the transmitter, which can reach up to 100 feet or more,
depending on its power output and the radio frequency used.
3
CHAPTER 2
DESIGN AND DESCRIPTION
2.1 BLOCK DIAGRAM
Fig 2.1 Block Diagram
BUS
RF RECEIVER
+ CONTROLLER
+ GSM MODEM
+ LCD DISPLAY
GSMNETWORK
RF TRANSMITTER
BUSSTOP2BUSSTOP3
BUSSTOP
BUSSTOP1
4
2.2 BASIC DESCRIPTION
The basic block diagram of the bidirectional visitor counter with automatic
light controller is shown in the above figure. Mainly this block diagram
consists of the following essential blocks.
2.2.1 RF Transmitter and Receiver
2.2.2 PIC Microcontroller
2.2.3 GSM Modem
2.2.4 LCD Display
2.2.1 RF Transmitter and Receiver
The RF module, as the name suggests, operates at Radio Frequency. The
corresponding frequency range varies between 30 kHz & 300 GHz. In this
RF system, the digital data is represented as variations in the amplitude of
carrier wave. This kind of modulation is known as Amplitude Shift Keying
(ASK).
2.2.2 PIC Microcontroller
PIC is a family of modified Harvard Architecture made by Microchip
Technology and PIC referred to as Peripheral Interface Controller. PIC
devices are popular with both industrial developers and hobbyists due to
their low cost, wide availability, large user base, extensive collection of
application notes, availability of low cost or free development tools, serial
programming, and re-programmable Flash-memory capability.
5
2.2.3 GSM Modem
A GSM modem is a specialized type of modem, which accepts a SIM card,
and operates over a subscription to a mobile operator, just like a mobile
phone. When a GSM modem is connected to a computer, this allows the
computer to use the GSM modem to communicate over the mobile
network. While these GSM modems are most frequently used to provide
mobile internet connectivity, many of them can also be used for sending and
receiving SMS and MMS messages.
2.2.4 LCD Display
A 16x2 LCD display is very basic module and is very commonly used in
various devices and circuits. These modules are preferred over seven
segments and other multi segment LEDs. The reasons being: LCDs are
economical; easily programmable; have no limitation of displaying special
& even custom characters (unlike in seven segments), animations and so on.
6
2.3 CIRCUIT DIAGRAM
Fig 2.2 Circuit Diagram
RA0/AN02
RA1/AN13
RA2/AN2/VREF-/CVREF4
RA4/T0CKI/C1OUT6
RA5/AN4/SS/C2OUT7
RE0/AN5/RD8
RE1/AN6/WR9
RE2/AN7/CS10
OSC1/CLKIN13
OSC2/CLKOUT14
RC1/T1OSI/CCP216
RC2/CCP117
RC3/SCK/SCL18
RD0/PSP019
RD1/PSP120
RB7/PGD40
RB6/PGC39
RB538
RB437
RB3/PGM36
RB235
RB134
RB0/INT33
RD7/PSP730
RD6/PSP629
RD5/PSP528
RD4/PSP427
RD3/PSP322
RD2/PSP221
RC7/RX/DT26
RC6/TX/CK25
RC5/SDO24
RC4/SDI/SDA23
RA3/AN3/VREF+5
RC0/T1OSO/T1CKI15
MCLR/Vpp/THV1
U1
PIC16F877A
D7
14
D6
13
D5
12
D4
11
D3
10
D2
9D
18
D0
7
E6
RW
5R
S4
VS
S1
VD
D2
VE
E3
LCD1LM016L
RF Receiver
RF Transmitter
5V
GSM Modem
Rx
Tx
D1
D2
7
2.3.1 Circuit Diagram Explanation
• Transmitter in the bus is programmed to send RF signal carrying the
bus details.
• When the bus approaches the bus stop, the (always-on) RF transmitter
(which is pre-programmed) sends RF signal carrying the details of the
bus number, route and its time of arrival.
• The always-on RF receiver at the bus stop receives the transmitted
signal and it is decoded using 16F877A microcontroller.
• Then, using GSM modem, the decoded bus details are sent to some
selected bus stops on the route.
• At Bus stops, GSM SIM card receives the information and the bus
details are displayed at the bus stop using a LCD monitor that is
interfaced to the microcontroller.
8
CHAPTER 3
HARDWARE DESCRIPTIONS
3.1 PIC16F877A MICROCONTROLLER PIC 16F877 is one of the most advanced microcontroller from Microchip.
This controller is widely used for experimental and modern applications
because of its low price, wide application range, high quality and ease of
availability. It is ideal for applications such as machine control applications,
measurement devices, study purpose and so on. The PIC 16F877 features all
the components which modern microcontrollers normally have. The picture
of a PIC16F877 chip is shown below.
Fig 3.1 PIC IC
3.1.1 Features of PIC16F877
The features of PIC16F877A are given below
3.1.1.1 Special Features
• 100,000 erase/write cycle Enhanced Flash Program Memory
• Self-reprogrammable under software control
• Single-supply 5V In-Circuit Serial Programming
9
• Watchdog Timer (WDT) with its own on-chip RC oscillator
• Programmable Code Protection
3.1.1.2 Peripheral Features
• Two 8-bit (TMR0, TMR2) timer/counter with pre-scalar
• One 16-bit timer/counter
• Parallel Slave Port (PSP): 40/44 pin-device only
• High performance RISC CPU:
• Only 35 single-word instructions to learn
• DC-20MHz clock input
Fig 3.2 PIC Pin Configuration
10
3.2 RF TRANSMITTER
The TWS-434 is small, and is excellent for applications requiring short-
range RF remote controls. The transmitter module is only 1/3 the size of a
standard postage stamp, and can easily be placed inside a small plastic
enclosure.
TWS-434: The transmitter output is up to 8mW at 433.92MHz with a range
of approximately 400-foot (open area) outdoors. Indoors, the range is
approximately 200 foot, and will go through most walls.
The TWS-434 transmitter accepts both linear and digital inputs can operate
from 1.5 to 12 Volts-DC, and makes building a miniature hand-held RF
transmitter very easy. The TWS-434 is approximately the size of a standard
postage stamp.
Fig 3.3 RF Transmitter IC
11
3.2.1 PIN Descriptions
Table 3.1 RF Transmitter PIN Descriptions
3.3 HT640 ENCODER
The 3 encoders are a series of CMOS LSIs for remote control system
applications. They are capable of encoding 18 bits of information, which
consists of N address bits, and 18_N data bits. Each address/data input is
externally ternary programmable if bonded out. It is otherwise set floating
internally.
Fig 3.4 HT640 Encoder IC
3.3.1 General Description
Various packages of the 3 encoders offer flexible combinations of
programmable address/data to meet various application needs. The
Pin No
Function
Name
1 Ground (0V) Ground 2 Serial data input pin Data 3 Supply voltage; 5V Vcc 4 Antenna output pin ANT
12
programmable address/ data is transmitted together with the header bits via
an RF or an infrared transmission medium upon receipt of a trigger signal.
The capability to select a TE trigger type or a DATA trigger type further
enhances the application flexibility of the 318series of encoders.
3.3.2 Block diagram
Fig 3.5 HT640 Encoder Block Diagram
3.3.3 Features
• Operating voltage: 2.4V~12V
• Low power and high noise immunity CMOS technology
• Low standby current
• Three words transmission Built-in oscillator needs only 5% resistor
• Easy interface with an RF or infrared transmission media
• Minimal external components
3.4 RF RECEIVER
• The receiver needs between 4.5V and 5.5V to power up.
• The receiver will send any data it receives through Pin 2, which is
labeled "Digital Data Output". It is connected to the microcontroller
for decoding.
13
• Pin 3, labeled "Linear Output/Test" is for testing the receiver, and we
will not be using it at all. It takes the receiver around 30 milliseconds
to start up.
Fig 3.6 RF Receiver IC
3.4.1 PIN Description
Table 3.2 PIN Configurations
Pin No Function Name
1 Ground (0V) Ground 2 Serial data output pin Data 3 Linear output pin; not connected NC 4 Supply voltage; 5V Vcc 5 Supply voltage; 5V Vcc 6 Ground (0V) Ground 7 Ground (0V) Ground 8 Antenna input pin ANT
14
3.5 HT648 DECODER
The 3 decoders are a series of CMOS LSIs for remote control system
applications. They are paired with the 3 series of encoders. For proper
operation a pair of encoder/decoder pair with the same number of address
and data format should be selected.
3.5.1 General Description
The 318 series of decoders receives serial address and data from that series
of encoders that are transmitted by a carrier using an RF or an IR
transmission medium. It then compares the serial input data twice
continuously with its local address. If no errors or unmatched codes are
encountered, the input data codes are decoded and then transferred to the
output pins. The VT pin also goes high to indicate a valid transmission. The
318 decoders are capable of decoding 18 bits of information that consists of
N bits of address and 18–N bits of data. To meet various applications they
are arranged to provide a number of data pins whose range is from 0 to 8 and
an address pin whose range is from 8 to 18. In addition, the 318 decoders
provide various combinations of address/data number in different packages.
Fig 3.7 HT648 Decoder Block Diagram
15
3.5.2 Features
• Operating voltage: 2.4V~12V
• Low power and high noise immunity CMOS technology
• Low standby current
• Capable of decoding 18 bits of information
• Pairs with HOLTEK’s 318 series of encoders
• 8~18 address pins
• 0~8 data pins
• Ternary address setting
• Two times of receiving check
• Built-in oscillator needs only a 5% resistor
• Valid transmission indictor
• Easily interface with an RF or an infrared transmission medium
• Minimal external components
3.6 GSM MODEM
A GSM modem is a wireless modem that works with a GSM wireless
network. A wireless modem behaves like a dial-up modem. The main
difference between them is that a dial-up modem sends and receives data
through a fixed telephone line while a wireless modem sends and receives
data through radio waves.
A GSM modem can be an external device or a PC Card / PCMCIA Card.
Typically, an external GSM modem is connected to a computer through a
serial cable or a USB cable. A GSM modem in the form of a PC Card /
PCMCIA Card is designed for use with a laptop computer. It should be
inserted into one of the PC Card / PCMCIA Card slots of a laptop computer.
16
Like a GSM mobile phone, a GSM modem requires a SIM card from a
wireless carrier in order to operate.
Both GSM modems and dial-up modems support a common set of standard
AT commands. You can use a GSM modem just like a dial-up modem.
In addition to the standard AT commands, GSM modems support an
extended set of AT commands. These extended AT commands are defined
in the GSM standards. With the extended AT commands, you can do things
like:
• Reading, writing and deleting SMS messages.
• Sending SMS messages.
• Monitoring the signal strength.
• Monitoring the charging status and charge level of the battery.
• Reading, writing and searching phone book entries.
The number of SMS messages that can be processed by a GSM modem per
minute is very low only about six to ten SMS messages per minute.
3.6.1 GSM Modem Characteristics
• Triband GSM GPRS modem (EGSM 900/1800 / 1900 MHz)
• Designed for GPRS, data, fax, SMS and voice applications
• GPRS multi-slot class 10
• GPRS mobile station class B
• Designed for GPRS, data, fax, SMS and voice applications
• Fully compliant with GSM Phase 2/2+ specifications
• Built-in TCP/IP Protocol
• Built-in RTC in the module.
17
3.6.2 Specifications for SMS via GSM
• Point-to-point MO & MT
• SMS cell Broadcast
• Text & PDU mode
3.6.3 Power supply
Use AC DC Power Adaptor with following ratings
• Input AC Voltage: 230V
• Output DC Voltage: 12V
• Output DC Current: 2A
• Polarity: Centre +ve & Outside –ve
3.6.4 PIC Interfacing with GSM
Fig 3.8 GSM Interface Block Diagram
PIC MICROCONTROLLER MAX232
GSM MODEM
18
The 16F877A has a built in serial port that makes it very easy to
communicate with the PC's serial port but the 16F877A outputs are 0 and 5
volts and we need +10 and -10 volts to meet the RS232 serial port standard.
The easiest way to get these values is to use the MAX232. The MAX232
acts as a buffer driver for the processor. It accepts the standard digital logic
values of 0 and 5 volts and converts them to the RS232 standard of +10 and
-10 volts. It also helps protect the processor from possible damage from
static that may come from people handling the serial port connectors.
The MAX232 requires 5 external 1uF capacitors. The internal charge pump
to create +10 volts and -10 volts uses these.
The MAX232 is an electronic circuit that converts signals from a serial port
to signals suitable for usage in e.g. microprocessor circuits.
A standard serial interfacing for PC, RS232C, requires negative logic, i.e.,
logic '1' is -3V to -12V and logic '0' is +3V to +12V. To convert a TTL
logic, say, TxD and RxD pins of the uC chips, thus need a converter chip.
The MAX232 is a four-channel driver; it amplifies/lowers RX,TX, CTX and
RTS signals. The voltage discrepancy (up to +- 12 V from RS232 to 3.3V
TTL) is generated by capacitors (typically 10 nF. An MAX232 has a typical
threshold of 1.3 V, a typical hysteresis of 0.5 V, and can accept ±30-V
inputs. The MAX232 is a dual driver/receiver that includes a capacitive
voltage generator to supply TIA/EIA-232-F voltage levels from a single 5-V
supply. Each receiver converts TIA/EIA-232-F inputs to 5-V TTL/CMOS
levels. These receivers have a typical threshold of 1.3 V, a typical
hysteresiof 0.5 V, and can accept ±30-V inputs. Each driver converts
TTL/CMOS input levels into TIA/EIA-232-F levels
19
Fig 3.9 MAX232 Functional Diagram
• For the first capacitor, the negative leg goes to ground and the positive
leg goes to pin 16.
• For the second capacitor, the negative leg goes to 5 volts and the
positive leg goes to pin 2.
• For the third capacitor, the negative leg goes to pin 3 and the positive
leg goes to pin 1.
• For the fourth capacitor, the negative leg goes to pin 5 and the positive
leg goes to pin 4.
• For the fifth capacitor, the negative leg goes to pin 6 and the positive
leg goes to ground.
20
The MAX232 includes 2 receivers and 2 transmitters so two serial ports can
be used with a single chip. We will only use one transmitter for this project.
The only connection that must be made to the 2051 is one jumper from pin 3
of the 2051 to pin 11 of the MAX232.
To power the MAX232
• Connect pin 16 to 5 volts.
• Connect pin 15 to ground.
The only thing left is that we need some sort of connector to connect to the
serial port. The sample code below is written for Comm1 and most
computers use a 9-pin DB9 male connector for Comm1 so a 9 pin female
connector is included for this project. You may also want to buy a DB9
extension cable (Shown on order form as DB9 to DB9 cable) to make the
connection easier. There should be 3 wires soldered to the DB9 connector
pins 2, 3 and 5. Connect the wire from pin 5 of the connector to ground on
the breadboard. Connect the wire from pin 2 of the connector to pin 14 of
the MAX232.
The serial communications are used for transferring data over long distances,
because parallel communications requires too many wires. Serial data
received from a modem or other devices are converted to parallel so that it
can be transferred to the PC bus.
The serial communications equipment can be divided into simplex, half-
duplex and full duplex.
A simplex serial communication sends information only in one direction (i.e.
a commercial radio station).
21
Half-duplex means that data can be send in either direction between two
systems, but only in one direction at a time.
In a full-duplex transmission each system can send and receive data at the
same time.
There are two ways to transmit serial data: synchronously or
asynchronously. In a synchronous transmission data is sent in blocks, one or
more special characters called sync characters synchronize the transmitter
and the receiver.
The serial port of the PC is an asynchronous device, so we will describe this
kind of systems. For asynchronous transmission, a bit identifies its start and
1 or 2 bits identify its end, don't need any synchronization. The data bits are
sent to the receiver after the start bit. The least significant bit is transmitted
first. A data character usually consists of 7 or 8 bits. Depending on the
configuration of the transmission a parity bit is send after each data bit. It is
used to check errors in the data characters. Finally 1 or 2 stop bits are send.
3.6.5 RS-232 pin out DB-9 pin
Fig 3.10 PIN Connection and Block Diagram
22
PIN Signal Description:
1 PGND Protective Ground
2 TXD Transmit Data
3 RXD Receive Data
4 RTS Ready To Send
5 CTS Clear To Send
6 DSR Data Set Ready
7 SG Signal Ground
8 CD Carrier Detect
20 DTR Data Terminal Ready
22 RI Ring Indicators
3.6.6 RS-232 Interface
RS-232 (EIA Std.) Applicable to the 25 pin interconnection of Data
Terminal Equipment (DTE) and Data Communication Equipments (DCE)
using Serial Binary Data.
Fig 3.11 RS232 Interface Connection
23
Table 3.3 RS232 Pin Explanations
3.7 LCD DISPLAY In recent years the LCD is finding widespread use replacing LEDs (seven-
segment LEDs or other multi segment LEDs). This is due to the following
reasons
§ The declining prices of LCDs.
§ The ability to display numbers, characters, and graphics. This is
in contrast to LEDs, which are limited to numbers and a few
characters.
24
§ 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.
§ Ease of programming for characters and graphics.
3.7.1 LCD pin descriptions
The LCD discussed in this section has 16 pins. The function of each pin
Fig 3.12 LCD Pin Description
VCC, VSS, and VEE
While VCC and VSS provide +5V and ground, respectively, VEE is used for
controlling LCD contrast.
RS, Register Select
There are two very important registers inside the LCD. The RS pin is used
for their selection as follows. If RS=0, the instruction command code
register is selected, allowing the user to send a command such as clear
display, cursor at home, etc. If RS=1 the data register is selected, allowing
the user to send data to be displayed on the LCD.
25
R/W, Read/Write
R/W input allows the user to write information to the LCD or read
information from it. R/W=1 when reading; R/W=0 when writing.
E, Enable
The LCD to latch information presented to its data pins uses the enable pin.
When data is supplied to data pins, a high-to-low pulse must be applied to
this pin in order for the LCD to latch in the data present at the data pins. This
pulse must be a minimum of 450ns wide.
D0-D7
The 8-bit data pins, D0-D7, are used to send information to the LCD or read
the contents of the LCD’s internal registers.
To display letters and numbers, we send ASCII codes for the letters A-Z, a-
z, and numbers 0-9 to these pins while making RS=1.
There are also instruction command codes that can be sent to the LCD to
clear the display or force the cursor to the home position or blink the cursor. 3.8 POWER SUPPLY
A power supply provides a constant output regardless of voltage variations.
"Fixed" three-terminal linear regulators are commonly available to generate
fixed voltages of plus 3 V, and plus or minus 5 V, 9 V, 12 V, or 15 V when
the load is less than about 7 amperes.
The "78xx" series (7805, 7812, etc.) regulate positive voltages while the
"79xx" series (7905, 7912, etc.) regulate negative voltages. Often, the last
two digits of the device number are the output voltage; e.g., a 7805 is a +5 V
regulator, while a 7915 is a -15 V regulator. The 78xx series ICs can supply
up to 1.5 Amperes depending on the model.
26
3.8.1 Features
1. Output Current up to 1A
2. Output Voltages of 5, 6, 8, 9, 10, 12, 15, 18, 24
3. Thermal Overload Protection
4. Short Circuit Protection
5. Output Transistor Safe Operating Area Protection
When you have a requirement for a project of say 12V, or even 5V if it's a
digital project, then these are the types you use. 7805 or 7812 are the types.
There are of course negative voltage regulators with the numbers 79XX
which are substantially the same as those discussed here excepting they are
negative. We will not consider them further. Assume your project calls for a
basic fixed 12V D.C. to operate. Looking back to our earlier tutorial we
apply all the same principles. Look at the original schematic.
Fig 3.13 Basic power supply diagram
In a typical linear power supply, AC line voltage is first down-converted to a
smaller peak voltage using a transformer, which is then rectified using a full
wave bridge rectifier circuit. A capacitor filter is then used to smoothen the
27
obtained sinusoidal signal. The residual periodic variation or ripple in this
filtered signal is eliminated using an active regulator.
To obtain a DC power supply with both positive and negative output
voltages, a center-tapped transformer is used, where a third wire is attached
to the middle of the secondary winding and it is taken as the common
ground point. Then voltages from the opposite ends of the winding will be
positive or negative with respect to this point.
3.8.2 Summary of circuit features
Brief description of operation: Gives out well regulated +5V output, output
current capability of 100 mA
Circuit protection: Built-in overheating protection shuts down output when
regulator IC gets too hot
Circuit complexity: Very simple and easy to build
Circuit performance: Very stable +5V output voltage, reliable operation
Availability of components: Easy to get, uses only very common basic
components
Applications: Part of electronics devices, small laboratory power supply
Power supply voltage: Unregulated DC 8-18V power supply
Power supply current: Needed output current + 5 mA Component costs:
Few dollars for the electronics components + the input transformer cost
28
3.8.3 Circuit description
This circuit is a small +5V power supply, which is useful when
experimenting with digital electronics. Small inexpensive wall transformers
with variable output voltage are available from any electronics shop and
supermarket. Those transformers are easily available, but usually their
voltage regulation is very poor, which makes then not very usable for digital
circuit experimenter unless a better regulation can be achieved in some way.
The following circuit is the answer to the problem. This circuit can give +5V
output at about 150 mA current, but it can be increased to 1 A when good
cooling is added to 7805 regulator chip. The circuit has over overload and
terminal protection.
Fig 3.14 Circuit diagram of the power supply.
The capacitors must have enough high voltage rating to safely handle the
input voltage feed to circuit. The circuit is very easy to build for example
into a piece of Vero board.
29
Fig 3.15 Voltage Regulator Pin Diagram
Pin out of the 7805 regulator IC.
1. Unregulated voltage in
2. Ground
3. Regulated voltage out
3.8.4 Component list
7805 regulator IC
100 uF electrolytic capacitor, at least 25V voltage rating
10 uF electrolytic capacitor, at least 6V voltage rating
100 nF ceramic or polyester capacitor
7805 is a voltage regulator integrated circuit. It is a member of 78xx series
of fixed linear voltage regulator ICs. The voltage source in a circuit may
have fluctuations and would not give the fixed voltage output. The voltage
regulator IC maintains the output voltage at a constant value. The xx in 78xx
indicates the fixed output voltage it is designed to provide. 7805 provides
+5V regulated power supply. Capacitors of suitable values can be connected
at input and output pins depending upon the respective voltage levels.
30
3.8.5 Voltage Regulator Features
• Output Current up to 1A
• Output Voltages of 5, 6, 8, 9, 10, 12, 15, 18, 24V
• Thermal Overload Protection
• Short Circuit Protection
• Output Transistor Safe Operating Area Protection
3.9 BUZZER
A buzzer or beeper is a signaling device, usually electronic, typically used in
automobiles, household appliances such as a microwave oven, or game
shows.
It most commonly consists of a number of switches or sensors connected to
a control unit that determines if and which button was pushed or a preset
time has lapsed, and usually illuminates a light on the appropriate button or
control panel, and sounds a warning in the form of a continuous or
intermittent buzzing or beeping sound. Initially this device was based on an
electromechanical system, which was identical to an electric bell without the
metal gong (which makes the ringing noise). Often these units were
anchored to a wall or ceiling and used the ceiling or wall as a sounding
board. Another implementation with some AC-connected devices was to
implement a circuit to make the AC current into a noise loud enough to drive
a loudspeaker and hook this circuit up to a cheap 8-ohm speaker. Nowadays,
it is more popular to use a ceramic-based piezoelectric sounder which makes
31
a high-pitched tone. Usually these were hooked up to "driver" circuits,
which varied the pitch of the sound or pulsed the sound on and off.
Fig 3.16 Buzzer
In game shows it is also known as a "lockout system," because when one-
person signals ("buzzes in"), all others are locked out from signaling.
Several game shows have large buzzer buttons, which are identified as
"plungers”. The word "buzzer" comes from the rasping noise that buzzers
made when they were electromechanical devices, operated from stepped-
down AC line voltage at 50 or 60 cycles. Other sounds commonly used to
indicate that a button has been pressed are a ring or a beep.
3.10 RELAY
A relay is an electrically operated switch. Current flowing through the coil
of the relay creates a magnetic field, which attracts a lever and changes the
switch contacts. The coil current can be on or off so relays have two switch
positions and they are double throw (changeover) switches. Relays allow
one circuit to switch a second circuit, which can be completely separate from
32
the first. For example, a low voltage battery circuit can use a relay to switch
a 230V AC mains circuit. There is no electrical connection inside the relay
between the two circuits; the link is magnetic and mechanical.
The coil of a relay passes a relatively large current; typically 30mA for a
12V relay, but it can be as much as 100mA for relays designed to operate
from lower voltages. Most ICs (chips) cannot provide this current and a
transistor is usually used to amplify the small IC current to the larger value
required for the relay coil. The maximum output current for the popular 555
timer IC is 200mA so these devices can supply relay coils directly without
amplification.
Fig 3.17 Relay
Relays are usually SPDT or DPDT but they can have many more sets of
switch contacts, for example relays with 4 sets of changeover contacts are
readily available. Most relays are designed for PCB mounting but you can
solder wires directly to the pins providing you take care to avoid melting the
plastic case of the relay. The animated picture shows a working relay with
its coil and switch contacts. You can see a lever on the left being attracted by
magnetism when the coil is switched on. This lever moves the switch
33
contacts. There is one set of contacts (SPDT) in the foreground and another
behind them, making the relay DPDT.
Fig 3.18 Relay Working Diagram
The relay's switch connections are usually labeled COM, NC and NO:
• COM = Common, always connect to this; it is the moving part of the
switch.
• NC = Normally Closed, COM is connected to this when the relay coil
is off.
• NO = Normally Open, COM is connected to this when the relay coil
is on.
34
CHAPTER 4
SOFTWARE DESCRIPTIONS 4.1 DEVELOPMENT TOOLS
The Development Systems product categories are:
• Compilers
• Emulators
• In Circuit Debuggers
• MPLAB
4.1.1 Compiler
Compiler is a computer program (or set of programs) that translates text
written in a computer language (the source language) into another computer
language (the target language). The original sequence is usually called the
source code and the output called object code.
4.1.2 Emulator
Emulator is a device it has the ability of a computer program or electronic
device to imitate another program or device.
4.1.3 In Circuit Debugger
Microchip's in-circuit debugger for the flash PIC16F87x family only utilizes
the in-circuit Debugging capability of the PIC16F87X along with in-circuit
Serial Programming (ICSP) protocol to provide cost-effective in-circuit flash
programming and debugging from the graphical user interface of the
MPLAB
4.1.4 MPLAB IDE
MPLAB X IDE is a software program that is used to develop applications
for Microchip microcontrollers and digital signal controllers. This
development tool is called an Integrated Development Environment, or IDE,
because it provides a single integrated “environment” to develop code.
35
MPLAB IDE Development Tools:
MPLAB IDE integrates several tools to provide a complete development
environment.
MPLAB Project Manager
Use the Project Manager to create a project and work with the specific files
related to the project. When using a project, you can rebuild source code and
download it to the simulator or emulator with a single mouse Click.
MPLAB Editor
Use the MPLAB Editor to create and edit text files such as source files,
code, and linker script files.
MPLAB ICD In-Circuit Debugger
The MPLAB ICD In-Circuit Debugger is a powerful, low-cost development
and evaluation kit for many PICmicro MCU FLASH devices.
MPLAB SIM Simulator
The software simulator models the instruction execution and I/O of the
PICmicro MCUs.
MPLAB ICE 2000 In-Circuit Emulator
The MPLAB ICE 2000 emulator uses hardware to provide real-time
emulation of PICmicro MCUs, either with or without a target system.
MPASM Assembler/MPLINK Linker/MPLIB Librarian
The MPASM assembler allows source code to be assembled without leaving
MPLAB IDE. The MPLINK linker creates the final application by linking
reloadable modules from MPASM, MPLAB C17 and MPLAB C18 C
Compilers. The MPLIB librarian manages custom libraries for maximum
code reuse.
MPLAB CXX C Compilers
The MPLAB C17 and MPLAB C18 C Compilers provide ANSI-based high
level source code solutions. Complex projects can use a combination of C
36
and assembly source files to obtain the maximum benefits of speed and
maintainability.
PRO MATE II and PICSTART Plus Programmers
Develop code with the simulator or an emulator, assemble or compile it,
then use one of these tools to program devices. This can all be accomplished
with MPLAB IDE. Although the PRO MATE II programmer does not
require MPLAB IDE to operate, programming is easier using MPLAB IDE.
PICMASTER and PICMASTER CE Emulators
MPLAB IDE provides legacy support for the PICMASTER and
PICMASTER CE emulators.
Steps to create firmware for an embedded system using MPLAB
• Open the MPLAB 6.43 from the Startà Programsà Microchip
MPLAB
IDEàMPLAB IDE.
• Select Project Wizard from the Project menu. This wizard helps you
to create and configure a new MPLAB project. Click Next.
• Select a device. For example: PIC16F877A.
• Select a Language Tool suite. For example: Microchip MPASM Tool
suite.
• Name your project and select a project directory.
• Add any existing file to your project (optional).
• Click Finish to create a new project. A new Workspace will be created
and the new project added to that workspace.
• To write a source file for your project, select Fileà New option. A
new text editor is created for entering the assembly language or C
language code.
37
• After completion of entering the code, save it with the extension <file
name>.asm (for assembly language) or <file name>.c (for C
language).
• Add source code to your project by selecting Add Files to Project
option from the Project menu.
• Assemble or compile the project by choosing Build All option from
the Project menu.
• If you have written your program without errors you will get a
message Build Succeeded else build Failed along with errors and their
types. A hexadecimal file of your project is created with the extension
.hex
38
CHAPTER 5
APPENDIX
5.1 CODE
#include <16f877a.h>
#device PASS_STRINGS=IN_RAM ADC=10
#include <string.h>
#use delay( clock=11059200 )
#fuses NOWDT, HS, NOPROTECT, NOBROWNOUT, NOPUT, NOLVP
#use rs232(baud=9600, xmit=PIN_C6,rcv=PIN_C7,errors)
#zero_ram
#BYTE PORTB = 0X06
#BYTE TRISB = 0X86
#BIT RF_Receive1 = 0X06.0
#BIT RF_Receive2 = 0X06.1
#include"LCDO.h"
void Display();
char Data;
char tempData;
#INT_RDA
void Data_Received()
{
tempData=getc();
if(tempData=='@')
{
39
Data=getc();
}
if(Data=='1')
{
Data='\0';
tempData='\0';
Clr_Screen();
sprintf(LCD_DispData,"A1 Bus Reached: ");
LCD_Cmd(0X80);
LCDData_Write();
sprintf(LCD_DispData,"Gandhipuram ");
LCD_Cmd(0XC0);
LCDData_Write();
delay_ms(100);
fputs("AT+CMGDA=\"DEL ALL\"");
delay_ms(100);
fputs("AT+CMGDA=\"DEL ALL\"");
delay_ms(10000);
Display();
}
if(Data=='2')
{
Data='\0';
tempData='\0';
Clr_Screen();
sprintf(LCD_DispData,"A2 Bus Reached: ");
LCD_Cmd(0X80);
LCDData_Write();
40
sprintf(LCD_DispData,"Gandhipuram ");
LCD_Cmd(0XC0);
LCDData_Write();
delay_ms(100);
fputs("AT+CMGDA=\"DEL ALL\"");
delay_ms(100);
fputs("AT+CMGDA=\"DEL ALL\"");
delay_ms(10000);
Display();
}
}
void main()
{
TRISB=0XFF;
LCD_Initialization();
Display();
delay_ms(5000);
fputs("AT");
delay_ms(1000);
fputs("AT+CMGF=1");
delay_ms(1000);
fputs("ATE0");
delay_ms(1000);
fputs("AT+CNMI=1,2,0,0,0");
delay_ms(1000);
41
fputs("AT+CMGR=1");
delay_ms(1000);
fputs("AT+CMGDA=\"DEL ALL\"");
delay_ms(100);
fputs("AT+CMGDA=\"DEL ALL\"");
delay_ms(1000);
enable_interrupts(GLOBAL);
enable_interrupts(INT_RDA);
while(TRUE)
{
if(RF_Receive1==1)
{
puts("AT+CMGS=\"9750749800\""); //9750749800 //9965448580
putc(0X0D);
delay_ms(500);
puts("@1");
delay_ms(500);
putc(0X1A);
delay_ms(100);
}
if(RF_Receive2==1)
{
puts("AT+CMGS=\"9750749800\"");
putc(0X0D);
delay_ms(500);
42
puts("@2");
delay_ms(500);
putc(0X1A);
delay_ms(100);
}
}
}
void Display()
{
Clr_Screen();
sprintf(LCD_DispData," Bus ");
LCD_Cmd(0X80);
LCDData_Write();
sprintf(LCD_DispData," Monitoring ");
LCD_Cmd(0XC0);
LCDData_Write();
delay_ms(100);
}
43
CHAPTER 6
RESULTS 6.1 RF TRANSMITTER SECTION When the bus approaches the bus stop, a unique number assigned to it is sent to the same through RF Transmitter
Fig 6.1 RF Transmitter Section
6.2 RF RECEIVER AND GSM SECTION
RF Receiver receives the RF signal, PIC Microcontroller decodes the signal
and process for corresponding bus information and then the details of bus
are sent to other selected bus stops through GSM modem.
44
Fig 6.2 RF Receiver and GSM Section
6.3 LCD OUTPUT
The bus details are shown at other bus stops using LCD
Fig 6.3 LCD Output
45
CHAPTER 7
ADVANTAGES
• Use of GSM technology as compared to other existing techniques
used for tracking makes it more cost efficient and innovative
• Use of GSM technology allows tracking in high density urban areas
• Low cost system opens up a new segment of the market
• Real time monitoring
46
CHAPTER 8
CONCLUSION
The key feature of this system is its relatively simple mode of
communication. The tracking of different local buses can be done easily
using this system. The project involves the use of GSM and RF technology,
which is used to send and receive information for locating vehicles. The use
of GSM technology as compared to other existing techniques used for
tracking makes it more cost efficient and innovative. Our system design has
an open architecture that can be easily expanded to other applications. This
system can be easily extended for central tracking system to keep track of all
the public vehicles. Thus, the proposed system is beneficial for both
passengers and the bus operators.
47
CHAPTER 9
REFERENCES
[1] . Asaad M. J. Al-Hindawi, Ibraheem Talib, “Experimentally
Evaluation of GPS/GSM Based System Design”, Journal of Electronic
Systems, Volume 2 Number, 2 June, 2012.
[2] . Kane, L., Verma, B., Jain, S., “Vehicle tracking in public transport
domain and associated spatio-temporal query processing”, Elsevier:
Computer Communications, v.31 n.12, p.2862-2869 (2008) .
[3] . Oberli, C et al (2010). “Performance Evaluation of UHF RFID
technologies for Real Time passenger Recognition in Intelligent
Public transportation systems”, IEEE Transactions on Intelligent
Transport Systems, Vol.11(3), pp.748-753.
[4] . PIC Microcontroller-http:// www.microchip.com/PIC/16F877A
[5] . GSM -Wikipedia, the free encyclopedia
(http://en.wikipedia.org/wiki/GSM)
[6] . Basics Reference- www.electronicsgarage.com