"PC-to-PC Communication Using Infrared/Laser Beam": Bachelor of Engineering
"PC-to-PC Communication Using Infrared/Laser Beam": Bachelor of Engineering
"PC-to-PC Communication Using Infrared/Laser Beam": Bachelor of Engineering
Bachelor of Engineering
in
Electronics & Communication Engineering
(University of Rajasthan, Jaipur)
2006-07
Under the Supervision of Submitted by
Prof. / Mr. / Ms. Ms. Divya Guglani
Ms. Kirti Singh
Ms. Pratibha Bansal
This is to certify that Ms. Divya Guglani(E&CE), Ms.Kirti Singh (E&CE), and
Ms. Pratibha Bansal(E&CE) Students of B.E. Final Year (VII Semester) have
submitted their project entitled “PC-to-PC Communication using
Infrared/Laser Beam” under my guidance.
Project Guide
Examiner’s Certificate
This is to certify that the B.E. Final Year (VII Semester) Project Examination
of Ms.Divya Guglani , Ms. Kirti Singh and Ms. Pratibha Bansal for the partial
fulfillment of the award of the degree of Bachelor of Engineering in Electronics
& Communication Engineering is held on.…………………..
Minor-Project Title:
“PC-to-PC Communication using Infrared/Laser Beam”
(N.K.Shukla)
Project Coordinator
Department of E&CE
(Prof. S. Sarkar)
Head, Deptt. of E&CE
Acknowledgement
It is our pleasure to take this opportunity to thank all those who helped us
directly or indirectly in preparation of this project. Our special thanks goes to
Prof. S. Sarkar , H.O.D of electronics division, Faculty of Engineering and
Technology. We would also like to our esteemed guide Mr. Vikas Gupta , for
his helpful suggestions. It is because of his able and mature guidance and
cooperation without which it would not have been possible for us to complete
our project. We convey our sincere thanks to him for his constant
encouragement, guidance and suggestions throughout the tenure of our project.
Date: ……………
Place: MITS, Laksmangarh
Abstract
Serial communication is done via the RS-232 serial port. RS232 is the most
known serial port used in transmitting the data in communication and
interface. Even though serial port is harder to program than the parallel port,
this is the most effective method in which the data transmission requires less
wires that yields to the less cost. The RS232 is the communication line which
enables the data transmission by only using three wire links. The three links
provides ‘transmit’, ‘receive’ and common ground.
Why use a laser? A line-of-sight laser beam is useful where wires cannot be
physically connected to a remote location. A laser beam, unlike wires, also
does not require special shielding over longer distances. Lasers offer at least
an order of magnitude longer distances compared to infrared LEDs.
>>diagram
2. Serial Communication
A parallel port sends and receives data eight bits at a time over 8 separate
wires. This allows data to be transferred very quickly; however, the cable
required is more bulky because of the number of individual wires it must
contain. Parallel ports are typically used to connect a PC to printer. A serial
port sends and receives data one byte at time over one wire. While it takes
eight times as long to transfer each byte of data this way, only a few wires are
required. In fact, two-way (fully duplex) communication is possible with only
three separate wires- one to ‘send’, one to ‘receive’, and a common ‘signal
ground’ wire.
After the Start Bit, the individual bits of the word of data are sent, with the
Least Significant Bit (LSB) being sent first. Each bit in the transmission is
transmitted for exactly the same amount of time as all of the other bits, and the
receiver “looks” at the wire at approximately halfway through the period
assigned to each bit to determine if the bit is a 1 or a 0. For example, if it takes
two seconds to send each bit, the receiver will examine the signal to determine
if it is a 1 or a 0 after one second has passed, then it will wait two seconds and
then examine the value of the next bit, and so on.
The sender does not know when the receiver has “looked” at the value of the
bit. The sender only knows when the clock says to begin transmitting the next
bit of the word.
When the entire data word has been sent, the transmitter may add a Parity Bit
that the transmitter generates. The Parity Bit may be used by the receiver to
perform simple error checking. Then at least one Stop Bit is sent by the
transmitter.
When the receiver has received all of the bits in the data word, it may check
for the Parity Bits (both sender and receiver must agree on whether a Parity
Bit is to be used), and then the receiver looks for a Stop Bit. If the Stop Bit
does not appear when it is supposed to, the UART considers the entire word to
be garbled and will report a Framing Error to the host processor when the data
word is read. The usual cause of a Framing Error is that the sender and
receiver clocks were not running at the same speed, or that the signal was
interrupted.
Regardless of whether the data was received correctly or not, the UART
automatically discards the Start, Parity and Stop bits. If the sender and
receiver are configured identically, these bits are not passed to the host.
If another word is ready for transmission, the Start Bit for the new word can
be sent as soon as the Stop Bit for the previous word has been sent.
Because asynchronous data is “self synchronizing”, if there is no data to
transmit, the transmission line can be idle.
2.2 UART
A UART chip is an electronic circuit that transmits and receives data through
the serial port. It converts bytes into serial bits for transmission, and vice
versa. It also generates and strips the start and stop bits appended to each
character.
2.3. RS232
RS232 is the most known serial port used in transmitting the data in
communication and interface. Even though serial port is harder to program
than the parallel port, this is the most effective method in which the data
transmission requires less wires that yields to the less cost. The RS232 is the
communication line which enables the data transmission by only using three
wire links. The three links provides ‘transmit’, ‘receive’ and common ground.
The electrical specifications of the serial port are contained in the EIA
(Electronics Industry Association) RS232C standard. It states many
parameters such as –
Devices which use serial cables for their communication are split into two
categories. These are
Serial Ports come in two "sizes". There is the D-Type 25 pin connector and
the D-Type 9 pin connector both of which are male on the back of the PC,
thus both will require a female connector on our device.
Null Modems
A Null Modem is used to connect two DTEs together. This is commonly used
as a cheap way to network games or to transfer files between computers using
Zmodem Protocol, Xmodem Protocol etc.
The Data Terminal Ready is looped back to Data Set Ready and Carrier
Detect on both computers. When the Data Terminal Ready is asserted active,
then the Data Set Ready and Carrier Detect immediately become active. At
this point the computer thinks the Virtual Modem to which it is connected is
ready and has detected the carrier of the other modem.
All left to worry about now is the Request to Send and Clear To Send. As both
computers communicate together at the same speed, flow control is not
needed thus these two lines are also linked together on each computer. When
the computer wishes to send data, it asserts the Request to Send high and as
it's hooked together with the Clear to Send, It immediately gets a reply that it
is ok to send and does so.
Notice that the ring indicator is not connected to anything of each end. This
line is only used to tell the computer that there is a ringing signal on the phone
line. As we don't have a modem connected to the phone line this is left
disconnected.
3. Circuit Description
3.1 General Description of the Transceiver Module
Serial communication between two PC’s was earlier done using two separate
IC’s (for TTL to RS-232C and vice versa level conversion) using wireless
radio wave technology. This level conversion required use of three different
voltages, i.e. +12V,-12V and +5V.
The laser module used is easily available as laser pointer(having about 5mW
power output). It is to be used with its three battery cells removed and positive
supply terminal soldered to the casing and 0V to the contact inside the laser
module.
TABLE 1
MAX232 Conversion Levels
TTL +5V to -9V RS232
TTL 0V to +9V RS232
RS 232 +9V to 0V TTL
RS 232 -9V to 5V TTL
>>DIAGRAM
3.2 Transmitter:
Data signals transmitted through Pin 3 of 9-pin(or Pin 2 of 25-Pin) ‘D’
connector of RS232 COM port are sent to pin 8 of MAX232 and it converts
these EIA(Electronic Industry Association) RS232C compatible levels of ±9V
to 0/5V TTL levels as given in Table1. The output pin 9 of MAX232 IC
drives the pnp transistor SK100 and powers the IR LEDs. Output pin 9 also
drives an LED indicator (LED2) during the positive output at its pin 9. At
logic ‘0’ output at pin 9, LED 2 goes ‘off’, but drives the pnp transistor
through a bias resistor of 1Kilo-ohm(R5) , to switch ‘on’ IR LED1 and IR
LED2 and also a visible LED3.Since very low drive current is used, use of
high efficiency visible LEDs, which light up at 1mA, is needed. The electrical
pulses sent by the COM port are now converted into corresponding modulated
pulses of IR light.
3.3 Receiver
The IR signals are detected by a photodiode (D1). (A photodiode is reverse
biased and breaks down when IR light falls on its junction).The detected TTL
level (0/5V) signals are coupled to pin 10 of MAX232 IC. These TTL levels
are converted to ±9V levels internally (as per Table1) and output at pin 7.
TABLE 2
3.4 Testing
Assemble two transceiver modules and connect each of them, using 3-core
cables, to COM-1 ports of the two PCs. Place them 15 to 20 cms apart so that
the IRLEDs of each module face the photodiode detector of the other.
Power ‘on’ both the circuits to operate at stabilized 5V DC. We may
alternately use a 7805 regulator IC with a 9V DC source to obtain regulated
5V supply. Check if the MAX232 IC is working properly by testing pin 2 for
9 to 10V positive supply and pin 6 for -9V supply.MAX232 (refer figure 1)
uses 1µF, 25V capacitors C1-C5 as a charged pump to internally generate
±9V from 5V supply. Generally defective MAX232 ICs will not show a
voltage generation of +9V and -9V at pins 2 and 6, respectively. Replace ICs,
if required. Although 1µF, 25V capacitors are recommended in the data sheet,
the circuit works well even with 10µF, 25V capacitors, which are easily
available. With both the PCs and supply to the transceiver modules ‘on’,
throw some light with the torch on the photodiode. LED 1 should flicker at the
burst frequency rate of the transmitter. This proves that the IR signals are
being detected by photodiodes and converted intoRS232-compatible levels by
the MAX232 and output at pin 7 of MAX232 ICs is available for the PC to
read the pulses.
To test the transmitter side, disconnect the module from COM-1(or COM-2)
port of the PC,and with the device powered ‘on’,use a short jumper wire from
+5V and touch it at pin 8 of MAX232 IC to simulate a positive pulse. LED 2
should turn ‘off’ and IRLEDs and LED 3 should turn ‘on’ if the wiring is
correct.IRLEDs would also be glowing, although one cannot see them
glowing.
Remove the link wire from +5V to pin 8 of MAX232 IC and connect back
the ‘D’ connector to PC’s COM-1 (or COM-2) port.
Run simple communication software like PROCOM or TELIX. Set the baud
rate, parity, bits per character and stop bits to 9600,n, 8, 1 respectively, and
send a few characters from the keyboard through COM-1(or COM-2) port.
We should be able to see LED3 flickering for a few seconds, indicating data
transmission. Connect both PCs to the circuits and set the software to chat
mode. We should be able to transfer data between the PCs, as if a cable was
connected.
Depending on the sensitivity setting and power/angle of IR LEDs, increase the
distance to about 35cms (12 inches) and try again for better distance. For more
power, use metal-can type IRLEDs and reduce the value of register R7 for
more drive current. If we use a laser beam as explained earlier, remove the
IRLEDs and the device will track upto 10mtrs without any data loss.
NOTE:
1. Aligning the laser beam is a problem, but once it is aligned carefully and
fixed, the data transmission and reception would be error free. Transmitter and
receiver alignment routines have been included in this software program to aid
in the alignment process.
2. Ordinary clear photodiodes should be used for detector. If we use dark-red
plastic-encapsulated diodes, we may have problems, as these react only to
very bright natural light or infrared light.
>>DIAGRAM
The base addresses for the serial communication ports in a PC are shown in
Table 3.
Table 3
DB 9 Pin DB25 Pin Signal direction Description
1 8 In DCD(data carrier detect)
2 3 In RX(receiver data)
3 2 Out TX(transmit data)
4 20 Out DTR(data terminal ready)
5 7 - GND(signal ground)
6 6 In DSR(data set ready)
7 4 Out RTS(request to send)
8 5 In CTS(clear to send)
9 22 In RI(ring indicator)
The offset addresses of the registers used in serial communication are given in
Table 4.
Table 4
8250 registers: Offset from base address
Offset LCR Bit 7 Meaning Read/Write
0 0 Transmitter holding Write
register(THR)
[when written to port]
0 0 Receiver data register(RDR) Read
[when read from port]
0 1 Baud rate divisor-low Read/Write
byte(BRDL)
1 0 Interrupt enable register(IER) Read/Write
1 1 Baud rate divisor-high Read/Write
byte(BRDL)
2 × Interrupt identification Read only
Register(IIR)
3 × Line control register(LCR) Read/Write
4 × Modem control register(MCR) Read only
5 × Line status register(LSR) Read only
6 × Modem status register(MSR) Read only
For serial port initialization, the program makes use of BIOS interrupt 14H
service 00H. It initializes the serial port pointed to by the contents of dx
register (0 for COM-1 and 1 for COM-2 port). The contents of ‘al’ register
initialize the specific communication port for baud rate, parity, stop-bit code,
and character-size code as per table 5 (and expanded in table 6 through 9
respectively).
Table 5
AL Register Bits
Bit
7 6 5 4 3 2 1 0 Use
× × × . . . . . Baud rate code
. . . × × . . . Parity code
. . . . . × . . Stop-bit code
. . . . . . × × Character-size code
Table 6
Baud rate
Table 7
Parity
Bit Valu Meaning
4 e
3
Table 8 0 0 0 None
Stop bits 0 1 1 Odd parity
1 0 2 None
1Bit1 Valu
3 Meaning
Even Parity
2 e
0 0 One
0 1 Two
Table 9
Character Size
The software program can be used for COM-1 port initialization for
600, or 1200, or 2400, or 4800 bauds, etc. by changing the contents
of ‘al’ register in the initialization function to 63H, or 83H, or A3H,
or C3H.