One of the biggest problems that we have when we begin to play with microcontroller, regards how to "interface" the PC with the microcontroller using the serial line (RS232).


The signals coming from the microcontroller (TTL or CMOS) are in the range 0-5V, while the signals of the RS232 standard are in the range -12..12 Volt ( -12V is the logic 1 of the TTL standard while the 12 is the logic 0).

So we can't connect the microcontroller directly to the RS232 and we need a level translator to adapt the signal level.

Another problem is due to the max Voltage that the microcontroller can accept; some micros have a maximum voltage of 3,3V while others have a maximum of 5Volt.


So every time we re-invent the wheel and as soon as we build the circuit we begin to debug the serial line.

And as always happens, the serial doesn't work and we begin to debug the circuit:

inspect circuit, component, ……… and It becomes Monday.

It's time to go to Work. Last but not least it's possible using the RTS an CTS RS232 lines to power the converter without using an external power.

Several signal adapters exist in the market but I haven't found one that meet my criterias:

  1. Voltage power between 2,7 and 5,5 Volt

  2. Voltage power coming form the RTS/CTS signal or from an external source

  3. Leds to indicate the status of the TX and RX lines and power..

The only difficulties for the homemade circuit is the precence of an SMD component the SP3232EBC-L. 

The Circuit:

  • Board based on the tranceiver rs232-ttl SP3232EBCN-L(EXAR)
  • Dimension :4,1 x 3,2 cm
  • weight 25 g
  • 1 Led for power
  • 4 Status Led  2 for Rx and 2 for Tx
  • 1 DB9 connector
  • 1 Rx line
  • 1 Tx line
  • Baudrae up to 230K
  • It works with some microcontroller : Atmel, Pic18F, Cortex M3 and some Routers

Schematic

 


How it works.

The J3 connector provides the interface to the Rx and Tx lines of the microcontroller. The pin 3 (Tx)  of the J3 connector must be connected to the Tx pin of the microcontroller while the pin 2 (Rx) must be connected to the Rx pin of the microcontroller. The J3 connector also provides the possibility to power the circuit from an external power supply using the 4th pin ( it must be connected to the positive supply) and pin 1 (it must be connected to the ground)

To choice the power source, external power supply or from the PC serial, is made the jumper J1 pinhead. 

In particular: 

If you short-circuit pins 1 and 2, the power will be supplied by the RTS / CTS from the DB9, while if you short-circuit pins 2 and 3, the power is "taken" by J3.

Powering from the RS232 connector

J1 pins 1 and 2 shorted. If you use a USB-RS232 adapter does not always manage to provide enough current. The circuit is guaranteed to work when connected directly to the PC serial port.

Power from the pin header J3

J1 pins 2 and 3 short 

 

The pinhead J2 if shorted, limits the voltage to 3.3 volts by the zener diode D3, while if it’s open the power supply will be limited by the zener diode D4 to 5.1 volts. 

The diode L1 (red) is used to display the power status.

The pair of LEDs L2 and L3 gives the status of the line TX / RX in the high state, while the couple L4 and L5 gives us the status of the line TX / RX in the low state; to make it easier the LEDs flash when characters are sent7received by the serial.


Bill Of Materials.

Components

Value

De

C1, C2, C3, C4

1uF 25V

CPOL-EUE2.5-6

C5

0,15 uF

C-EU050-030X075

C6

10uF 25V

CPOL-EUE2.5-6

R1, R5, R6

3,3K 1%

R-EU_0204/2V

R2, R3

6,8K 1%

R-EU_0204/2V

R4

220 Ohm 1%

R-EU_0204/7

R7

10 Ohm 1%

R-EU_0204/2V

D1, D2

1N4148

DIODE-D-2.5

D3

3.5v 1/4w 

ZENER-DIODEZD-2.5

D4

5.1v 1/4w

ZENER-DIODEZD-2.5

IC1

SP3232EBCN-L

MAX3232CSE

L1

Red 3mm Led

LED3MM

L2, L4

Yellow 3mm Led

LED3MM

L3, L5

Green 3mm Led

LED3MM

J1

1X03 pinhead

PINHD-1X3

J2

1X02 pinhead

PINHD-1X2

J3

1X04 pinhead

MPT4

X1

F09H

D-SUB Connector F, PCB 9-pole


Components on the board.


Rear and front with POV Ray:


The PCB:



RS232_TTL_SMD

The final PCB.

Tracks side of the PCB:

 

 Components side of the PCB:

 

Last but not least the complete circuit: 

 

The Cat, the Fox and Lucignolo.

First published on www.microprogrammo.it (Italian version).