Hello and welcome back. Continuing our discussion on RS232 serial communication
in this part we will make a RS232 level converter. In the last tutorial we saw
that how RS232 level signals differs from normal logic signals. So to interface
RS232 level signals to our MCUs we need a "Level converter". And in
this tutorial we will make one.

What a level converter will do is to convert RS232 level signals (HIGH=-12V
LOW=+12V) from PC to TTL level signal (HIGH=+5V LOW=0V) to be fed to MCU and
also the opposite.

rs232 level convertor using max 232

Fig – Working of RS232 level converter

 

 

 

As RS232 is such a common protocol there is a dedicated IC designed for this
purpose of "Level Conversion". This IC is MAX232 from
Maxim
. By using charge pumps it generates high voltages(12V) and
negative voltages(-12V).

Now lets make it!

Things you need

S.No
Item
Value
Qty
1
1
2
Capacitors
1uF
4
3
10uF
1
4
DB9 Female Connector
1
5
General Purpose PCB
1
6
Some Wires
-
-

 

Stuffs required for RS232 level Convertor

Fig – Stuffs required for RS232 level converter.

 

 

Now having all the stuffs in our working table lets begin.

The Schematic

Fig – Schematic for RS232 level converter.

 

 

Assembly

Assemble the circuit according to the schematic on a small piece of general
purpose PCB. Take out two wires for the power supply(5V) and two wire that connects
to the MCUs RX/TX lines. Connect a DB9 female connector with longer wires because
it connects to your PC. But don’t make it too long keep it within 1.5 meter
to 2 meter that will be enough.

Take care while connecting the DB9 connector wire must be connected to proper
pins as shown above. To help you the connector has pin numbering on it.

db9 for USART

db connector for rs232 communication

Fig – DB9 PIN Configuration.

 

 

After soldering wires put the plastic covering.

making a level converter using max232

 

Fig – DB9 with Cover

 

 

Now the connector can be easily connected to your PC’s COM port (Serial Port).

making a rs232 level converter

rs232 level converter

 

Fig – Fully assembled level converter.

 

 

Testing

It is always better to check each module separately. So we will test our converter
to see if its working fine. For testing we will use a Hyperterminal a Windows
software that can be quickly used to open COM ports and send and receive textual
data. Right now you don’t need a MCU or any MCU programming. The theory of testing
is that we will connect output (RX/TX) together so any data
written to COM port enters our circuit get converted to TTL level and loops
back and enter MAX232 get converted to RS232 level and enters COM port, that’s
it.

making and testing max232 based level converter

Fig – Loop back testing.

 

 

 

Now open hyperterminal from Start Menu (All Programs>Accessories>Communication>Hyperterminal)

  1. Enter the name of connection say "testing" and select any icon
    for it.
hyperterminal

Fig – Hyperterminal Main Window

 

 

2. Select your COM port in the "Connect Using Drop Down List". Note
your PC might be having more than one COM port but commonly only one is available
outside the rest are connected internally to modems etc.

hyperterminal

Fig – Select COM port.

 

 

3) Select

Bits Per second = 9600

Data Bits = 8

Parity = None

Stop bits = 1

Flow control = None (important)

To know what they mean see previous tutorial ().

4) Now the HyperTerminal is ready. Make sure that Hyperterminal has the input
focus and type something on the keyboard, they should echo on screen. Now disconnect
the RX from TX and do the same. This time you should not see any thing on screen.
Now your circuit is ready and working correctly.

If the characters are not echoing to screen your circuit is not working as
expected. Check your connections and try changing the COM port in Hyperterminal.

Note: the circuit should be powered up(by 5V supply) during testing.

Other Parts of this Tutorial