1
\$\begingroup\$

For an application with UART that I am working on, it is very easy to swap wires. Generally speaking, I have 4 wires: TX and RX for UART, and the 2 supply wires (VIN = 230V AC and GND). What is the best way to avoid any possible error, even if very unlikely, to prevent any damage to my hardware? Diodes? MOSFETS? More elegant and efficient ideas?

Assuming, for example, I connect VIN to TX, does it make sense to somehow limit the voltage to 5V, since my TX and RX lines are square-wave sequences of 5V? If so, how?

Idea 2: Would it make sense to block the AC voltage on TX, RX and GND lines?

Edit: connectors cannot be replaced with polarized ones. Edit2: the greatest risk is to unintentionally supply RX, TX or GND with 230 V AC (VIN).

\$\endgroup\$
12
  • 5
    \$\begingroup\$ Make your wires unswappable and use a polarized connector. \$\endgroup\$ Commented Dec 5, 2022 at 15:18
  • 2
    \$\begingroup\$ Then provide more details. \$\endgroup\$ Commented Dec 5, 2022 at 15:22
  • 7
    \$\begingroup\$ So you have an unpolarized connector with mains and uart connections and you are looking for how to protect the uart. No offense, but this seems like an accident waiting to happen. \$\endgroup\$ Commented Dec 5, 2022 at 16:02
  • 4
    \$\begingroup\$ There might be safety reasons why your device can be banned if you have an unpolarized plug with both mains and low voltage. Seriously, redesign it already. You don't want and endless stream of people complaining about blown up devices or electrocuted installers. \$\endgroup\$ Commented Dec 5, 2022 at 16:46
  • 3
    \$\begingroup\$ I see you edited to say your power lines aren't a low DC voltage, but are in fact 230VAC. No, just no. Redesign. If you can add things to the PCB then you can split the terminal block or whatever connector you are using into two so the high voltage is separated. Is your PCB even properly laid out for the HV and LV to begin with? I have my doubts about that. \$\endgroup\$ Commented Dec 6, 2022 at 15:27

2 Answers 2

5
\$\begingroup\$

This really needs to be put in an answer and not be buried in comments.

Your design, as described, is a law suit waiting to happen. I doubt it would pass a safety standard review.

You are describing a single connector carrying UART TX and RX, plus 230V AC mains hot and neutral.

First of all, a UART needs three wires: TX, RX and common. I have to assume you are using mains neutral as UART common. This is a disaster. Your country mains plugs better be polarized and even if it is, you never know when an outlet might be wired backwards. Connect UART common to 230 V AC will destroy your box and whatever is connected to the UART, was well as potentially electrocuting the user!

Even if you could guarantee the mains connection, the mains neutral can easily rise a few volts above ground potential if you have a heavy load on the circuit.

You also need to worry about creepage. You need to space the mains voltage far enough away from low voltage circuits (as well as between hot and neutral) to avoid arcing, especially if the PCB gets dirty. If you open up a small brand-name (not Chinese crap) AC to low voltage regulator, such as a mains-to-USB phone power supply, You will see that they have actually cut slots in the PCB to increase the effective distance between mains voltage and low voltage.

This is all ignoring your original question about avoiding accidentally connections mains hot to a UART terminal.

Please do yourself a big favor and redesign to use standard connectors. You probably want to put your mains voltage into a IEC C8 or C14 connector so a standard power cord can be used. For the UART, particularly is using RS232 signaling, a D Sub 9 pin connector is standard although people also use RJ11 and RJ45 connectors.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Dunno what market OP is designing for, but in the EU we're not even allowed to run mains and signal cables together (and that's with 3-4 layers of insulation separating the conductors). Putting both into a single connector is absolutely not going to fly, such a product is going to be pulled from the market the moment it appears on the shelves. I suspect at least the US takes a similarly dim view of similarly creative solutions. \$\endgroup\$ Commented Dec 6, 2022 at 7:45
2
\$\begingroup\$

The greatest risk is to unintentionally supply RX, TX or GND with 230 V AC (VIN)

I'm not qualified to answer but perhaps have the RX and TX lines isolated by the normally open (N.O.) connections of a relay rated for a control voltage of 230 V AC supplied from the VIN pin. Relay rated for 230 V control side and contacts

The switching side also needs to be 230 V AC rated to safely isolate the fault condition you describe.

Having 230V AC on the same PCB as TTL-level UART signals usually means lots of creepage and isolation countermeasures AFAIK. Slots, spacing, MOVs, high rupture capacity fuses capable of breaking high currents etc?

AFAIK there's no way to guard against VIN GND reversal because you don't have a distinct protective earth separate from neutral. So your whole device would have to be double insulated to EU/US standards.

\$\endgroup\$

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.