USB to Serial adaptor

Ever since I’ve been tinkering with embedded and industrial systems, I’ve needed a way to interface with different types of serial connections. These include RS-232, RS-485, RS-422, digital current loop and TTL serial (5V and 3.3V). For the purposes of this article we’ll ignore digital current loop as it’s a niche media that doesn’t have many real world usages (not to be confused with the analog current loop, normally called 4-20mA, which is widely used in industrial systems).

Of course, there are multiple and very good solutions for each of these interfaces. However, there is no single solution that you can use to connect to any of them, or at least I couldn’t find one. In most cases you need a separate device for each of this media. This pushed me to the question: would it be possible to design a single device that could support RS-232, RS-485, RS-422, TTL 3.3V and TTL 5V?

Even though serial connections are considered very outdated, there is still quite a market for such devices. Proof of this is the significant number of manufacturers selling USB-Serial chipsets. Among them we have FTDI (probably the most popular, even with counterfeiters), Prolific, Silicon Labs and some chinese manufacturers (i.e. manufacturing the well-known CH304). These chipsets normally output TTL-level signals (i.e. 0 to 5V), but some also work with 0-3.3V.

For RS-232, you need an IC that can concert the voltage levels to the levels used by it. This means fairly high voltages, such as -15V to +15V. The most used IC for this purpose is the MAX232, originally from Maxim, but now available as second source from many other reputable makers (i.e. TI). This IC incorporates a charge pump, with external capacitors, to reach about -8V to +8V, which is well within the required limits. There are also many different version, including ones working with 3.3V, higher speeds, internal capacitors, low-power shutdown, etc.

The case for RS-485 and RS-422 is similar in the sense that it needs an IC to convert to the differential signaling using by these, but different because there are many possibilities on how devices using these media are connected. For example, RS-485 networks can be half-duplex (2 wires) or full-duplex (4 wires) and devices may or may not have termination depending on the topology and cable type. Even further, RS-422 networks may have up to 10 receivers, but only a single transmitter. A well-known IC for this is the venerable 65176 (available as SN65176 by TI and others), but there are countless other devices, including MAX485 from Maxim, which is very similar.

The solution

In addition to supporting all the aforementioned media, I also took a challenge on making a board as small as possible, but not exceeding two layers. I also used all surface components, except for connectors, electrolytic capacitors, jumpers and LEDs because I had leftovers from other projects.

This device uses FTDI’s FT232RL which is a USB to Serial adapter. It supports both 5V and 3.3V operation, thus being perfectly suited for this use case. It’s otherwise largely based on various reference circuits from FTDI’s documentation.

RS-232 is handled by a MAX3235. This neat IC has internal capacitors for its charge pump, thus it needs very few external components. It also supports 2 transmitters and 2 receivers, but we’re only using 1 of each.

RS-485/422 is handled by a MAX481. This is a barebones, non-isolated, half-duplex, RS-485 transceiver that works with 2 wires. Since termination depends on the network topology, a termination resistor of 120 Ohms can be added with a jumper.

Finally, since this device exceeds 2.5mA, maximum allowed by the USB specification during suspends, we’re using a MIC2025-2BM to switch the power on or off, as indicated by the FT232RL. This device also includes in-rush and over-current protection.

Schematic for the device

The way media selection works is simple, but functional enough. The FT232RL’s TX line is always connected to the MAX3235 and MAX481’s TX lines, so technically they are both always transmitting no matter what. The change comes in the RX line. The JP3 jumper allows selecting which RX line will reach the FT232RL. This means that you cannot use more than one media at the same time. While this may be inconvenient for some use cases, they all fall outside of the requirements and implementing this would add too much complexity.

PCB layout for the device (yes, I made this device in 2019)

Voltage selection is done by JP1. Selecting 5V is required for RS-232 or RS-485/422. TTL is the only one supported in both 5V and 3.3V. TTL pins are provided in JP2. No flow control is provided for this media.

I haven’t built a BOM file for this project, but the information provided in the schematics should be enough for building it. None of the capacitors or resistors are anything special. Any general purpose component will do. Capacitors should be rated for at least 6.3V. Otherwise it’s more of a “match package type” job. The USB connector is a type B receptacle.

Here are the schematic, layout and Gerber files available for download. Please keep in mind the license terms present in the enclosed LICENSE.txt file.

Leave a Reply