e005056.pdf
(
1153 KB
)
Pobierz
000060-UK ser.tranceiver
COM
PUTERS
Serial transceiver
Electrically isolated RS232
Design by A. Müller
This transceiver electrically isolates the TxD and RxD lines from the PC,
provides an isolated power supply and also looks after the bi-directional
conversion between TTL levels and symmetric RS232 levels.
Frequently, a
microcontroller
system should or
must have an electrically
isolated connection to the RS232 inter-
face of the PC. This can be necessary when
the target system works at a completely dif-
ferent voltage level, or when earth loops must
be avoided.
The circuit described here can isolate
potentials up to 2500 Veff or 3000 Vdc,
depending on the type of optocoupler used.
It uses only relatively easily obtained compo-
nents, and it does not include any homemade
inductors. Power for the circuit is provided by
a mains adapter. A Maxim MAX232 interface
driver is incorporated into the circuit to con-
vert signals to the PC from TTL to RS232 lev-
els (±12 V), and signals to the microcontroller
system from RS232 to TTL levels. All other
lines of the RS232 interface that would be
needed to support handshaking are not sup-
ported, but they can be added on without
great difficulty.
Separated
signals
A simple glance at the schematic
diagram in
Figure 1
shows how the
electrical isolation is achieved. Two
optocouplers are used, along with a
DC/DC converter for the power sup-
ply. A fourth component, or better
said an isolating measure, can be
clearly seen in the circuit board lay-
out. A 5-mm wide copper-free strip
is located between the two voltage
regimes and underneath both opto-
couplers and the voltage converter.
This prevents leakage currents as
well as possible arcing with high
potential differences.
The Toshiba 6N137 optocoupler
used here (which are also available
from other suppliers) consists of an
infrared transmitter diode and a
photo-IC, which is made up of a
receiver diode, a Schmitt trigger and
a NAND gate with an open-collector
output (see
Figure 2
). The externally
available gate input (Enable) is per-
manently connected to +5 V in this
circuit, so that the optocoupler is
always enabled.
56
Elektor Electronics
5/2000
COM
PUTERS
5V
5V'
R1
8
R4
C2
1µ
IC1d
13
12
R2
470
Ω
IC4
7
63V
5V'
2
&
11
2
K1
V+
6
1
C1
C1+
16
IC1a
3
1
6
N13
7
IC3
1
2
3
6
1µ
63V
C1–
3
&
11
14
2
5
T1IN
T2IN
T1OUT
T2OUT
10
7
7
5V
5V'
12
R1OUT
R2OUT
R1IN
R2IN
13
3
9
8
8
C11
4
4
C3
C2+
IC2a
MAX232
15
100n
9
R3
8
1
2
5
5
1µ
63V
3
C2–
&
V-
7
IC5
R5
470
Ω
6
C4
2
IC2d
6
13
12
11
3
&
1µ
63V
6N
13
7
IC1b
IC1c
IC2b
IC2c
6
8
6
8
5
&
&
IC1, IC2 = 74HC00
&
&
45
90
45
90
5V
5V'
IC7
D2
1N4002
7
805
1
>9V
R6
7
+V
C13
C12
14
C7
C6
C5
IC6
NMV
C9
C8
14
C10
IC1
IC2
10µ
63V
100n
7
100n
10µ
63V
100n
0505SA
10µ
63V
100n
7
100n
D1
5
0V
2
000060 - 11
Figure 1. Two optocouplers and an integrated DC/DC converter provide the electrical isolation.
Both optocouplers are wired in
nearly the same manner. The output
of the microcontroller (TxD) is termi-
nated by resistor R1 and amplified
by two parallel HC NAND gates,
which provide the drive current to
the LED (limited by R2). Resistor R4
is the collector pull-up resistor. In the
other direction (RxD), the picture is
nearly the same, with the only
exception being that the termination
resistor is omitted. The gates and
optocouplers allow a data transfer
rate of more than 1 MHz.
The MAX232CPE interface driver
(IC3) limits the bandwidth to
115 kbit/s. If a higher level of input
protection against electrostatic dis-
charges is necessary, you should use
the MAX232ECPE instead. It guar-
antees protection up to ±15 kV.
voltage regulator (IC7, a 7805), in
combination with the reservoir and
decoupling capacitors C12 and C13,
provides a stable operating voltage.
Diode D2 provides reverse-polarity
protection. The primary operating
voltage is filtered by C6 and used to
supply IC1, while the output side of
IC5 and the cathodes of the IR
diodes are powered by IC4.
The primary and secondary sup-
ply voltages are isolated by an inte-
grated DC/DC voltage regulator,
which is a Newport NMV0505SA
(available from Farnell, among oth-
ers). This component is a member of
a family of 100-kHz switch-mode DC
voltage converters that can be used
to convert a DC input voltage of 5 V,
12 V 24 V or 48 V to a DC output volt-
age of 5 V, 9 V, 12 V or 15 V (suffix A),
or ±5V, ±9V, ±12 V or ±15 V (no
suffix). The input voltage is indicated
by the first two digits of the part
number, while the output voltage is
indicated by the second pair. All con-
verters are available in DIL (suffix D) or SIL
(suffix S) packages. The output power capac-
ity is 1 watt per output for all models. The DC
isolation voltage is 3 kV for all models. The
conversion efficiency is typically 70 to 80% at
full load.
I
F
6N137
I
CC
2
8
V
CC
I
F
6
V
O
3
I
E
5
GND
DC/DC converter
7
V
E
000060 - 12
Power is provided by a mains
adapter (>9 V at 250 mA). A +5-V
Figure 2. The internals of a 6N137 optocoupler.
5/2000
Elektor Electronics
57
COM
PUTERS
verter. The two electrolytic buffer
capacitors C6 and C9 support the
voltage converter. Each IC also has
an additional 100-nF local decou-
pling capacitor. LED D1 shows that
the serial transceiver is operational.
COMPONENTS LIST
OUT1
Resistors:
R1 = 100k
H1
R1
Ω
R2,R5 = 470
Ω
R3,R4 = 1k
IC1
IC7
Ω
R3
R2
Construction,
testing and more
The printed circuit board layout
shown in
Figure 3
is designed for a
9-pin sub-D connector (K1). A sim-
ple, standard RS232 cable can be
used to connect K1 to the COM port
of a PC. On the microcontroller side,
we have done without this or any
other sort of connector, in favour of
simple solder terminals. This makes
for flexibility as far as the connec-
tions to the microcontroller and the
power source are concerned. If the
transceiver is to be powered by a
mains adapter, fitting a low-voltage
connector to the enclosure is a good
idea.
When inserting the components
into the board, you should use only
sockets that explicitly have an isola-
tion voltage of 3 kV (1 TΩ isolation
resistance) for at least IC4, IC5 and
IC6. You cannot automatically
assume that inexpensive sockets
will meet this requirement. Pay
attention to the component
silkscreen markings and don’t forget
the small wire bridge next to C9.
After visually inspecting the fin-
ished board, you can perform a func-
tional test. For this test, connect the
two TTL pins of the transceiver to
each other and then connect the
transceiver via an RS232 cable to
either COM12 or COM2 of a PC. Start
the HyperTerminal program under
Windows 95/98, disable local echo
and handshaking, and check
whether arbitrarily entered text is
displayed in the receive window.
If you do not want to do without
RTS/CTS handshaking, you can nat-
urally add another pair of optocou-
plers to the circuit. There are suffi-
cient unused NAND gates and two
unused channels in the MAX232. Of
course, this will require a completely
new circuit board layout, which
must retain the generous earth
planes and the 5-mm wide separa-
tion between the two sides as found
on the original board. The hand-
shake pins of the RS232 jack (pin 7:
R6 = 680
Ω
IC5
IC4
Capacitors:
C1...C4 = 1
µ
F 63V radial
C5,C7,C8,C10,C11,C12 = 100nF
ceramic
C6,C9,C13 = 10
IC2
µ
F 63V radial
R6
IC3
Semiconductors:
D1 = LED, high efficiency
D2 = 1N4002
IC1,IC2 = 74HC00
IC3 = MAX232
IC4,IC5 = 6N137
IC6 = NMV0505SA (Newport,
Farnell)
IC7 = 7805
H3
Miscellaneous:
K1 = 9-way sub-D socket, PCB
mount, angled pins
RTS, pin 8: CTS) must not be con-
nected to each other. The current
consumption on the secondary side
must not exceed 200 mA.
Finally, there is one (superfluous?)
tip: you naturally cannot connect the
transceiver to any microcontroller
system that already includes a
RS232 converter (such as the
MAX232). The TTL logic at the input
and output can only handle TTL sig-
nals (0/5 V)!
(000060-1)
Figure 3. The electronics on the two sides is
separated by a 5-mm wide copper-free strip.
We thus have the following brief specifica-
tions for the model NMV0505SA converter
used here:
input voltage: +5 V
output voltage: +5 V
output current: 200 mA
package:
SIL
On the secondary side we find IC2, the out-
put side of IC4, the cathode of the transmit IR
diode of IC5 and the MAX232 interface con-
58
Elektor Electronics
5/2000
Plik z chomika:
TirNaNog
Inne pliki z tego folderu:
bge.jpg
(22 KB)
detail10.htm
(5 KB)
detail1.htm
(5 KB)
detail12.htm
(15 KB)
detail11.htm
(7 KB)
Inne foldery tego chomika:
1974
1975
1976
1977
1978
Zgłoś jeśli
naruszono regulamin