This circuit represents an interface converter between the UART pins of a microcontroller (with TTL levels) and a ‘standardised’ RS232 port with symmetric ±15- V levels. In contrast to the commonly used IC solutions such as the MAX232, it also provides electrical isolation between the two sides of the converter. This interface converter inverts the signals, so the usual inverters on the microcontroller side can (and must!) be omitted.
In most cases, the data lines RxD and TxD are all we need for communications with microcontroller systems. Fortunately, handshake signals are very seldom exchanged. The related RS232 leads are thus interconnected in such a manner that communications can take place without any problems.
All that is needed for the electrical isolation of a signal is an optocoupler. If the data flow from an external device to the microcontroller, the solution is easy. Since the RxD input of the microcontroller works with a +5-V level, all that we need is an optocoupler (IC2) whose LED is directly driven by the TxD output of the external device via resistor R2. This resistor also limits the current through D4 when TxD is inactive and thus has a negative level (usually around –9 V). During data transmission, the level of the pulses changes to around +9 V. The collector of IC2 is connected directly to the RxD input of the microcontroller. Resistor R5 is needed if microcontroller RxD input does not have an internal pull-up resistor. In any case, the microcontroller side of IC2 thus works with TTL levels.
If we now want to send data from the microcontroller to the external device, the microcontroller level (+5 V) must be converted into an RS232 level of at least +6 to +7 V. To achieve this, the negative voltage present at the RS232 TxD output is tapped off by D1 and buffered by C1, which acts as a storage capacitor. IC1 is a CMOS 40106 IC containing six inverting Schmitt triggers.
One of these Schmitt triggers (IC1a) is wired with C2 and R1 as an oscillator. It generates a frequency of around 1.5 kHz. This signal is fed to the other five Schmitt triggers, which are connected in parallel and act as a driver. They provide the necessary output current. When the output is Low, C3 charges to the supply voltage level via D2 (less the voltage drop across the diode). When the output changes to High, the voltage on C3 rises and adds to the voltage already present; D2 blocks and C4 is charged via D3 to nearly twice the supply voltage. A voltage of around +9 V is thus available from C4, which is connected to the collector of optocoupler IC3. In principle, the voltage level at an RS232 interface should be +12 V to +15 V, but PCs can generally work with significantly lower voltages. Notebook computers in particular sometimes have a voltage of only +8 V.
The emitter of IC3 leads to the RxD input of the RS232 port and is held at around –9 V by R3. When the microcontroller transmits data, the pulses from the TxD output of the microcontroller arrive at the LED of optocoupler IC3. The transistor of IC3 switched on and applies the positive voltage to the RxD input of the external device.
Normal diodes (1N4148) can also be used in place of the Schottky diodes, although the generated voltages will be somewhat lower. The 6N136 optocoupler is a high-speed type; normal optocouplers are not suitable. The circuit can theoretically transmit data at up to 57,600 baud, but in practice microcontroller circuits only use 9600 baud. These data transmission rates have been successfully used with both older-model and more recent notebook computers.