1
\$\begingroup\$

I have a 3.3V microcontroller and I want to communicate with an air conditioner that uses 5V UART. I'll need to connect the grounds of the microcontroller and air conditioner so I have a common reference point. What are the ramifications of doing that? If the two grounds have different potentials, what happens?

As a follow-on question, is there a common solution for when you want to avoid connecting the grounds?

I understand I could measure the grounds before connecting them, but 1) if they appear the same, I'm not sure that will always be the case, and 2) if they appear different I still need to communicate between the 3.3V and 5V devices via UART somehow.

So far my plan is to use a TXB0102. I don't need bidirectional [level shifting], but it doesn't hurt. EDIT: maybe it does hurt, as TXB is sensitive to capacitance. What's a common IC for 3.3V->5V UART? EDIT2: seems TXS0102 is the better choice -- the datasheet mentions UART specifically while TXB's does not.

\$\endgroup\$
9
  • \$\begingroup\$ At moderate baud rates you can use opto couplers. There are as well special couplers with TTL signal recovery for higher data rates. \$\endgroup\$
    – Jens
    Aug 22, 2022 at 2:45
  • \$\begingroup\$ Does the microcontroller also have a UART? \$\endgroup\$
    – RussellH
    Aug 22, 2022 at 3:07
  • \$\begingroup\$ "I don't need bidirectional" - which direction do you need - sending, or receiving? What is the baud rate? \$\endgroup\$ Aug 22, 2022 at 3:17
  • \$\begingroup\$ @RussellH Yes, it has UART at 3.3V, I just need level shifting. \$\endgroup\$
    – NateS
    Aug 22, 2022 at 3:29
  • 1
    \$\begingroup\$ The first thing you should determine is if the electronics inside are running on an isolated or mains referenced supply, because many devices that have no external connections might use an unisolated supply. Only after that you can start thinking how to connect the systems, when you know you need isolation between them, and if there is even any power available to run any extra electronics. Likely the TXB and TXS level converters are completely wrong solution for this. \$\endgroup\$
    – Justme
    Aug 22, 2022 at 8:31

2 Answers 2

2
\$\begingroup\$

Ideally the ground potential of the two devices would be the same. If it's not, current will start flowing through the ground wire. That's basically what a "ground loop" is. If it's really bad something could be damaged, but most commonly you will just see communication issues.

A quick and dirty solution is to make sure the microcontroller is powered by the same outlet that powers the AC.

A more universal solution is to use some kind of isolation between the two systems, like an opto-isolator or a transformer. But I wouldn't bother if this is a one-off and you're not seeing any issues.

\$\endgroup\$
1
\$\begingroup\$

Proper transmission line implementation.

Don't try to send your board logic levels across a UART interface.

The logic to EIA/RS232 (3-wire shielded cable), EIA/RS422, or EIA/RS485 converters. The 422 and 485 are commonly used in industrial control systems for UART interfaces and have more noise immunity than RS232. In all cases a ground wire between the system and the peripheral is required.

RS422 - one 22 - 24 AWG twisted pair each direction (My Preference) There are ground isolating chips available for high reliability.

RS482 - one 22 - 24 AWG twisted pair bidirectional

There should be a signal ground for each pair.

Many advise using a shield on each pair, but may not be necessary.

There are many to choose from at Digikey or Mouser.

The chip that you suggest is for on board peripherals.

\$\endgroup\$
2
  • \$\begingroup\$ I would need RS485 converters on both sides, right? UART 5V to RS485 to UART 3V. \$\endgroup\$
    – NateS
    Aug 22, 2022 at 12:56
  • 1
    \$\begingroup\$ That is correct @NateS. The same with the other options \$\endgroup\$
    – RussellH
    Aug 22, 2022 at 14:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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