RS232 to RS485 conversion is somewhat common in industrial applications. As part of an R&D effort I wanted to see if I could put together a small design converts RS232<—>RS485 with a minimal footprint. Here were the goals of the design.
1. Convert logic level signals to RS232 signals (assumes a master, like a microcontroller is attached).
2. Convert logic level signals to RS485 signals (assumes a master, like a microcontroller is attached).
3. Convert RS485 to RS232 and back without requiring a master unit to control the Drive Enable (DE) or Receive Enable (RE#) pins on the RS485 converter.
First some basic background stuff… here’s a description of the RS232 electrical specification, and now here’s a link for RS485. For RS232 conversion we’re using the following parts RS232-MAX3221, and RS485- MAX13430. U44 and U45 are tri-state buffers. Their inputs are tied to ground and the Output Enable (OE pin) is tied to the receive out pins of the RS232 and RS485 IC’s (ROUT and RO respectively). This configuration makes the output of U44 and U45 high impedance when the RS232 and RS485 ICs are outputting a logic “1”.
The circuit operated from 3V-5.5V and draws a few milliamps. It can be used to convert RS232 to/from logic level signals by connecting a microcontroller to pins P45 (data is received out of the RS232 converter) and P46 (data is sent into the RS232 converter). You can also use it to convert RS485 to/from logic level signals at pins P45 (data is sent into the RS485 converter) and P46 (data is received out of the RS485 converter). When using the RS485 converter a microcontroller can also manually control the state of the RS485 transceiver via the Drive Enable (DE) connection at P47.
However, at lower baud rates (I tested it to 9600BPS) U43, a logic inverter, allows you to ignore the DE pin. In fact, if P45 and P46 are left floating the board will convert RS232 to RS485 and back. Multiple boards could be have their P45 pin connected in common (and the P46 pins as a separate net) thus creating a series of logic level to RS485 converter. U43 inverts the logic level date coming from the RS232 IC and uses it to set the RS485 chip to be in receive or send mode. If there is a logic 1 at P45 the MAX13430 is in receive mode. This is pretty much a default state for the circuit. However, if you are sending a logic 0 the MAX13430 is put into send mode and the logic 0 is transmitted. In essence the circuit only transmits logic 0s via RS485.
Some of the downsides to this circuit:
I selected the MAX13430 because it operates from 3-5V. It was actually hard to find that in RS485 converters. This part also has a slow turn on time when the DE pin is asserted. Since we’re only sending logic 0 signals, and we’re asserting the DE every time we have a logic 0, we will see our serial data transmitted have shorter logic 0 signals than what we’re putting into the MAX13430. At higher baud rates this creates serial data errors. So the circuit is not good for high speed data.
But it is cheap and small and works at slow speed. So that’s kind of cool. The circuit board for this design ended up being 1” x 0.7”, with all components on the top side. Total cost of the board is about $8.