0
\$\begingroup\$

I have two separate PCBs. Both are powered by separate batteries. I want to communicate these two PCBs with UART. In some schematics, only RX and TX are used, while in others connections are made with RX, TX and GND.

Do I need a GND connection? How can I connect the grounds of these two PCBs in common? Can I connect directly or should I use an optoisolator?

\$\endgroup\$
6
  • 2
    \$\begingroup\$ Current flows in a loop so you need a common reference. Yes, the two gnds need to be directly connected. \$\endgroup\$
    – Kartman
    Commented Jun 9, 2022 at 5:55
  • \$\begingroup\$ @Kartman, These two PCBs will work for a long time. How does connecting the GNDs directly affect the noise? \$\endgroup\$
    – harmonica
    Commented Jun 9, 2022 at 5:59
  • 2
    \$\begingroup\$ Obviously there needs to be a ground connection for the boards to communicate. You can't light up a LED with one wire either, so logic chips can't measure high or low if there is no common reference. \$\endgroup\$
    – Justme
    Commented Jun 9, 2022 at 6:06
  • 2
    \$\begingroup\$ What noise? Time makes no difference. Current flows in a loop. No loop, no work unless you’ve found a way to cheat physics. \$\endgroup\$
    – Kartman
    Commented Jun 9, 2022 at 6:09
  • \$\begingroup\$ @Kartman, I mean, both PCBs have their own noise. Would connecting them directly cause an increase in noise? \$\endgroup\$
    – harmonica
    Commented Jun 9, 2022 at 6:52

2 Answers 2

3
\$\begingroup\$

If that is using standard UARTs, you absolutely need the ground as reference for the Tx and RX. Where you see on two connections, then the two ends must have a common ground that is not shown there.

If the UARTs are the only possible connection between the boards or the other connections also reference ground, then it should be safe to connect the grounds together. If there are other connections that don't reference ground, then a pair of optoisolators would probably be a good idea.

Edit: the only way to avoid a third wire is to make a half-duplex connection (Wikipedia). This means that only one side may transmit at any time and if both try to transmit at the same time, the signal is garbled.

\$\endgroup\$
2
  • \$\begingroup\$ What about Low Power UART? Is ground connection still required? \$\endgroup\$
    – harmonica
    Commented Jun 9, 2022 at 6:05
  • 3
    \$\begingroup\$ @harmonica For a signal to flow from one board to the other, there must be a return path. Otherwise, it’s like one side of a battery connected to one side of a light but no connection on the other side: no current can flow. The only way to avoid a third wire is to make a half-duplex connection. See my edit to the answer. \$\endgroup\$
    – DoxyLover
    Commented Jun 9, 2022 at 9:16
2
\$\begingroup\$

A direct connection between two GNDs with jumper leads is enough.

\$\endgroup\$
1
  • \$\begingroup\$ Even if PCBs will work like this for a long time? \$\endgroup\$
    – harmonica
    Commented Jun 9, 2022 at 6:00

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