# How to protect microcontroller board 1-wire from accidental +12V connection?

I'm working on modular LED strip driver with one "Master" board and up to 32 "Slave" boards. Each "Slave" board drives one LED strip.

All boards have 3 pin terminals: - +12V (connected to 50W source) - 1-wire bus - GND

Everything will be connected in parallel (+12, 1-wire, GND).

I'm using WAGO connectors. I'm afraid, that someone will accidentally connect +12V wire to 1-wire terminal and everything connected to bus will be destroyed.

How can I protect microcontrollers from +12V on 1-wire bus?

Im using PIC16F in "Master" board and PIC10F in "Slave" boards.

• Are you bound to use these connectors? While a protection circuit is advisable, you could additionally use encoded connectors which prevent reversing the plug. WAGO has some variants of these as well. – Grebu Mar 23 '16 at 12:20

As Roker Pivic stated, a good overvoltage structure would look like this:

simulate this circuit – Schematic created using CircuitLab

I have included a pullup as well, which was requested by the OP to make the one-wire communication work. There was some confusion about this structure, so let's look at it in all of the use cases.

• Outside connection is 5V: The MCU will see 5V on it's input pin. Technically, since the input impedance of the MCU isn't infinite, there will be a minute voltage drop on R1. Not a problem.
• Outside Connection is 0V: A voltage divider is created by R2 and R1. The resulting voltage seen by the MCU is $5V*(\frac{R2}{R2+R1}) = 50mV$. 50mV is plenty low to be seen as a '0' by the MCU. If it isn't, toss a Schmidt trigger in between the protection circuit and the input pin.
• Outside connection is >5V: Here is where the fun starts. As the voltage applied to the protection circuit rises above 5V, D2 starts to become forward biased. If we didn't have R1, it is likely that D2 would burn up. This is because the forward voltage is going to stay at approximately 0.7 volts, yet that excess energy would have to be dissipated somehow. That's what R1 does for us; it dissipates the excess power by current limiting the input to the protection circuit. So now, we can solve backward from the 5V node to figure out what the voltage seen by the MCU pin would be - at a maximum - 5.7V. What about the current? Well since the input node of the MCU is 5.7, and the input to the circuit is 12 volts, the current through R1 is given by: $I_{R1} = \frac{12 - (5V + 0.7V)}{100\Omega} = 63mA$

• Outside connection is <<0V: This will clamp the voltage at the MCU pin at around -0.7V, in a similar fashion to the positive clamping.

It is worth noting that the MCU's I/O structure looks very similar to the diodes we have used here. The difference is, the discrete diodes can handle sustained current flow, unlike the protection diodes in the MCU. Since the input current is limited, sufficiently sized diodes should be able to endure high voltage applied to the circuit indefinitely.

Here is a simulation of this circuit. The 1Mohm resistor is representing my estimation of the MCU's input impedance.

• Given the low power nature of many a microcontroller circuit, dumping 60mA from a 12V power source into a 5V rail has a high chance of destroying your circuit. This is bad advice. D1 should be a modern SMT bidirectional clamp, and then there's no need for D2 either. Such clamps will turn on much faster than a 1N5817 would. In fact, suggesting a rectifier that is doesn't have switching times specified in the datasheet is a bad idea as well. – Kuba Ober Dec 21 '17 at 14:25
• The input voltage source will have much faster rise times - an "accidental short" doesn't take 100us, and any sort of a spice model should include the parasitic inductances to give you an idea of how high of an overvoltage will result from those inductances' ringing. All in all, the circuit presented is a textbook example - of how not to approach such problems. It has place in a physics textbook perhaps, where spherical cows are a necessary simplification, but not in an electronics textbook :) – Kuba Ober Dec 21 '17 at 14:26
• @KubaOber The circuit is meant as a guideline, not gospel. The diode selection is not be ideal, but the purpose of the simulation was to show the operation of the circuit, not be a definitive guide on designing it. If you feel as though you have a better answer to give, perhaps you should write one. – Brendan Simpson Dec 21 '17 at 14:35
• Pretending that a power supply bus in a modern microcontroller board is an ideal voltage source is disingenuous and a way to let the magic smoke out. It's not a guideline anyone should follow. – Kuba Ober Dec 21 '17 at 16:09

Use a protection diode. Put it like on the image below. Just make sure that what is "5V" on the picture is your uC supply.

• But where do I put pullup for 1-wire? – Kamil Mar 23 '16 at 9:13
• The way you would usually do, from input wire to Vcc, or in this case parallel to D3. Keep in mind that pull-up resistor value is a couple of kOhm, way bigger than diode in forward bias mode and way smaller than diode in reverse mode. – Roker Pivic Mar 23 '16 at 9:24
• Won't this pull 5V to 11.4V, at the same time running half an amp through D3? Sounds like a bad idea if you want to protect something. – pipe Mar 23 '16 at 11:04
• nope, there would be no 5V! – Roker Pivic Mar 23 '16 at 11:11
• @RokerPivic What do you mean by that? Have you tried this solution? Simulated it? The 12 volt source capable of 50 watts would drive all its current through D3 into the 5 volt supply, overriding the (weaker) supply, and frying the whole micro controller in the process. – pipe Mar 23 '16 at 11:15

I would put zener diodes with apropriate voltage (little above working) and fuses on both sides (pcbs). Fuses can be either resetable fuses (ptc) or regular fast fuses.

simulate this circuit – Schematic created using CircuitLab

• Hmmm, if you apply 12V at the input, it will first toast the zener, then the microcontroller at the output. The resistor is better placed into the input line to limit the current the zener has to sink. – sweber Mar 23 '16 at 11:09
• It really needs a current limiting resistor, as in Roker Pivic's answer. – Simon B Mar 23 '16 at 11:13
• add a fuse in series between IN and D1 and the circuit will break in case of the accident. – fhlb Mar 23 '16 at 12:23
• A PTC fuse in series could also work but the zener's power should be rated to tolerate the relatively long breaking time of PTC fuses – fhlb Mar 23 '16 at 12:25
• Yes, you are right, fuse would be needed. I will modify the schematic – Darko Mar 23 '16 at 13:05