2

So I am undergoing a project where I will need to add 20 UART (RX/TX) to a single raspberry Pi 3.

Each device runs at 9600

After looking at the pi, I found it only has 1 UART on it. What would be the best way for me to add 20 UART's.

My current thoughts on doing this is, using an external powered USB HUB with 20 USB to TTL adapters. That is big and bulky (And I dont know if the Pi could handle it), so there must be a better way to do this.

Is there an IC that would allow me to do this?

  • 1
    Just use 20 USB-UART devices with FT232R or CH340G chips like this – kwasmich May 9 at 11:07
  • Since I also wont be using the USB to power the device at all, I think I will try with a bunch of RS232 USB to TTL and see how I get on with that – jLynx May 9 at 21:22
4

Since I cannot leave a comment, I will use the Answer form.

I had a similar task and looked at several multi-port ICs to build onto a board, I ended up using a USB hub and multiple USB to serial (RX & TX) adapters which works fine. I use 8 to 24 of them on several products I support on a Raspberry Pi. At the slow rate of 9600, the Pi will not have issues.... I don't.

One thing you may find useful is to be able to "fix" which USB is connected to which serial port. Otherwise the ports "move around" after each boot due to the way the USB interface initializes.

Use this link for a good start on how to keep the ports from changing. https://rolfblijleven.blogspot.com/2015/02/howto-persistent-device-names-on.html

It is also important to be VERY careful when selecting the USB to Serial converters because the Pi will not work with many of the "cheap" versions.

I used my o'scope and found that the RS232 chips in them are VERY poor, only allowing a couple of bytes to pass before the voltage they output slowly declines until the receiving device can no longer read the data.

These same "poor" USB to serial converters will work on my laptop or my desktop, but not on the Pi. Something to be aware of and watch for.... It was difficult to find this problem because the converters work on my laptop or desktop, but not on the Pi, BUT the "better" converters work on the Pi perfectly...

I use powered USB hubs in my products, and the Pi will not work with the cheap converters plugged into the hubs either... which is strange! To me it makes no sense what-so-ever, but this is the experience I have had.

  • Your link for keeping ports from changing is very good. I only know a similar mini tutorial for Windows - How to find and uninstall all those extra Windows COM ports -Lady Ada 2013mar07 learn.adafruit.com/how-to-find-hidden-com-ports/overview – tlfong01 May 9 at 13:20
  • I have found others too, but this one has helped me a LOT. – Wendall May 9 at 13:24
  • Since I also wont be using the USB to power the device at all, I think I will try with a bunch of RS232 USB to TTL and see how I get on with that – jLynx May 9 at 21:22
  • I had a similiar need and jumped from 20 or so adapters to 40 port rackmount ones that can be daisy chained. Turns out that server farms have monitoring and supply equipment still on rs232 so it's even available through normal consumer channels . The nice thing as sub ports they are always in fixed order (goes for most multi taps) and you only need to fiddle with udev per box. udev rules have a challenge that same vendor/MFG are not always uniquely identifiable except by physical USB port number. – crasic May 10 at 1:26
2

Question

Single Rpi3 to add 20 UARTs at 9600 baud

External powered USB HUB with 20 USB/TTL adapters is big and bulky,

Don't know if the Pi could handle it

Is there better way?

Answer

  1. I once tried two USB/TTL adapters on a 4 way switchable USB hub and found no problems I think it is very likely that Rpi can handle 20 USB/UARTs. I saw 10 way USB hubs with each channel switchable, and so it is handy though bulky. You might like to read this post for more details. How many serial ports are on the Pi 3?

  2. I have been using TSX0104 logical level converter to demultiplex 4 UARTS and found it working smoothly. I think there is little problem scaling up to 20+ UARTs. The only condition is that you cannot use more than one UART at the same time.

  3. Or you may consider NXP SC16IS750 I2C/SPI to UART module. Then you can have as many UART channels as you have SC16IS750s. But this chip is difficult for newbies (See my comments at the end of the references below).

  4. Or you can use software UARTs. I read that they are OK for low baud rates of 19.2k baud. You might like to read the reference post below.

References

How many serial ports are on the Pi 3?

Rpi Software UART Discussions

Raspberry Pi Serial (UART) Tutorial

SC16IS750 Single UART with I2C-bus/SPI interface - NXP

NXP SC16IS750 I2C/SPI to UART Module Not Recommended for Newbies - tlfong01 2019apr19

SparkFun once sold a NXP I2C/SPI to UART module. I thought it too good to be true to be able to have as many UART channels as I wanted. But then I found the datasheet has some "special features" which are perhaps OK for hackers to deal with, but too hard for newbies to handle. I tried hard for a couple of days before giving up. SparkFun has now discontinued this module for a reason.

The other modules AdaFruit are recommending are TXS/TXB0108 modules. I have been using TSX/TSB0104s for demultiplexing UART/I2C/SPI channels and found them OK, if not too greedy to entertain too many channels at the same time. Actually I found many I2C modules (including MCP23017) when grouped more than two, become unstable and difficult to troubleshoot. Perhaps I have not learnt all the tricks in fiddling the I2C pull up resistors. Anyway, trying just one is OK for newbies.

Another thing is that I tested both TSX and TSB versions and found TSB more reliable. I also noticed that AdaFruit only sells TSB now and no loner TSX. This are the puzzles I never solved.

quad USB/TTL adapters

1

Would a microcontroller and a bit of Arduino code work for your use case instead of a passive IC?

I saw a similar challenge addressed in the openDog project, the youtube update featuring the hardware change can be seen at https://youtu.be/hxNLQ7qGlbg

In the openDog project there was a transition from using Arduino Mega boards that featured 4 serial lines (1 back to host via USB, and 3 to motor driver boards) to a teensy 3.6 which features 7 serial lines (1 back to host via USB, plus 6 downstream connections).

If used in a similar setup, 4 teensy 3.6 boards, connected to the pi via USB, could be used to communicate with 5 uarts each, for the total of 20 with 4 spare connections for later expansion. While the final serial connection (Serial6) is on the solder pads on the underside of the board, Serial1-Serial5 are broken out on the standard layout and should be easy to access.

For more information about the UART spaces on the teensy, check out https://www.pjrc.com/teensy/td_uart.html I don't see any reason the link to the host couldn't be set a different speed than the downstream links.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.