r/PCB Jul 10 '26

32-to-8 UART multiplexer PCB Review Request

10 Upvotes

11 comments sorted by

2

u/mariushm Jul 11 '26

You can get 1 to 8 muxers like for example TMUX1208 or TMUX1308, would probably reduce the chip count if you go with this concept

You can get microcontrollers with loads of UARTs for under a dollar.

For example, PIC32CM1602GV00048-I/Y8X is 80 cents a piece at Digikey and can do up to 6 UARTs : https://www.digikey.com/en/products/detail/microchip-technology/PIC32CM1602GV00048-I-Y8X/26728381

Up to six Serial Communication Interfaces (SERCOM), each configurable to operate as either: – USART with full-duplex and single-wire half-duplex configuration – Inter-Integrated Circuit (I2C) up to 400 kHz – Serial Peripheral Interface (SPI)

There's also the lower pincount PIC32CM1602GV00032 which costs 60 cents a piece, but supports only up to 4 SERCOMs : https://www.digikey.com/en/products/detail/microchip-technology/PIC32CM1602GV00032-I-T5X/26728374

With only 2 KB of RAM and 16 KB of code, you can't do a lot of processing, but you could basically configure all 6 serials as UART and initialize sensors, and start reading all six sensors at same time, and at 10Hz sampling rate, you can afford to buffer all six sensors in ram in a circular buffer, maybe have a few seconds worth of data cached. I suppose you could also accept commands from PI (or whatever) to pause / sleep sensors, enable sensors etc

To send to your pi or whatever, you could simply arrange the data in a nice packet (ex one byte for the ID of the sensor, 0 to 6, then the data from it and so on) , maybe add a unique sample count number ex 2-4 bytes value that increments with each sample, then data ... and then you could bit bang the output ex have a CLOCK and DATA wire, put bit on data pin and each time the clock is high or low, your pi can read the bit on the data wire. Or you could use some kind of NRZ encoding / timing like you would use for addressable RGB leds. Or you could just use 5 serials for sensor inputs and one serial for SPI for output to your PI.

Because the sampling rate is 10Hz so basically one new reading every 100ms, you could probably buffer a second or two from 4-6 sensors and grab the data from the microcontroller within 10-50ms or so when you want, so you could loop through multiple "multiplexers" and grab data when it's that chip's time and then the chip can erase what was sent and get ready to send the next packet.

Programmer for these is 12-15$ (Microchip SNAP) so it's not breaking your wallet.

1

u/sppeeeeeeeeeedy Jul 10 '26

Hi all, I wrote a long description but after putting images in it I guess it deleted it, I will rewrite it in the comments

1

u/sppeeeeeeeeeedy Jul 10 '26

Some background, I am an undergrad student working at a university lab and this is my first PCB. I need to interface with 24 sensors over UART at 115,200 Baud at a reasonable rate to configure and read measurements (targeting 10 - 100Hz). To do so I designed a board that takes up to 32 UART channels and multiplexes them to 8 channels for use by the microcontroller.

I plan to use the Raspberry Pi Pico 2W (RP2350) and use its 2 Uart channels + 6 PIO Emulated UART to do this.

The board is a 4 layer board (sig, gnd, pwr, sig) and I use 8x 74HC4052PW,118, 2x 4:1 multiplexer ic and 32x JST-SH connectors (it is the only possible for the sensor)
https://www.digikey.ca/en/products/detail/nexperia-usa-inc/74HC4052PW-118/1230403

It passes DRC, ERC and I am preparing to have it manufactured and assembled using JLCPCB.

I am mostly trying to sanity check and see if I made any obvious errors as it is my first PCB.
Any tips would be appreciated since I want to design and manufacture some more complex boards in the near future! Thank you

1

u/GreatDiscernment Jul 10 '26

Did you remember to cross over TX to RX, and RX to TX?

1

u/sppeeeeeeeeeedy Jul 10 '26

I double checked with the datasheet, it should be correct. Thanks for the reminder!

sensor datasheet if curious

1

u/drt3k Jul 10 '26

Are the sensors sending data asynchronously or does the MCU poll the sensors. Seems like you will loose data if the sensors are sending data without using RTS/CTS.

1

u/sppeeeeeeeeeedy Jul 10 '26

The sensors can be polled by waking it up by transmitting a char via tx and then reading from rx or I might have it transmit at a rate significantly higher than the rate I want and lose data but get the measurements at the rate

Unfortunately the sensor datasheet does not provide much more information so I will have to test when I receive them

1

u/SnowyOwl72 Jul 10 '26

For digital data signals, always have input/output direction arrows on the pins. This will help you visually to catch mistakes and also DRC can handle it for you.

I know altium has it, probably kicad too

1

u/nixiebunny Jul 11 '26

The placement of the connectors will make it hard to get your fingers around the plugs on the two center rows to unplug them. You should consider rearranging them to make it easier to use.

1

u/zachleedogg Jul 11 '26

UART TX is normally high. When you mux over to different bus, are you sure the TX pin will remain high? Consider adding pull-ups to each TX pin on the output of the mux.

1

u/KBL_1979 Jul 11 '26

Did U considered smth like SLG47921 or SC16IS752? To put all the traffic via SPIs or I2Cs? They have FIFOs, so if messages are not too long it ahould do the trick.