Download as pdf or txt
Download as pdf or txt
You are on page 1of 16

İYTE - Department of Electrical and Electronics Engineering

EE 316 - Electronic Design Project

Project: P08
IR Data Transceiver

Final Project Report


8 May 2011

Objective
IR data transmission and data receiver systems are very popular in recent
decade. In our project, we will combine two computers. One of the computers will
transmit data and the other computer will receive that data. The important issue is
the amplifying and modulating data. On the other hand transmission range is critical
parameter.

Group Members
Semih Yağbasan: RS 232 connection, Hyper Terminal, Amplifiers.
Umut Demir: Receiver circuit
Ozan Tuğcu: Transmitter circuit

1
İYTE - Department of Electrical and Electronics Engineering

Revision History
Week-5: We decided to amplify the current on the photodiode in order to get more
range at transmitter circuit up to 120mA of RMS value.

Week-6: We observed that 120 mA is too high for sending carrier and also it
generates more heat on photodiode. Then we reduce the current of photodiode to 35
mA.
Week-7: 55 kHz carrier frequency reduced to 37 kHz and baud rate is reduced from
9600 to 1200 baud rate.

Week-8: We decided to use BJT to amplify the signal from phototransistor.

Week-9: We replace the BJT with LM324 operational amplifier after envelope
dedector.

Week-10: For blocking DC gain we use 10µF capacitor with LM324.

2
İYTE - Department of Electrical and Electronics Engineering

1. Introduction
In our project, we must overcome four major problems to transmit the data truly
1. Determining the oscillation frequency of transmitter circuit: There are several
baud rates when sending data from computer. Depending on these baud rates,
oscillation frequency must be changed in order to observe the signal well. For 1200
baud rate, 37 kHz oscillation frequency is good enough.
2. Driving IR LED: For achieving maximum 1 meter distance between LED and
phototransistor, there should be enough current through LED. We drove the LED by
using a BJT configuration. Current on LED become 35 mA.
3. Amplifying received signal in receiver circuit: Amplification without a noise is a
big problem in receiver circuit. Operational amplifiers amplify with some noise. We
used BJT configuration after photo transistor. We obtained up to 5V p-p voltage level.
This voltage level pretty enough for us. But after filtering, voltage again drops down to
0.5V-1Vp-p. So we used LM324 operation amplifier to amplify the voltage. We
obtained again 4V voltage level.
4. Filtering signal: Filtering the carrier from message signal is one of major issue in
receiver circuit. After some research, we thought that envelope detectors could be
enough for our circuit. We tried it but at first the results weren`t very convincing. So
we modified the capacitor and resistor values and we obtained the signal very well.

1.1. LED’s
Light emitter diode (LED), converts a current into an optical signal.In other
words,it transforms an electrical current to light. The wavelength of light emitted by
LEDs in the visible light region. However, there are some kinds of light emitted by
leds.These are infrared radiation and ultraviole radiation. LEDs can be different
colour to adjust proper wawelength of light which is needed.Thus, each different
colour, consist of different compound semiconductor material such as galium
arsenide,galium arsenide phoshide.These material’s kind is more important than their
colour. Because, if two leds have same colour but they are made different material,
they can have different wavelength.Thus, they are sold with its colour and their chip
materials in electronic markets [1] .When we look the IR’s wavelength spectrum, we
must chose LED which made from GaAs or GaAlAs in our project.
1.2. Photodiode and Phototransistor
Photodiode is the reverse of a LEDs.They tranforms light to an electrical
current.In our project LED emittes light and photodiode transforms this light to
current or voltage.Thus, we must use a photodiode in receiver circuit. In the curcuit,
photodiode must be reverse biased with other circuit. We can make photodiode’s
current change or adjust current’s magnitude ,if we conduct parallel a resistor with
photodiode.

Figure 1: Sample usage of photodiode

3
İYTE - Department of Electrical and Electronics Engineering

Phototransistors are ambient light detectors. When we look the infrared


radiation wavelength spectrum, we can use phototransistors which are made from
GaAs, GaAlAs. They are more sensitive than photodiodes because of their gain (B)
factor.Phototransistors flow much current than phototransistors and gain factor is the
most important factor. Infrared radiation loss much power with distance and we must
solve this problem and phototransistor are more attractive than photodiode for us.The
main difference of phototransistor and other transistors, is base region.Because the
light absorbed by base region of phototransistor.

1.3.RS 232 Connection


RS-232 (Recommended Standard 232) is the name for a series of standards
for serial binary single-ended data connecting between a DTE (Data Terminal
Equipment) and a DCE (Data Circuit-terminating Equipment). We can say that
computer is a DTE and the modem is a DCE. RS 232 connection offers simple and
supported universally data connection. Also many opportunities for data error that
occur when transmitting data. Over fourty years RS232 become a standart and the
Electronic Industries Association published different version of this standart later.[2]
This standart has originally have 25 pins but it is not obligatory to use all of
them. Minimally there-pin RS-232 connection exists, consisting only of transmit data,
receive data, and ground when the full facilities of RS-232 are not required.[3]
There are many circuits to establish RS232 connection between computer and
devices. The most popular circuits are uses Max232 and Ds275. Because they are
easy to apply and their datasheets gives every information you need. Also this
structure is used for many years and there are reliable and easy solutions for
troubleshooting. In addition to that we can use RS232 with UART(16550 UART)
structure but it is a bit much complicated for our circuit.

1.4.Tuned amplifiers
Tuned amplifier is a necessary component for IR transmission. The principle
of a tuned amplifier is such a filter. It amplifies a narrow band of frequency with a
minor error such as 30kHz 0.01 kHz. There are several application areas for tuned
amplifiers. Spectrum analyser, satellite transponder, video amplification.[4] In
addition, tuned amplifiers can be used in filter design. Filters such as band-pass,
band-reject, high-pass, low-pass, Butterworth filters.[5]
Tuned circuits should be used in order to work the tuned amplifiers. Tuned
circuits has two different types, series and parallel. In addition, there is Q factor
affects the selectivity of tuned circuit. Q of a tuned circuit is the ratio of energy stored
in circuit to energy lost by the circuit. Another important specification is gain and
bandwidth of circuit. Bandwidth of the tuned circuit can be found by:

which Q is the quality factor of the circuit and f 0 is the resonant(center)


frequency. In theory,

4
İYTE - Department of Electrical and Electronics Engineering

1. f<fc1 , amplifier gain is zero.


2. fc1<f<fc2, amplifier gain is Av.
3. fc2<f, amplifier gain is zero.
But in practice, it is hard to obtain. These have two reasons. One of them is
inductors and capacitors have big tolerances. Second reason is, amplifiers have
natural capacitances. So if the operating frequency is getting higher, then we obtain
more impact of natural capacitance.

Figure 2: Comparing ideal band-pass filter with practical band-pass filter

5
İYTE - Department of Electrical and Electronics Engineering

2. Technical Description
Binary information sent by PC via hyper terminal has maximum 9600 baud
rate but we used 1200 baud rate. In order to modulate and transmit this signal we
convert it to logic level using Rs232 converter. Transmitter circuit will multiply this
signal by carrier signal, thus it will be modulated. Carrier signal is a high frequency
signal compared to message signal. Major reason for modulating is extending the
range of broadcasting. After modulation we need to amplify the current of the signal
not voltage accros the infrared led because we need only the voltage of forward bias
voltage to drive the led. If this is the case, we use operational amplifier before
infrared led.

HYPER
TERMINAL SERIAL RS 232
CONVERTER MODULATOR
PORT

PC
SQUARE
WAVE
GENERATOR

PHOTO- INFRARED AMPLIFYING


TRANSISTOR LED SIGNAL

AMPLIFYING OPERATIONAL
SIGNAL DEMODULATOR
AMPLIFIER

HYPER
TERMINAL SERIAL RS 232
PORT CONVERTER

PC
Figure 3. Block diagram of the infrared transmitter and receiver.

At receiver part ,broadcasted signal will be picked up by a phototransistor. We


need to amplify it because this captured signal is very small. After amplifying with
BJT we must demodulate the signal in order to get the original message signal. We
used envelope dedector as a demodulator. Demodulators output is not exactly the
original signal it has ripples, but after amplifying it, these ripples are very small
compared to message signal. Then Rs232 converter send the message to PC by
using serial port.

6
İYTE - Department of Electrical and Electronics Engineering

2.1 Transmitting Circuit


The transmitter circuit in out project will have 0 V minimum and 6 V maximum
input from PC. To achieve 1200 baud rate, we send the signal at 1200Hz. We
modulate the signal at 37 kHz. So that we can clearly see the modulated signal. In
order to demodulate signal Nyguist Theorem should be satisfied. Which is;
fN>=2*fMax where fN is the carrier signal frequency and fMax is the maximum
frequency component of message signal. After that, we need to amplify the signal.
For IRLED current is important, IRLED voltage drop is 1.9 V. So all we need to do is
amplify the current on IRLED. According to our simulations, we obtained 35 mA
current on IRLED.
Modulation
There are many types of modulation techniques, AM,FM,PWM etc. But the
simplest and cheapest way of modulation is using an AND gate. In our simulations,
we clearly obtained the modulated signal.But if we can not obtain the efficiency we
seek, we will try to implement another AM modulation.

U1:A
message signal1
3 modulated signal
2

7408
carrier signal

Figure 4: Modulation with 7408 AND gate

Amplifying
By using an BJT, we amplified the current to 35 mA level. As I mentioned
before, current is important for us because of driving IRLED.
R1(1)
VALUE=6

R1
50

D1
DIODE-LED

R2 Q1
modulated signal
BC238BP
1k

Figure 5:Circuitry of basic BJT amplifier that we used.


In our simulation, the current before amplifying is 8 mA. After amplifying, the current
goes up to 35mA. This much current is enough to drive the IRLED.

7
İYTE - Department of Electrical and Electronics Engineering

2.2 Generating Square Wave with 555 Timer


We use square wave to modulate the signal received from PC. Generating
square wave is very easy and generating sinusoidal signal is very hard. So we use
square wave for modulation. We generate 55 kHz signal because it is easy to
generate and Nyguist Rate is satisfied. The calculation can be from;
t1=0.693*(R1+R2)*C2 t1 is oscillator charge time
t2=0.693*R2*C2 t2 is oscillator discharge time
t1+t2=T T is period
f=1/T f is frequency
t1=0.693*(25500)*820*10-12=0.0000145 s
t2=0.693*(25000)*820*10-12=0.0000142 s
T=0.0000145+0.0000142=0.0000287 s f=1/T=1/0.0000287=34830 Hz

Figure 6 :Configuration of NE555 timer

2.3. Hyper Terminal


For our Project we will use hyper terminal to send binary information to serial
port. We can adjust baud rate, number of bits for data and using parity bit or not via
hyper terminal. We will use 1200 (or less) bit per second connection speed, mark
parity bit, Xon-Xoff flow control and 1 stop bit. When we use odd or even parity bit
instead of mark circuit is working but if we choose hardware for flow control, it doesn’t
work.

2.4. Rs 232 Connection, Serial Port


We will use serial port to take data from hyper terminal. This data will be
carried by a Rs-232 cable to our circuit. Then we need to convert it to TTL or CMOS
logic level. Because +3 to +12 volts indicates an ON, and -3 to -12 volts indicates a
OFF. The output signal level usually swings between +12V and -12V. There is dead
area between -3 volt and +3 volt for absorbing line noise. We need to convert this
output levels to 5 V peak to peak. In order to do this we will use Max232 IC from
Maxim.

8
İYTE - Department of Electrical and Electronics Engineering

It has typical usage from it’s datasheet:


VCC
5V
C5 C3
0 VCC
3
1 1uF 1uF
U1 6 C4
C2 C1 7 0
C1+ VCC V-
1uF 1uF C1-
4 C2+ V+ 1uF
2 C2-
T1IN T1OUT
TTL/CMOS inputs T2IN T2OUT RS 232 outputs
R1OUT R1IN
TTL/CMOS outputs R2OUT R2IN RS 232 inputs
GND

0 MAX232E

Figure 7 :Configuration of NE555 timer


We will use this configuration in both receiver and transmitter circuit. At
transmitter part, 3rd pin of serial port will be connected to Max232 as an input from
RS 232. Then we will use one of the TTL/CMOS outputs, which carries our message
signal. These outputs will be input of transmitter circuit. At receiver part of the circuit,
demodulated and filtered signal will be connected to Max232 as an input from
TTL/CMOS. Then we will connect one of the RS 232 outputs to 2 nd pin of serial port.
Serial port has 2 different pin assignments DB-9 and DB-25. We will use DB-9
configuration because we need only 3 pins of serial port: transmit data, receive data
and ground. The other pins are not connected.

Figure 6: Pin configuration of DB-9 that we used.

2.5. Receiving and Amplifying:


To pick up the IR light, we used phototransistor. The distance between led and
phototransistor is 10 cm now. After take the light, we amplify with npn BJT. In circuit
Vcc=6V. The value of R1 depends on distance, so we used tripod which is 100k.
The amplifier gain is nearly –R1 / R3 so we chose R1=1.5k and R3=100. The first
voltage level on the phototransistor is in the range of 100mv-150mV.After this
amplification, we get 3 volt peak to peak.

9
İYTE - Department of Electrical and Electronics Engineering

------------Vout

Figure 7:Phototransistor and BJT configuration

2.6. Demodulation:
Envelope Dedector (Low pass filter)
We used envelope dedecor for demodulation. The most important thing is chosing
the capacitor and resistor. We chose them with this criteria. 1/fc<<R.C<<1/W, fc is
carrier frequency and w is bandwith of input signal. fc is 55 khz and bandwith is 2khz
in our circuit. Thus R.C must be bigger than 1.81*10 -5 and smaller than 50*10-5.We
chose C=30nF and R=1k ohm. However , we used 500 ohm instead of 1k ohm.
Because, when we increase the resistance , Vout duty ciycle increase. Thus,
according to our test result in laboratory, the ideal resistance is 500 ohm.

Figure 8: Envelope dedector.

10
İYTE - Department of Electrical and Electronics Engineering

After demodulation, we get some ripple but this ripple does not effect to read
computer so it is neglectiable. Vin is nearly 3 volt and after demodulation we get 2,3
volt. Thus, we amplify again the signal with opamp.

2.7. Operational Amplifier


After filtering the signal, peak to peak voltage of our message signal is reduced
to 2,3V peak to peak which depends on the distance. We need to amplify it to 5V
peak to peak voltage in order to make it readable for MAX232 but we get 4V peak to
peak but it is working because MAX232 except minimum 2V for high level input. In
addition to that we use 10 µF capacitor to block DC gain.
It has simple calculation:
Vout=Vin*(1+R2/R1)
AV=1+ R2/R1
=1+100000/500=201
The amplifier circuit diagram:
U2:A(V+)
VALUE=6

U2:A
4

Filtered Signal 3
R 1 output
2
500
1
1
LM324 R
C 100k
10uF

Figure 9 :The receiver and amplifier circuit diagram

11
İYTE - Department of Electrical and Electronics Engineering

3.Test Results
3.1 Generating Square Wave
First important step of transmitter circuit is generating square wave. 555 timer.
We changed the frequency of oscillation from 55kHz to 37kHz. Because the baud
rate seemed to give us some problems at receiver part. So the baud rate was also
changed from 9600 to 1200. In our oscillator, the duty cycle was about 48% which
was enough for us. As can be seen from the graph clearly, 0-6Vp-p 37kHz signal is
obtained.

Figure 10: Carrier signal generated.

3.2 Message Signal


In our tests, we used function generator to obtain a 0-6Vp-p 1.2kHz square
wave for testing the transmission. The result of function generator can be seen
clearly from graph.

Figure 11: Message signal.

3.3 Modulating Two Signals


In our first tests, we used AND gate to modulate the signal. Our modulation
was a success. But we needed to amplify the signal in order to receive signal without
much loss. So we drived the IR LED with a BJT configuration. So the signal was
inverted. Then we thought that using a NAND gate would invert the signal again and
we would obtain the straight signal. So we changed AND gate to NAND gate and the
results were extremely good. As can be seen from the graph, we obtained 4Vp-p
inverted modulated square wave.

12
İYTE - Department of Electrical and Electronics Engineering

Figure 12: Modulated signal

3.4 Output of BJT Amplifier


In our tests, we obtained the the inverted signal of modulated signals. 0-6Vp-p square
wave was obtained in out tests. First we drove the LED by 120mA. We changed it to
35mA which is enough to receive the signal perfectly. As can be seen from the graph,
we obtained 0-6Vp-p square wave. Again the envelope of signal is 1.2kHz and carrier
signal is 37kHz square wave.

Figure 13 : Output of BJT Amplifier


3.5 Output of Phototransistor
We get 0,12 V peak to peak modulated signal but it is inverted however we
used inverting NPN BJT. Thus we get the original signal.

Figure 14: Signal at the phototransistor.

13
İYTE - Department of Electrical and Electronics Engineering

3.6 Output of NPN BJT


We have observed 3 V peak to peak output voltage from BJT as seen on the figure:

Figure 15: Output of BJT

3.6 Output of Envelope Dedector


In order to get the message signal we used envelope dedector. Input of
envelope dedecetor is 3V peak to peak square wave, which is output of BJT. We get
2,3 V peak to peak message signal at output because diode causes 0,7 loss

Figure 16: Output of demodulation

3.7 Output of Operational Amplifier


We used LM324 as a operational amplifier in non-inveritng mode. Input is
2,3V peak to peak square wave from demodulator circuit.We get 4V peak to peak
output voltage for high level which is enough for MAX232 as seen on the figure:

Figure 17: Amplified signal

14
İYTE - Department of Electrical and Electronics Engineering

4.Conclusion
When we first tested the generation of square wave signal, we couldn`t
obviously obtained the signal. After modifications on resistors and capacitor which
goes from threshold to ground. We solve the problem by only changing the capacitor,
we changed the frequency of oscillation. Modulation is made by AND gate 7408. The
results were very convincing. When we used LM741 op-amp, we failed to transmit
the original signal. There were a lot of noise on the signal. We changed it to BJT and
we successfully transmitted the signal. The current on the LED is up to 35mA now.
We didn`t have much trouble on the transmitter part. On the receiver part, first we
couldn`t obtain what we were looking for. After the right photo transistor configuration
, we obtained 50-100mVp-p voltage on photo transistor. As we read from datasheet of
photo transistor, we understood that resistor value should change according to
distance. First we tried to amplify the signal with LM741 which resulted fail. So we
change it to BJT again and we successfully amplified the signal. But there was some
noise on the signal again and we needed to filter it. The easiest way to demodulate
AM signal is using envelope detector. So we used an envelope detector such a filter.
So we expected to see demodulated signal. But in our tests, the voltage level
significantly decreases on filter part. So first we amplified the signal twice then filtered
but it was not conclusive. We changed our perspective then we amplified the signal
once then filtered. After that we amplified the signal again with LM741 again. The
signal was very corrupted. So we changed the LM741 to LM324. Using LM741 was a
very bad idea because it contributes noise on the original signal. So we changed
LM741 to LM324 which results so much better compared to LM741. After this
modification, we obtained the signal at the voltage level of 5V p-p. Receiver part was
the hardest part of this project. We had some troubles about impedance matching.
We changed the resistors to match input and output impedances. In addition, when
we first tried to use 9600 baud rate, we couldn`t get the signal very well. So we
changed it to 1200 baud rate which resulted so much better compared to 9600. After
changing the baud rate we needed to change the carrier signal as well. We put
820pF instead of 500pF in timer circuit to change the oscillation frequency. The
frequency was down to 37kHz. After we were sure about both transmitter and
receiever circuits were operating truly, we used MAX232 IC to connect computers to
circuits. We configured the IC as it was said on the data sheet. So we connected the
whole circuit. We set the baud rate to 1200 and parity bit to Mark. We used stop bits
to 1 and flow control to Xon/Xoff. The expected signal at the output of receiver circuit
should be carrier signal. To obtain the carrier signal, we changed the trimpot values.
We observed that it is very sensitive. When you change it a little bit, the signal
vanishes. So, after setting right resistor value, we send the signal. At our last test, we
received the transmitted words partly true. For example: when we send “semih”, we
receieved “remih”. We send “123”, we receive “$23”. There is a problem at the
moment. If we don`t adjust the trimpot value true, the receiver gets random
characters such as #$% etc. We observed that if the voltage level of MAX232 output
is higher than 3.5Vp-p we can partly transmit the data very well.

15
İYTE - Department of Electrical and Electronics Engineering

5.Component List
Component description Part Number Manufacturer Supplier
NE555 timer NE555 Philips www.datasheetcat
Semiconductors alog.com
Operational amplifier LM324 National Semicon. www.national.com
Rs 232 converter Max232CPE Maxim www.maxim-ic.com
And Gate 7408 - -
NPN BJT BC238 Fairchildsemicond. www.fairchildsemi.
com

16

You might also like