main documentation
TRANSCRIPT
1.1 INTRODUCTION
Embedded systems are designed to do some specific tasks, rather than be a general
purpose computer for multiple tasks. Some also have real time performance
constraints that must be met, for reasons such as safety and usability, others may have
low or no performance requirements, allowing the system hardware to be specified to
reduce the cost.
With the growing use of computers the quality of our lives and even
the whole society are dramatically changed. Owing to the rapidly increasing ability of
computers to process information, we are going to presented with computer-based
world. For able-bodies people, access to computers can be taken for granted because
conventional computer interfaces (e.g. a keyboard and a mouse) are designed with the
able bodies in mind. Unfortunately, people with physical disabilities cannot enjoy the
benefits provided by computers on equal term. Therefore, how to lower or even tear
down the barriers between computers and users with disabilities is a very demanding
task. Users with disabilities should be able to equally access standard computers and
applications. We propose an accelerometer-based mouse which allows the user to use
head movements to access computers.
1
Human interacting section:
Computer Application Interface section:
Fig: 1.1 BLOCK DIAGRAM\
2
Microcontroller Unit
Eye Blink sensorSignal
conditioning section
3-axis MEMS Accelerometer
Encoder Device
WirelessTransmitter
1.2 AIM OF THE PROJECT
The aim of the project is to design a system of human computer mouse interface using
mems technology for physically challenged people.
1.3 METHODOLOGY
We use mems technology that keeps control of the whole system of human
computer mouse interface. The system uses accelerometers to detect the user's head
tilt in order to direct mouse movement on the monitor. The clicking of the mouse is
activated by the user's eye blinking through an IR sensor. The keyboard function is
implemented by allowing the user to scroll through letters with head tilt and with eye
blinking as the selection mechanism.
1.3.1 HARDWARE REQUIREMENTS
1. PIC micro-controller
2. 3-axis accelerometer
3. Encoder and Decoder
4. IR sensor
5. Wireless transmitter and receiver
6. Microphone
7. RS-232 cable
1.3.2 SOFTWARE REQUIREMENTS
1. Compiler (MP Lab)
2. Design Tools (Orcad)
3. Languages: Visual Basic and Embedded C
3
1.4 SIGNIFICANCE OF WORK
To lower or tear down the barriers between computers and users with disabilities is a
very demanding task. We have chosen mems technology because of its various
advantages such as low power consumption and low noise. We constructed an
interface system that would allow a similarly paralyzed user to interact with a
computer with almost full functional capability. That is, the system operates as a
mouse initially, but the user has the ability to toggle in and out of a keyboard mode
allowing the entry of text, and using blinking as an input. We built an accelerometer
based tilt detector to determine head motion.
1.5 ORGANISATION OF THE REPORT
Chapter 1 deals with the introduction of the project
Chapter 2 deals with the description of the hardware components used in our project
Chapter 3 deals with the description of the circuit employed
Chapter 4 gives the Final Result and Conclusion
4
2.1 INTRODUCTION
In this chapter, all the hardware components that are used including the
microcontroller are explained elaborately. All the specifications and the internal
circuitry of the microcontroller including the functional features are explained in
detail so that the coding can be done accordingly.
2.2 MICRO-CONTROLLER ( PIC16F877A)
The PIC16F877A CMOS FLASH-based 8-bit microcontroller is upward compatible
with the PIC16C5x, PIC12Cxxx and PIC16C7x devices. It features 200 ns instruction
execution, 256 bytes of EEPROM data memory, self programming, an ICD, 2
Comparators, 8 channels of 10-bit Analog-to-Digital (A/D) converter, 2
capture/compare/PWM functions, a synchronous serial port that can be configured as
either 3-wire SPI or 2-wire I2C bus, a USART, and a Parallel Slave Port.
• PIC16F877A microcontroller is used for this project
• It is 8-bit Microcontroller
• System is RISC Architecture
• It has Small set of Instruction set
• It has 35-Instructions only
• Compatibility: avail 28/40 Pin ICs
• Operating Speed Max 20 MHz, Voltage-(2-5.5)v
• Memory:
Flash Program 8Kx14Words
RAM 368Bytes
EEPROM Data Memory 256Bytes
• Low power, High speed Flash/EEPROM Technology
2.2.1 FEATURES
1. It has 5 Ports for Internal and External usage
2. It has on chip Timers. 3 Timers are avail
3. It has in built Analog to Digital Converter
4. In built Multiplexer availability for signal Selection
5
5. It has serial as well as Parallel Communication facilities
6. In built Capture, Compare and Pulse width modulation
7. Lead-free; RoHS-compliant
8. Operating speed: 20 MHz, 200 ns instruction cycle
9. Operating voltage: 4.0-5.5V
10. Industrial temperature range (-40° to +85°C)
11. 15 Interrupt Sources
12. 35 single-word instructions
13. All single-cycle instructions except for program branches (two-cycle)
2.2.2PINDIAGRAM
FIG 2.1 PIN DIAGRAM OF PIC16F877A
6
2.2.3BLOCKDIAGRAM
V D D
M C L R
R XTX
R A 0
R B 7R B 6R B 5R B 4R B 3R B 2R B 1R B 0
R D 7R D 6R D 5R D 4R D 3R D 2R D 1R D 0
R C 2R C 3R C 4R C 5R C 6R C 7
R E 2R E 1R E 0R A 5R A 4R A 3R A 2R A 1
R C 0R C 1
R A 0
C 92 7 p F
C 82 7 p F
C 1 00 . 1 u F
P I C 1 6 F 8 7 7U 3
123456
11
32
12
31
789
1 0
1 31 4
1 51 61 71 8
1 92 0
3 33 43 53 63 73 83 94 0
2 82 93 0
2 12 2
2 42 52 6
2 7
2 3
M C L R / V p pR A 0 / A N 0R A 1 / A N 1R A 2 / A N 2 / V re f -R A 3 / A N 3 / V re f +R A 4 / T0 C K I
VD
D
VD
D
VS
S
VS
S
R A 5 / A N 4 / S SR E 0 / A N 5 / R DR E 1 / A N 6 / W RR E 2 / A N 7 / C S
O S C 1 / C L K I NO S C 2 / C L K O U T
R C 0 / T1 O S O / T1 C K IR C 1 / T1 O S I / C C P 2R C 2 / C C P 1R C 3 / S C K / S C L
R D 0 / P S P 0R D 1 / P S P 1
R B 0 / I N TR B 1R B 2
R B 3 / P G MR B 4R B 5
R B 6 / P G CR B 7 / P G D
R D 5 / P S P 5R D 6 / P S P 6R D 7 / P S P 7
R D 2 / P S P 2R D 3 / P S P 3
R C 5 / S D OR C 6 / TX/ C KR C 7 / R X/ D T
R D 4 / P S P 4
R C 4 / S D I / S D A
Y 1
4 M h z
R 61 k
R 52 2 0 o h m
S W 2
R E S E T
FIG: 2.2 BLOCK DIAGRAM OF CONTROLLER
2.3 3-AXIS MEMS ACCELEROMETER
The MMA7260QT low cost capacitive micro machined accelerometer features
signal conditioning, a 1-pole low pass filter, temperature compensation and g-Select
which allows for the selection among 4 sensitivities. Zero-g offset full scale span and
filter cut-off are factory set and require no external devices. Includes a Sleep Mode
that makes it ideal for handheld battery powered electronics. An accelerometer
measures proper acceleration, which is the acceleration it experiences relative to
freefall, and is the acceleration that is felt by people and objects. Such accelerations
are popularly measured in terms of g-force.
2.3.1 FEATURES
1. Selectable Sensitivity (1.5g/2g/4g/6g)
2. Low Current Consumption: 500 µA
3. Sleep Mode: 3µ A
4. Low Voltage Operation: 2.2 V – 3.6 V
5. 6mm x 6mm x 1.45mm QFN
6. High Sensitivity (800 mV/g @ 1.5g)
7. Fast Turn On Time7
8. Integral Signal Conditioning with Low Pass Filter
9. Robust Design, High Shocks Survivability
10. Pb-Free Terminations
11. Environmentally Preferred Package
12. Low Cost
2.3.2 BLOCK DIAGRAM
FIG 2.3 BLOCK DIAGRAM OF 3-AXIS ACCELEROMETER
2.3.3PRINCIPLE OF OPERATION
The Free scale accelerometer is a surface-micro machined integrated-
circuit accelerometer. The device consists of two surface micro machined capacitive
sensing cells (g-cell) and a signal conditioning ASIC contained in a single integrated
circuit package. The sensing elements are sealed hermetically at the wafer level using
a bulk micro machined cap wafer. The g-cell is a mechanical structure formed from
semiconductor materials (polysilicon) using semiconductor processes (masking and
etching). It can be modeled as a setoff beams attached to a movable central mass that
move between fixed beams.
The movable beams can be deflected from their rest position by
subjecting the system to an acceleration ( as in Figure).As the beams attached to the
central mass move, the distance from them to the fixed beams on one side will
increase by the same amount that the distance to the fixed beams on the other side
decreases. The g-cell beams form two back-to-back capacitors ( as in Figure). As the
center beam moves with acceleration, the distance between the beams changes and 8
each capacitor’s value will change, (C = Aε/D). Where At the area of the beam, å is
the dielectric constant and D is the distance between the beams.. The ASIC also signal
conditions and filters (switched capacitor) the signal, providing a high level output
voltage that is ratio metric and proportional to acceleration.
FIG 2.4 WORKING OF ACCELEROMETER
2.3.4 SPECIAL FEATURES
g-Select
The g-Select feature allows for the selection among 4 sensitivities present in the
device. Depending on the logic input placed on pins 1 and 2, the device internal gain
will be changed allowing it to function with a 1.5g, 2g, 4g, or 6gsensitivity .This
feature is ideal when a product has applications requiring different sensitivities for
optimum performance. The g-Select1 andg-Select2 pins can be left unconnected for
applications requiring only a 1.5g sensitivity as the device has an internal pull-down
to keep it at that sensitivity (800mV/g).
9
g-Select2 g-Select1 g-Range Sensitivity
0 0 1.5 g 800mv/g
1 1 2g 600mv/g
1 0 4g 300mv/g
1 1 6g 200mv/g
TABLE 2.1 SENSITIVITY VALUES OF ACCELEROMETER
2.3.5 TYPICAL APPLICATIONS
1. HDD MP3 Player: Freefall Detection
2. Cell Phone: Image Stability, Text Scroll, Motion Dialing, E-Compass
3. Pedometer: Motion Sensing
4. Navigation and Dead Reckoning: E-Compass Tilt Compensation
5. Gaming: Tilt and Motion Sensing, Event Recorder
6. Robotics: Motion Sensing
2.4EYE BLINK SENSOR
10
FIG 2.5 EYE BLINK SENSOR
This switch is activated when the user blinks their eye. It allows individuals to operate
electronic equipment like communication aids and environmental controls hands-free.
Each blink of the eye is detected by an infrared sensor, which is mounted on dummy
spectacle frames.The eye blink switch can be set up to operate on either eye and may
be worn over normal glasses. The sensitivity of the switch can be adjusted to the users
needs and involuntary blinks are ignored. The sensor is connected to a hand-held
control unit with a rechargeable battery
2.4.1 IR SENSOR
• IR LED at 900nm
-GaAlAs Infrared Light Emitting Diode
-Shines invisible IR light on the user’s eye
• IR 900nm sensor
-Light Detector
-Detects reflected IR light
we decided to use blinking as we wanted the device to be functional for
non-vocal or ventilated users (blowing or sucking was another option). Our first idea,
and the one we implemented, was to use a led/photodiode pair to reflect light off the
eye. We found that Optek Inc. makes a round receiver, consisting of a LED and a
phototransistor mounted on the same unit. This detected a strong increase in signal 11
upon blinking. We were worried about detecting the difference between normal and
intentional blinks, but we found that for most users the intentional blinks produced a
much stronger signal, and they were always much longer the ~300ms normal blink
duration.
2.5 SIGNAL CONDITIONER
A signal conditioner is a device that converts one type of electronic signal into a
another type of signal. Its primary use is to convert a signal that may be difficult to
read by conventional instrumentation into a more easily read format. In performing
this conversion a number of functions may take place. They include:
Amplification
When a signal is amplified, the overall magnitude of the signal is increased.
Converting a 0-10mV signal to a 0 -10V signal is an example of amplification.
Electrical Isolation
Electrical isolation breaks the galvanic path between the input and output signal. That
is, there is no physical wiring between the input and output. The input is normally
tranferred to the output by converting it to an optical or magnetic signal then it is
reconstructed on the output. By breaking the galvanic path between input and output,
unwanted signals on the input line are prevented from passing through to the output.
Isolation is required when a measurement must be made on a surface with a voltage
potential far above ground. Isolation is also used to prevent ground loops.
Linearization
Converting a non-linear input signal to a linear output signal. This is common for
thermocouple signals.
Excitation
Many sensors require some form of excitation for them to operate. Strain gages and
RTDs are two common examples.
The signal conditioning unit accepts input signals from the analog
sensors and gives a conditioned output of 0-5V DC corresponding to the entire range
of each parameter. This unit also accepts the digital sensor inputs and gives outputs in
10 bit binary with a positive logic level of +5V. The calibration voltages* (0, 2.5 and
5V) and the health bits are also generated in this unit. The unit is powered through
DCSTS unit.
12
The DCSTS unit controls the entire operation of a DCP field station. It consists of
power supply regulator, timing generator, control logic circuit, multiplexer-cum-
A/D converter, health monitor circuit, memory, pseudo-random burst sequence
generator and a UHF transmitter. It operates on +12V uninterrupted power. The
hourly sequence of operations performed by DCSTS is as given below:
a. Provides +12V switched power to signal conditioner 3 minutes and 30 sec
prior to full hour.
b. Converts the calibration voltages and sensor data (outputs of signal
conditioner) into digital form and stores in memory.
c. Generates one pseudo random burst command in each three minutes 3-sub-slot
during the allotted ten minutes transmission window of a particular AWS, to enable
the random transmission of stored data three times. These data along with station
identification code, start and end signals are transmitted to INSAT / Kalpana at
carrier frequency 402.75 MHz @4800 bits/second
2.6 ENCODER -HT12E
2.6.1 BLOCK DIAGRAM
FIG 2.6 ENCODER BLOCK DIAGRAM
13
2.6.2 FEATURES
1. Low power and high noise immunity CMOS technology
2. Operating voltage – 2.4V to 12V
3. Low standby current 0.1µA (typ.) at VDD=5V.
4. Minimal external components.
5. 18 pin DIP or 20pin SOP package.
6. Pair with Holtek’s 212 series of decoders.
7. Built in oscillator needs only 5% resister.
FIG 2.7 ENCODER PIN DIAGRAM
2.6.3 PIN DESCRIPTION
A0 – A7 Input pins for address A0-A7 setting.
AD8 – AD11input pins for address/data setting.
DOUT Encoder data serial transmission output.
L/M Latch/Momentary transmission format Latch – floating or VDD Momentary –
Vss
TE (active low) Transmission Enable.
OSC1 oscillator input pin.
OSC2 oscillator output pin.
VSS Negative power supply, Ground.
VDD Positive power supply.
2.6.4 ENCODER DESCRIPTION
For proper operation, a pair of encoder/decoder with the same number of addresses
and data format should be chosen. The decoders receive serial addresses and data
14
from a programmed 2 12 series of encoders that are transmitted by a carrier using an
RF or an IR transmission medium. They compare the serial input data three times
continuously with their local addresses. If no error or unmatched codes are found, 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 212 series of decoders are capable of
decoding information that consist of N bits of address and 12_N bits of data. Of this
series, the HT12D is arranged to provide 8 address bits and 4 data bits, and HT12F is
used to decode 12 bits of address information.
2.6.5 APPLICATIONS
1. Burglar alarm system.
2. Smoke and fire alarm system.
3. Car door controllers.
4. Cordless telephones.
2.7 DECODER-HT12D
2.7.1 FEATURES
1. Low power and high noise immunity CMOS technology
2. Operating voltage – 2.4V to 12V
3. Low standby current.
4. Minimal external components.
5. Capable of decoding 12 bits of information.
6. Binary address setting.
7. Valid transmission indicator.
8. Easy interface with an RF and infrared transmission medium.
9. 18 pin DIP or 20pin SOP package.
10. Pair with Holtek’s 212 series of encoders.
11. Built in oscillator needs only 5% resistor
15
FIG 2.8 DECODER PIN DIAGRAM
2.7.2 PIN DESCRIPTION
A0 – A7 Input pins for address setting.
D8 – D11 Output data pins, power on status is low.
DIN Serial data input pin.
OSC1 Oscillator input pin.
OSC2 Oscillator output pin.
VSS Negative power supply, ground.
VDD Positive power supply.
2.7.3 APPLICATIONS
1. Smoke and fire alarm system.
2. Car door controllers.
3. Cordless telephones.
4. Burglar alarm
2.7.4 GENERAL ENCODER AND DECODER OPERATIONS
The Holtek HT-12E IC encodes 12-bits of information and serially transmits
this data on receipt of a Transmit Enable, or a LOW signal on pin-14 /TE. Pin-17 the
D_OUT pin of the HT-12E serially transmits whatever data is available on pins
10,11,12 and 13, or D0,D1,D2 and D3. Data is transmitted at a frequency selected by
the external oscillator resistor. Note that if we use anything other than 5V on both
encoder/decoder circuits, we will need to change these oscillator resistor values.By
using the switches attached to the data pins on the HT-12E, as shown in the
schematic, we can select the information in binary format to send to the receiver. The
16
receiver section consists of the HT-12D decoder IC. The DATA_IN pin-14 of the HT-
12D reads the 12-bit binary information sent by the HT-12E and then places this data
on its output pins. Pins 10,11,12 and 13 are the data out pins of the HT-12D,
D0,D1,D2 and D3.
The HT-12D receives the 12-bit word and interprets the first 8-bits as address
and the last 4-bits as data. Pins 1-8 of the HT-12E are the address pins. Using the
address pins of the HT-12E, we can select different addresses for up to 256 receivers.
The address is determined by setting pins 1-8 on the HT-12E to ground, or just
leaving them open. The address selected on the HT-12E circuit must match the
address selected on the HT-12D circuit (exactly), or the information will be ignored
by the receiving circuit
2.8. RF MODULE (Radio Frequency)
Radio Frequency, is the frequency within the electromagnetic spectrum associated
with radio wave propagation. When an RF current is supplied to an antenna, an
electromagnetic field is created that then is able to propagate through space. Many
wireless technologies are based on RF field propagation.
FIG 2.9 Receiver Module FIG 2.10 Transmitter
Module
Radio Frequency. The 10 kHz to 300 GHz frequency range that can be used for
wireless communication
Radio Frequency. Also used generally to refer to the radio signal generated by the
system transmitter, or to energy present from other sources that may be picked up by a
wireless receiver.
Wireless mouse, keyboard
Wireless data communication
Alarm and security systems
17
Home Automation, Remote control
Automotive Telemetry
Intelligent sports equipment
Handheld terminals, Data loggers
Industrial telemetry and tele-communications
In-building environmental monitoring and control
High-end security and fire alarms
2.8.1 - TRANSMITTER
The TWS-434 extremely small, and are 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.
FIG 2.11 TRANSMITTER MODULE
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 1/3 the size of a standard postage stamp.
18
FIG 2.12 TWS-434 PIN DIAGRAM
FIG 2.13 - Transmitter Application Circuit
2.8.2- RECEIVER
RWS-434: The receiver also operates at 433.92MHz, and has a sensitivity of 3uV.
The WS-434 receiver operates from 4.5 to 5.5 volts-DC, and has both linear and
digital outputs.
19
FIG 2.14 PIN DIAGRAM OF RECEIVER MODULE
2.8.3 - TRANSMIT AND RECEIVE DATA
The TWS-434 modules do not incorporate internal encoding. If you want to send
simple control or status signals such as button presses or switch colsures, consider
using an encoder and decoder IC set that takes care of all encoding, error checking,
and decoding functions. These chips are made by Motorola and Holtek. They are an
excellent way to implement basic wireless transmission control.
2.8.4 RECEIVER DATA OUTPUT
A 0 volt to Vcc data output is available on pins. This output is normally used to drive
a digital decoder IC or a microprocessor which is performing the data decoding. The
receiver’s output will only transition when valid data is present. In instances when no
carrier is present the output will remain low
2.8.5 DECODING DATA
The RWS-434 modules do not incorporate internal decoding. If you want to receive
Simple control or status signals such as button presses or switch colsures, you can use
the encoder and decoder IC set described above. Decoders with momentary and
latched outputs are available.
2.8.6- TRANSMITTING AND RECEIVING
Full duplex or simultaneous two-way operation is not possible with these modules.
If a transmit and receive module are in close proximity and data is sent to a
remote receive module while attempting to simultaneously receive data from a
remote transmit module, the receiver will be overloaded by its close proximity
transmitter. This will happen even if encoders and decoders are used with
20
different address settings for each transmitter and receiver pair. If two way
communication is required, only half duplex operation is allowed.
2.9 INTRODUCTION TO RS232 SERIAL COMMUNICATION
Serial communication is basically the transmission or reception of data one bit at a
time. Today's computers generally address data in bytes or some multiple thereof. A
byte contains 8 bits. A bit is basically either a logical 1 or zero. Every character on this
page is actually expressed internally as one byte. The serial port is used to convert each
byte to a stream of ones and zeroes as well as to convert a streams of ones and zeroes
to bytes. The serial port contains a electronic chip called a Universal Asynchronous
Receiver/Transmitter (UART) that actually does the conversion.
The serial port has many pins. We will discuss the transmit and receive pin first.
Electrically speaking, whenever the serial port sends a logical one (1) a negative
voltage is effected on the transmit pin. Whenever the serial port sends a logical zero (0)
a positive voltage is effected. When no data is being sent, the serial port's transmit pin's
voltage is negative (1) and is said to be in a MARK state. Note that the serial port can
also be forced to keep the transmit pin at a positive voltage (0) and is said to be the
SPACE or BREAK state. (The terms MARK and SPACE are also used to simply
denote a negative voltage (1) or a positive voltage(0) at the transmit pin respectively)
When transmitting a byte, the UART (serial port) first sends a START BIT which is a
positive voltage (0), followed by the data (general 8 bits, but could be 5, 6, 7, or 8 bits)
followed by one or two STOP BITs which is a negative(1) voltage. The sequence is
repeated for each byte sent. Figure 1 shows a diagram of a what a byte transmission
would look like.
At this point you may want to know what is the duration of a bit. In other words, how
long does the signal stay in a particular state to define a bit. The answer is simple. It is
dependent on the baud rate. The baud rate is the number of times the signal can switch
states in one second. Therefore, if the line is operating at 9600 baud, the line can
switch states 9,600 times per second. This means each bit has the duration of 1/9600 of
21
a second or about 100 µsec.
When transmitting a character there are other characteristics other than the baud rate
that must be known or that must be setup. These characteristics define the entire
interpretation of the data stream.The first characteristic is the length of the byte that
will be transmitted. This length in general can be anywhere from 5 to 8 bits.
The second characteristic is parity. The parity characteristic can be even, odd, mark,
space, or none. If even parity, then the last data bit transmitted will be a logical 1 if the
data transmitted had an even amount of 0 bits. If odd parity, then the last data bit
transmitted will be a logical 1 if the data transmitted had an odd amount of 0 bits. If
MARK parity, then the last transmitted data bit will always be a logical 1. If SPACE
parity, then the last transmitted data bit will always be a logical 0. If no parity then
there is no parity bit transmitted.The third characteristic is the amount of stop bits. This
value in general is 1 or 2.Assume we want to send the letter 'A' over the serial port. The
binary representation of the letter 'A' is 01000001. Remembering that bits are
transmitted from least significant bit (LSB) to most significant bit (MSB), the bit
stream transmitted would be as follows for the line characteristics 8 bits, no parity, 1
stop bit, 9600 baud
LSB (0 1 0 0 0 0 0 1 0 1) MSB
The above represents (Start Bit) (Data Bits) (Stop Bit)
To calculate the actual byte transfer rate simply divide the baud rate by the number of
bits that must be transferred for each byte of data. In the case of the above example,
each character requires 10 bits to be transmitted for each character. As such, at 9600
baud, up to 960 bytes can be transferred in one second.The above discussion was
concerned with the "electrical/logical" characteristics of the data stream. We will
expand the discussion to line protocol.
Serial communication can be half duplex or full duplex. Full duplex communication
means that a device can receive and transmit data at the same time. Half duplex means
that the device cannot send and receive at the same time. It can do them both, but not at
the same time. Half duplex communication is all but outdated except for a very small
focused set of applications.
22
Half duplex serial communication needs at a minimum two wires, signal ground and
the data line. Full duplex serial communication needs at a minimum three wires, signal
ground, transmit data line, and receive data line. The RS232 specification governs the
physical and electrical characteristics of serial communications. This specification
defines several additional signals that are asserted (set to logical 1) for information and
control beyond the data signals and signal ground.
These signals are the Carrier Detect Signal (CD), asserted by modems to
signal a successful connection to another modem, Ring Indicator (RI), asserted by
modems to signal the phone ringing, Data Set Ready (DSR), asserted by modems to
show their presence, Clear To Send (CTS), asserted by modems if they can receive
data, Data Terminal Ready (DTR), asserted by terminals to show their presence,
Request To Send (RTS), asserted by terminals if they can receive data. The section
RS232 Cabling describes these signals and how they are connected.
The above paragraph eluded to hardware flow control. Hardware flow
control is a method that two connected devices use to tell each other electronically
when to send or when not to send data. A modem in general drops (logical 0) its CTS
line when it can no longer receive characters. It re-asserts it when it can receive again.
A terminal does the same thing instead with the RTS signal. Another method of
hardware flow control in practice is to perform the same procedure in the previous
paragraph except that the DSR and DTR signals are used for the handshake.
Note that hardware flow control requires the use of additional wires. The
benefit to this however is crisp and reliable flow control. Another method of flow
control used is known as software flow control. This method requires a simple 3 wire
serial communication link, transmit data, receive data, and signal ground. If using this
method, when a device can no longer receive, it will transmit a character that the two
devices agreed on. This character is known as the XOFF character. This character is
generally a hexadecimal 13. When a device can receive again it transmits an XON
character that both devices agreed to. This character is generally a hexadecimal 11.
2.9.1NULL MODEM, AN INTRODUCTION
23
Serial communications with RS232. One of the oldest and most widely spread
communication methods in computer world. The way this type of communication can
be performed is pretty well defined in standards. I.e. with one exception. The standards
show the use of DTE/DCE communication, the way a computer should communicate
with a peripheral device like a modem. For your information, DTE means data
terminal equipment (computers etc.) where DCE is the abbreviation of data
communication equipment (modems). One of the main uses of serial communication
today where no modem is involved—a serial null modem configuration with
DTE/DTE communication—is not so well defined, especially when it comes to flow
control. The terminology null modem for the situation where two computers
communicate directly is so often used nowadays, that most people don't realize
anymore the origin of the phrase and that a null modem connection is an exception, not
the rule.
In history, practical solutions were developed to let two computers talk
with each other using a null modem serial communication line. In most situations, the
original modem signal lines are reused to perform some sort of handshaking.
Handshaking can increase the maximum allowed communication speed because it
gives the computers the ability to control the flow of information. High amounts of
incomming data is allowed if the computer is capable to handle it, but not if it is busy
performing other tasks. If no flow control is implemented in the null modem
connection, communication is only possible at speeds at which it is sure the receiving
side can handle the amount information even under worst case conditions.
2.9.2 ORIGINAL USE OF RS232
When we look at the connector pinout of the RS232 port, we see two pins which are
certainly used for flow control. These two pins are RTS, request to send and CTS, clear
to send. With DTE/DCE communication (i.e. a computer communicating with a
modem device) RTS is an output on the DTE and input on the DCE. CTS is the
answering signal comming from the DCE.
Before sending a character, the DTE asks permission by setting its RTS output. No
information will be sent until the DCE grants permission by using the CTS line. If the
DCE cannot handle new requests, the CTS signal will go low. A simple but useful
mechanism allowing flow control in one direction. The assumption is, that the DTE
can always handle incomming information faster than the DCE can send it. In the past,
24
this was true. Modem speeds of 300 baud were common and 1200 baud was seen as a
high speed connection.
For further control of the information flow, both devices have the ability to signal their
status to the other side. For this purpose, the DTR data terminal ready and DSR data
set ready signals are present. The DTE uses the DTR signal to signal that it is ready to
accept information, whereas the DCE uses the DSR signal for the same purpose. Using
these signals involves not a small protocol of requesting and answering as with the
RTS/CTS handshaking. These signals are in one direction only. The last flow control
signal present in DTE/DCE communication is the CD carrier detect. It is not used
directly for flow control, but mainly an indication of the ability of the modem device to
communicate with its counter part. This signal indicates the existence of a
communication link between two modem devices.
2.9.3 Null modem without handshaking
How to use the handshaking lines in a null modem configuration? The simplest way is
to don't use them at all. In that situation, only the data lines and signal ground are cross
connected in the null modem communication cable. All other pins have no connection.
An example of such a null modem cable without handshaking can be seen in the figure
below.
Connector 1 Connector 2 Function
2 3 Rx Tx
3 2 Tx Rx
5 5 Signal ground
FIG 2.15 Simple null modem without handshaking
25
2.9.4 COMPATIBILITY ISSSUES
If you read about null modems, this three wire null modem cable is often talked about.
Yes, it is simple but can we use it in all circumstances? There is a problem, if either of
the two devices checks the DSR or CD inputs. These signals normaly define the ability
of the other side to communicate. As they are not connected, their signal level will
never go high. This might cause a problem.
The same holds for the RTS/CTS handshaking sequence. If the software on both sides
is well structured, the RTS output is set high and then a waiting cycle is started until a
ready signal is received on the CTS line. This causes the software to hang because no
physical connection is present to either CTS line to make this possible. The only type
of communication which is allowed on such a null modem line is data-only traffic on
the cross connected Rx/Tx lines.
This does however not mean, that this null modem cable is useless. Communication
links like present in the Norton Commander program can use this null modem cable.
This null modem cable can also be used when communicating with devices which do
not have modem control signals like electronic measuring equipment etc. As you can
imagine, with this simple null modem cable no hardware flow control can be
implemented. The only way to perform flow control is with software flow control
using the XOFF and XON characters.
2.10 MAX 232
2.10.1 INTRODUCTION
MAX-232 is primary used for people building electronics with an RS-232 interface.
Serial RS-232 communication works with voltages (-15V ... -3V for high) and +3V ...
+15V for low) which are not compatible with normal computer logic voltages. To
receive serial data from an RS-232 interface the voltage has to be reduced, and the low
and high voltage level inverted. In the other direction (sending data from some logic
over RS-232) the low logic voltage has to be "bumped up", and a negative voltage has
to be generated, too.
26
2.10.2 PINDIAGRAM
FIG 2.16 Pin Diagram Of Max 232
27
RS232 COMMUNICATION
Fig 2.17 Circuit Diagram Of Serial Communication
28
3.1 INTRODUCTION
In this chapter the entire circuitry of the project is shown. The design parameters kept
in mind while the circuits are being designed are clearly explained. Also the chapter
includes the main important part of any hardware project i.e power supply, it’s circuit
and it’s internal circuit components. On the whole this chapter gives the circuits
employed in the whole project and their interfacing.
3.2 POWER SUPPLY
3.2.1 BLOCK DIAGRAM
The ac voltage, typically 220V rms, is connected to a transformer, which steps that ac
voltage down to the level of the desired dc output. A diode rectifier then provides a
full-wave rectified voltage that is initially filtered by a simple capacitor filter to
produce a dc voltage. This resulting dc voltage usually has some ripple or ac voltage
variation.
A regulator circuit removes the ripples and also remains the same dc value even if the
input dc voltage varies, or the load connected to the output dc voltage changes. This
voltage regulation is usually obtained using one of the popular voltage regulator IC
units.
Fig 3.1 Block Diagram of Power supply
3.3 WORKING PRINCIPLE
3.3.1 TRANSFORMER
The potential transformer will step down the power supply voltage (0-230V) to (0-6V)
level. Then the secondary of the potential transformer will be connected to the
precision rectifier, which is constructed with the help of op–amp. The advantages of
using precision rectifier are it will give peak voltage output as DC, rest of the circuits
will give only RMS output.
3.3.2 BRIDGE RECTIFIER
29
TRANSFORMER RECTIFIER FILTER IC REGULATOR LOAD
When four diodes are connected as shown in figure, the circuit is called as bridge
rectifier. The input to the circuit is applied to the diagonally opposite corners of the
network, and the output is taken from the remaining two corners.
Let us assume that the transformer is working properly and there is a positive potential,
at point A and a negative potential at point B. the positive potential at point A will
forward bias D3 and reverse bias D4.
The negative potential at point B will forward bias D1 and reverse D2.
At this time D3 and D1 are forward biased and will allow current flow to pass through
them; D4 and D2 are reverse biased and will block current flow. The path for current
flow is from point B through D1, up through RL, through D3, through the secondary of
the transformer back to point B. this path is indicated by the solid arrows. Waveforms
(1) and (2) can be observed across D1 and D3.
One-half cycle later the polarity across the secondary of the transformer
reverse, forward biasing D2 and D4 and reverse biasing D1 and D3. Current flow will
now be from point A through D4, up through RL, through D2, through the secondary
of T1, and back to point A. This path is indicated by the broken arrows. Waveforms (3)
and (4) can be observed across D2 and D4. The current flow through RL is always in
the same direction. In flowing through RL this current develops a voltage
corresponding to that shown waveform (5). Since current flows through the load (RL)
during both half cycles of the applied voltage, this bridge rectifier is a full-wave
rectifier.
One advantage of a bridge rectifier over a conventional full-wave
rectifier is that with a given transformer the bridge rectifier produces a voltage output
that is nearly twice that of the conventional full-wave circuit.
This may be shown by assigning values to some of the components shown in
views A and B. assume that the same transformer is used in both circuits. The peak
voltage developed between points X and y is 1000 volts in both circuits. In the
conventional full-wave circuit shown—in view A, the peak voltage from the center tap
to either X or Y is 500 volts. Since only one diode can conduct at any instant, the
maximum voltage that can be rectified at any instant is 500 volts.
The maximum voltage that appears across the load resistor is nearly-but never
exceeds-500 v0lts, as result of the small voltage drop across the diode. In the bridge
rectifier shown in view B, the maximum voltage that can be rectified is the full
30
secondary voltage, which is 1000 volts. Therefore, the peak output voltage across the
load resistor is nearly 1000 volts. With both circuits using the same transformer, the
bridge rectifier circuit produces a higher output voltage than the conventional full-
wave rectifier circuit.
3.3.3 IC VOLTAGE REGULATORS
Voltage regulators comprise a class of widely used ICs. Regulator IC units contain the
circuitry for reference source, comparator amplifier, control device, and overload
protection all in a single IC. IC units provide regulation of either a fixed positive
voltage, a fixed negative voltage, or an adjustably set voltage. The regulators can be
selected for operation with load currents from hundreds of milli amperes to tens of
amperes, corresponding to power ratings from milli watts to tens of watts.
FIG 3.2 Circuit Diagram Of voltage regulator
A fixed three-terminal voltage regulator has an unregulated dc input voltage, Vi,
applied to one input terminal, a regulated dc output voltage, Vo, from a second
terminal, with the third terminal connected to ground. The series 78 regulators provide
fixed positive regulated voltages from 5 to 24volts. Similarly, the series 79 regulators
provide fixed negative regulated voltages from 5 to 24 volts.
For ICs, microcontroller, LCD --------- 5 volts
For alarm circuit, op-amp, relay circuits ---------- 12 volt
31
3.4 COMPLETE CIRCUIT DIAGRAM EMPLOYED
32
33
4.1 INTRODUCTION
This chapter gives the advantages and disadvantages of the project. The various
applications in which the project can be utilized and implemented are furnished in
this chapter. Finally the chapter is ended with conclusion.
4.2 ADVANTAGES
1. High reliability and performance
2. Low cost and low complexity
3. Unwanted additional devices
4. Easiest way to interface with computer
4.3 APPLICATIONS
1. Easy to operate for patient or fit able person
2. Automobile and commercial applications
3. Inertial measurement systems
4. Emerging military systems
34
4.4 FUTURE SCOPE
1. Usage of Bluetooth technology for wireless transmission instead of Radio
Frequency transmission.
2. Usage of laser sensors in place of IR sensors
4.5 CONCLUSION
The advantages and disadvantages explained earlier in this chapter justify the
significance of wireless mouse. The application areas are also vast with the simplest
of modifications.
1. Help the disabled benefit from advances in computer and electronics
technologies
2. Speech input for operating a computer
3. User-friendly features such as, LED indication
4. Plugged into any IBM compatible personal computers running either
Windows 98/LinuX
35
REFERENCES:
[1] David E.Simon, An Embedded Software Primer,12 edition, Addison-
Wesley,1999
[2] Interfacing PIC Controllers by Martin Bates
[3] <http://www.mitelbook.com>
36
APPENDIX
CODE FOR INPUT SECTION
#include <pic.h>
__CONFIG(0x3f72);
#define TE RC0
#define Eye RC7
unsigned char GetX();
unsigned char GetY();
unsigned char GetZ();
void delay1(int);
void delay2(int);
unsigned char ch1,ch2,ch3,ch4,chL,chM;
unsigned char X,Y,Z;
void DelayMs(int n)
{
int i,j;
for(i=0;i<n;i++)
{
for(j=0;j<1000;j++);
}
}
unsigned char GetX()
{
ADCON0=0x41;
DelayMs(1);
ADGO=1;
while(ADGO==1);
X = ADRESH;
return(X);
}
unsigned char GetY()
37
{
ADCON0=0x49;
DelayMs(1);
ADGO=1;
while(ADGO==1);
Y = ADRESH;
return(Y);
}
unsigned char GetZ()
{
ADCON0=0x51;
DelayMs(1);
ADGO=1;
while(ADGO==1);
Z = ADRESH;
return(Z);
}
void wireless_send(unsigned char ch)
{
PORTD = ~ch & 0x0F;
TE = 0;
delay2(7);
TE = 1;
delay2(7);
}
void main()
{
char hor,ver,inc;
TRISA = 0xff;
ADCON1 = 0x00;
TRISD = 0x00;
TRISC = 0xF0;
PORTC = 0xF0;
38
Eye = 0;
TE=1;
while(1)
{
while(1)
{
hor = GetX();
ver = GetY();
inc = GetZ();
ch1 = 0xA1;
chL = ch1 & 0x0F;
chM =(ch1 >> 4);
wireless_send(chL);
wireless_send(chM);
ch1 = hor;
chL = ch1 & 0x0F;
chM =(ch1 >> 4);
wireless_send(chL);
wireless_send(chM);
ch1 = 0xA2;
chL = ch1 & 0x0F;
chM =(ch1 >> 4);
wireless_send(chL);
wireless_send(chM);
ch1 = ver;
chL = ch1 & 0x0F;
chM =(ch1 >> 4);
wireless_send(chL);
wireless_send(chM);
if(Eye == 1)
{
ch1 = 0xA3;
39
chL = ch1 & 0x0F;
chM =(ch1 >> 4);
wireless_send(chL);
wireless_send(chM);
}
}
}
}
void delay1(int n)
{
int i;
for(i=0;i<n;i++);
}
void delay2(int n)
{
int i;
for(i=0;i<n;i++)
{
delay1(1000);
}
}
CODE FOR COMPUTER SECTION
#include<pic.h>
__CONFIG(0x3f72);
#define recB RC0
unsigned char ch,chM,chL,ch_buf,chL1,chM1;
void delay1(int n)
{
40
int i;
for(i=0;i<n;i++);
}
void delay2(int n)
{
int i;
for(i=0;i<n;i++)
{
delay1(1000);
}
}
void main()
{
char ch;
int i;
int t=1,z=1;
TRISC = 0xff;
TRISD = 0xff;
TRISB = 0xff;
PORTB = 0xff;
RBPU = 0;
TXSTA = 0x24;
RCSTA = 0x90;
SPBRG = 64;
PORTC = 0x0f;
PORTD = 0x00;
while(1)
{
41
if(recB == 0)
{
recB = 1;
ch_buf = 0xF & ~PORTD; // 0000 1111
while(t == 1)
{
chL = ch_buf;
t = 2;
}
while(t == 5)
{
chM = ch_buf;
ch = chL + (chM * 0x10);
TXREG = ch;
delay2(8);
t = 0;
}
delay2(3);
t++;
if(PORTB == 0x01)
{
TXREG = 'G';
delay2(1);
}
if(PORTB == 0x02)
{
TXREG = 'H';
delay2(1);
42
}
if(PORTB == 0x04)
{
TXREG = 'I';
delay2(1);
}
if(PORTB == 0x08)
{
TXREG = 'J';
delay2(1);
}
} }}
43