Safeguarding High/Low side Back to Back Mosfet circuit - Page 1
Forum section: electronics / projects

author: Blackgar
author_rank: Contributor
timestamp: March 05, 2022, 11:04:21 am
content: Hello,I am driving some Mosfets (configured back to back) with isolated signals coming from an MCU through optocouplers. Everything works fine but I want in case of code stack (or a breakpoint during development, optocoupler fail etc) the switches to turn off.I am thinking of sending PWM signals (rather than stable 0-5V) from MCU and using some bootstraping circuit to detect when PWM starts/stops.I am attaching a draft circuit.Any other idea how I could do it? I am searching for an IC with this feature but I am unable to find.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: March 05, 2022, 12:46:48 pm
content: Yes, that's a basic (and effective) way to do it. You'd usually adjust the thresholds and offsets so it's able to turn on a transistor or logic gate directly, and then use that for the, whatever it drives, instead of a comparator; but if you have some comps to spare it's perfectly fine that way too.Do note that you need more resistance in there, to avoid drawing excessive pin current. That's fine, just put a resistor at the driving pin (like 100 ohms or more, will be fine for most any MCU), and decrease the capacitors and increase the load resistors proportionally. You'll see in the sim how the source resistance affects the output, just poke at that a bit and see what a good threshold is to slice it at.More generally, you're making a missing-pulse detector, or frequency or pattern* detector. Besides charge pump circuits like the above, or timers (which do a very similar thing, just more accurately, with resistors instead of gulps of charge), there are also watchdog timers, usually not so fast as you'd want for protecting power circuits, but there's a lot to choose from and worth looking at. Also tend to have very low current consumption. See also: voltage monitors, reset generators, etc.*As enables go, you could imagine a sliding scale of severity and difficulty. The most trivial is just, logic level, high it's on, low it's off. But you might want to avoid that on an MCU, because its pins are stateful (latches), and you don't want the signal getting stuck high while the CPU goes and has a seizure or something. A simple repeating pattern, like the pulse train in question here, solves that problem neatly, though at the risk of higher current consumption (maybe? not really?) if program execution is unexpectedly fast, or failing if an accidentally too long chain of operations is performed.Sort of inbetween, you could have a complex pattern, but it's stateful. So, it doesn't really serve as a protective mechanism, but it does prevent the peripheral from turning on unless the right magic sequence has been applied. So you can imagine device initialization being something that can fit within this framework as well. Which, we might want to generalize a little further and include multiple lines on the bus, not just a single wire, so this works for pretty much anything you can attach to the MCU.And so, actual crypto devices, which transfer keys or hashes or whatever via signal buses, might indeed be considered this way.Going forward from a pulse train, you could imagine it being not just a square wave, but a pattern of pulses, say. Maybe even a specific code sequence. Now we can even get multidimensional; if the device ignores everything but a particular code, then many devices can share the same link, and if the link is linear (multiple sources can be summed together), we might even have multiple users simultanously. And so we've invented CDMA (code division multiple access), and other secure or isolated signals ranging from garage door openers and keyfobs (typically, the code rotates after every use, to discourage replay attacks) to cellphones and more!So, not that you'd likely want such a sequence just for simply protecting power circuitry -- but it's interesting to think about when/if you ever need the extra functionality, and there are many existing methods to choose from.Tim

author: Terry Bites
author_rank: Super Contributor
timestamp: March 05, 2022, 06:36:04 pm
content: and the MOSFETS are where in your schematic?

author: Blackgar
author_rank: Contributor
timestamp: March 05, 2022, 07:53:01 pm
content: Circuit just represents the logic of missing pulse detection.

author: inse
author_rank: Super Contributor
timestamp: March 05, 2022, 08:10:47 pm
content: NE555 in monostable retriggerable configuration?But hardly a difference in terms of part count, yet your comparator might be cheaper than the 555.