5

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.

Kamil
  • 5,926
  • 9
  • 43
  • 58
  • 2
    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
  • See also [this answer](http://electronics.stackexchange.com/q/172584/568). – hlovdal Mar 06 '17 at 17:09

3 Answers3

6

My answer is the result of another answer and some clarifications made by me in the comments:

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

schematic

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.

enter image description here

Brendan Simpson
  • 2,154
  • 12
  • 20
  • 2
    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 hasn't forgotten Monica 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 hasn't forgotten Monica Dec 21 '17 at 14:26
  • 1
    @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 hasn't forgotten Monica Dec 21 '17 at 16:09
2

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.

enter image description here

Roker Pivic
  • 504
  • 3
  • 10
  • But where do I put pullup for 1-wire? – Kamil Mar 23 '16 at 09: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 09: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
  • 3
    @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
  • @pipe If the voltage at "IN" is 12 V, then the voltage at "OUT" is ~5.7V, based on D3's drop. The current through D3 is limited by R1, which would be (12V-5.7V)/100 = 63mA. A similar current limit exists for negative voltages applied to "IN". Bear in mind, this is a _protection_ structure. Ideally the diodes would never be forward biased and R1 resistance would be negligible for the operation of the circuit. – Brendan Simpson Mar 23 '16 at 13:42
  • @BrendanSimpson Aaah, the terminology confused me here. "In" for me means the input to the microcontroller, "out" being the physical connection to the "out"side. – pipe Mar 23 '16 at 15:10
  • @Kamil Add the pullup in parallel with D3. The diode is not the concern here, the only issue is that a voltage divider is formed with R1 when the "IN" node gets pulled to 0V. This "issue" can be remedied by using a large value pullup, like 10K. That would make the low-input voltage seen at the MCU pin ~50mV, which should be fine. – Brendan Simpson Mar 23 '16 at 15:45
  • Fun fact, this diode structure is literally the same as what is used inside the MCU's I/O structure. This isn't a new or fancy concept; it will work just fine. – Brendan Simpson Mar 23 '16 at 15:47
  • @Brendan : But does this structure endure a permanent 12 V when somebody botched with the wiring? I would only rely on this structure for transients. You seem pretty knowledgeable about this, showing by the fact that the most to learn regarding this question currently stands in the comments. An consolidated answer from you would be welcome :) – Grebu Mar 23 '16 at 17:35
-1

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.

schematic

simulate this circuit – Schematic created using CircuitLab

Darko
  • 879
  • 6
  • 12
  • 1
    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
  • 1
    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
  • It's worth noting that Zeners are pretty slow compared to regular diodes, so there is a good chance that a damaging voltage could develop on the MCU input well before the zener started clamping. The OP should really use the structure described in Roker Pivic's answer, especially since that diode structure can be found in a single package. Less cost, faster protection, simpler design. This is a _protection_ circuit, it should not be "active" during normal device operation. You're simply trying to prevent user error from ruining your system. – Brendan Simpson Mar 23 '16 at 13:49
  • But in that schematic 12V would go to the 5V line which also powers MCU (charging the capacitor he already have there). That would not only blow MCU but all other what is powered from that line (if it is not able to tolerate 12V). Also such diode (from pin to Vcc) is probably already present on that pin (most MCUs have those diodes on every GPIO pin). So I do not see how that circuit helps? The resistor R1 could also prevent working of I2C, because other party should have ability to pull that line low. – Darko Mar 23 '16 at 14:33
  • @Darko The OP could just add the pullup in parallel with D3. When the "IN" node goes low, this new resistor would form a voltage divider with R1, so if the new resistor was, say, 10K, the low input voltage to the MCU pin would still be low enough, at 50mV, which is well below the VIL_Min of the input. – Brendan Simpson Mar 23 '16 at 15:43