# Is it possible to make a short-circuit detector for a battery power supply?

I have a basic understanding of electrical things myself, but semiconductors are not part of it. While pondering about some unrelated things, I came up with this question:

Suppose I want to make an electrical constructor toy for kids. There would be some lamps, switches, relays, magnets, wires, etc. And then there would also be a battery that powers it all (something like 9V or 3V, so no electrical danger exists).

Kids being kids, they will make lots of mistakes when building their circuits, and that's good - they learn. But short circuits can destroy the batteries pretty quickly, and possibly even heat something up enough to cause actual damage. It would be nice if that could be avoided, while still giving feedback that there is a short circuit.

So, is it possible to make such a "battery adapter", which would:

• Light a green LED when a circuit is connected and functioning properly (there is some significant resistance in the circuit). Note that this should affect the current/voltage of the circuit as little as possible.
• Light a red LED when there is a short circuit (very low resistance of the circuit), while also severely limiting the current flowing through the circuit (so nothing gets destroyed). When the short circuit is resolved, the LED should go off and the current limit be removed.

For bonus points, a yellow LED could light up when two power supplies are chained together, doubling the voltage of the circuit. This is can be used in some educational experiments (like seeing that a lamp suddenly lights up twice as bright), however it also shortens the lifespan of some circuit elements, so there should be a warning. However I do not know if this can be reliably detected from within the adapter itself (without some extremely fancy communications between adapters).

Is this plausible? Can anyone show me a schematic of such a device?

The following circuit uses an inexpensive current shunt monitor (AD8210) and a series of comparators to meet your requirements. I am using a separate 9V battery to power the test circuitry, so that even if the main battery gets completely shorted out, the test circuitry will still function. This also allows the test circuitry to work with a main battery ranging from 3V to 12V without requiring a buck-boost converter to generate the 5V needed. Instead I am using inexpensive 7805-type regulator in a TO-92 case, since the current drain is only a few tens of milliamps when one or more of the LEDs are on, and microamps otherwise.

(Right click and select View Image to see a larger version of this schematic.)

The 0.2 Ω shunt resistor R1 puts a minimal load on the circuit, dropping the battery voltage only 0.1V with a 500 mA load. The current shunt chip IC3 measures the voltage across the resistor, amplifies it with a gain of 20, and outputs a voltage proportional to the current on pin 5.

For example, that 100 mV drop across the resistor for the 500 mA load causes the IC to output a voltage of 2V. The proportion is 20 volts per volt across the shunt resistor, or 20V/V as I indicated on the diagram.

Likewise, a load of only 50 mA will result in a output voltage of 200 mV. So I set up the green LED to turn on for this threshold, namely 50 mA, indicating some activity. If you want it lower than that, you can of course adjust the value of the resistors R11/R12.

All of the comparator reference values are set with voltage dividers, using high value resistors to avoid loading the battery.

The comparator for the short condition IC2B is set up so it will trip with a load of 500 mA (2V). Obviously this is not a full short, but represents a lot of current. Again, you can adjust things as needed. With the current shunt resistor, you can only measure up to 1.25 A accurately. If you need to trip on a value higher than that, then you will want to switch the shunt resistor to 0.1 Ω and adjust all the voltage dividers accordingly. I picked 0.2 Ω so there would be enough voltage for the low-current measurement for the green LED.

Rather than lighting the red LED directly, the output of IC2B sets the flip-flop IC5A. This in turn turns off Q2, which in turn turns off Q1, breaking the path to the circuit under load so the battery will not be shorted anymore, avoiding possible damage to the circuitry. The flip-flop, being set, also turns on the red LED, and turns off the green LED. To restore battery power to the circuit, the RESET button must be pressed, resetting the flip-flop.

The bottom comparator is for the yellow LED. Depending on the resistor used for R8, it will light if the battery voltage is either over 3v (threshold is actually 3.5V) with a resistor value of 105K, or over 6v (threshold of 6.5V) with a resistor value of 237K. The circuit allows for battery voltages anywhere from 3V to 12V, since the battery voltage is divided by 4 by the resistor divider R4/R5 before being compared.

Although I didn't show it, you could add a DPDT switch to turn both batteries on and off at the same time.

Obviously this could be done with a microcontroller, but you will still need much of the I/O circuitry: the shunt resistor and IC, two MOSFET's controlling power, three LEDs (and probably three more MOSFETs to drive them), plus the batteries and pushbutton. So not a lot is saved (three comparators, a NAND gate, flip-flop, and some resistors and caps). I believe a circuit like this demonstrates the solution better than showing a bunch of code (if that's even included in the answer). After all this is a EE site.

• Wow, thanks! I'm saving this picture! Although it shows me just how little I understand of electronics - several of the symbols are unknown to me and I don't understand how the two little "sub-schematics" on the right side fit in with the rest of the circuit. However those are things that I can find on Google. Now at least I have a starting point. And I know this can be done. :) – Vilx- May 18 '14 at 8:30
• @Vilx- The "sub-schematics" are simply the power and ground hookups for IC's 2, 5, and 6. (There are no IC's 1 and 4 due to revisions in the circuit.) Each of these IC's have multiple circuits (the TLC339P for example is a quad comparator) so they can't show the power and ground on one of the circuits like they do on the shunt IC3. I have included 0.1 µF bypass caps across each of the power and ground pins. They should be placed as close to the IC as possible. – tcrosley May 18 '14 at 10:24
• Hmm... I could write dozens of questions on this schematic, or I could use Google to slowly unravel the mysteries. Asking you would, of course, be faster. Are you OK with me asking tons of newbie questions? – Vilx- May 18 '14 at 10:35
• @Vilx- Hmm, don't know about "tons", but I'll try as I can. Rather than add a lot of comments to this answer, which is not looked kindly here, we can start a chat room just for this purpose. (I haven't done that before, but it looks straightforward.) – tcrosley May 18 '14 at 11:01
• OK, here it is: chat.stackexchange.com/rooms/14585/vilx-olin-private-chat I'm not at my computer all the time, so it'll probably be a quite discontinued chat, but it will work. Thank you very much for your help! :) – Vilx- May 18 '14 at 16:52

My first reaction is to do this more carefully than what others have suggested, especially since it seems you are intending this as a real product.

I'm thinking of a power supply module that you put a bunch of AA batteries into, which then provides reasonably regulated 5 V via a buck regulator. You may be able to find a off the shelf buck regulator chip that can also do current limiting, but I'd do this with a micrcontroller since you want a bunch of other features. The micro would be driving the buck switch from a PWM output, and firmware would provide the closed loop voltage control. The firmware would also be watching the current and doing the current limiting. Since it knows whether it is in voltage regulation or current limit mode, it is easy for the firmware to light a LED and drive a beeper during current limiting.

The micro would be regularly measuring the battery voltage, and provide a battery-low warning. I'd probably have a green LED dimly lit when the unit is turned on, and have it flash when the batteries get low.

One advantage of using a buck converter is that it would actually not draw excessive current from the batteries when the output is shorted. This unit would be quite robust, with little a kid can do to hurt it.

As for detecting multiply supplies chained together, that's not possible soley from inside one of the supplies.

• Chances of this becoming a real product are quite remote. :) At best, it will be something I make for my own kids. A microcontroller sounds a bit excessive (and expensive). Although the battery-low indicator is a nice idea. :) Still, isn't it all possible with a lot more simple wiring diagram and a few resistors/transistors/diodes? – Vilx- May 17 '14 at 16:49
• @Vilx: If this is intended to be a one-off and not a product, it would have been vary useful to make that clear up front. – Olin Lathrop May 17 '14 at 20:44
• Oh... I'm sorry. I didn't cross my mind that the answer would depend on that. Still, even if it would be a commercial product (unlikely, but, well, who knows...) - wouldn't a simpler and cheaper solution be better? A whole microcontroller... that'll probably cost several dozen dollars, and need a bunch of support electronics too, no? – Vilx- May 17 '14 at 20:53
• @Vilx: No. You need to go look at microcontroller prices. I haven't explicitly looked for this particular requirement, but I expect you can easily find a micro for under $2 that can do everything I mentioned. The inductor should cost under$1, and the remaining electronic parts other than the switch maybe another $. – Olin Lathrop May 17 '14 at 20:59 • Interesting. I didn't expect that. The microcontrollers I've heard about are like Arduino and similar, which are in the$40 range and more. What are the characteristics/features/brands/etc that I should look for? – Vilx- May 17 '14 at 22:53

The simplest solution is a single led that is on when there is no short circuit, and off when there is. To provide the current limiting, a single polyfuse or resettable PPTC would work. Unlike a regular fuse which blows and needs replacement, a PPTC sees the short circuit current, and starts to rise in resistance. Remove the short circuit, and it starts to cool down and resets to its normal low resistance state. Just size it for the typical current of your kit.

• The PPTC device is interesting, I hadn't heard about it before (and it explains some perplexing behaviors I've seen in some electrical devices). However I'm a bit worried if it would work well in a children's toy. I expect it to be tripped fairly often, especially when the child first gets acquainted with the kit. The question is - how fast does it reset? If it takes more than a few seconds, it can take a lot of fun out of the toy. Also, Wikipedia says that after each tripping it's resistance goes higher. How many times before it "wears out" too much? – Vilx- May 17 '14 at 16:57
• @Vilx- depends on the part you choose. A datasheet would have that information. See the resistance chart in this one datasheet.octopart.com/… And then some testing to find how many tripping cycles. – Passerby May 17 '14 at 18:55

All the previous answers most certainly work and, very interestingly, each one shows a very different approach to this problem.

I'd like to suggest an other one that is

• quite simple,
• based on a "classic" circuit,
• only using most common parts : resistors, transistors, leds, and (for the bonus points !) a zener diode.

However, please note that I never built this circuit myself, and since I'm quite new to this electronics stuff, I may have got it completely wrong.

## The current limiter

To understand how that thing works, first remember 2 things about transistors :

• The current that flows out of collector can be up to about 100 times the current that flows out of the base,

• Current flows from the base as long as the base is biased about 0.7v below the emitter : the "Base-emitter" junction behaves just like any silicon diode.

(This is for PNP transistors ; for NPN just replace "from" with "into" and "below" with "above".)

As long as the load (between Vout1 and Gnd1, not shown here) does not try to pull more than 100mA, R7 has less than 680mV across its terminals so Q4 is not biased enough : it is blocking. Then, R8 pulls current from Q3 base and therefore Q3 is turned on: the voltage between its collector and emitter is low and as much current as needed flows through it.

Now if the load tries to pull more than 100mA, the voltage across R7 gets high enough to bias Q4 so the excess current would flow from Q4 base instead. This turns Q4 on, and pulls Q3's base high so that Q3's base isn't biased anymore*. Now Q3 gets into its "blocking" regime, the voltage drop between its collector and emitter increases and that limits voltage to the load.

*in this case, the current through R8 comes from Q4, not Q3

Ultimately, this circuits adjusts the voltage between Vout and Gnd so that the load pulls no more current than whatever makes 0.7V across R7.

## The complete circuit

Here is the complete circuit, with the leds :

The red led : In case of a short, the voltage will increase across Q1 (from about nothing to almost the supply voltage) so the red led will light up. Otherwise, the voltage across Q1 will be much less than the led forward voltage (about 2V) : the led will be off.

The green led : This one will be always on. It is possible to get it to go off in case of a short, but this would add 2 transistors and I don't think it's useful

The yellow led : This one will be on as soon as the supply voltage is above the Zener voltage plus the forward voltage of the led (I'd say, about 2.5V).

Again, I'm not 100% sure that this would work so I'd welcome any comments on this stuff !

• It's likely the OP will want the "short" threshold to be quite a bit higher than 100 ma (to runs motors etc.) Is the only change needed to set a different threshold the value of R1? The green LED is supposed to only come on if there is some load (unspecified) on the output (the OP said "there is some significant resistance in the circuit"). Also, could your circuit be adapted to work with a battery voltage of 3v? (the OP suggests using a voltage that low). In that case the "double" supply voltage (for the yellow LED threshold) would be 6v. – tcrosley May 19 '14 at 5:28
• Yes, changing R1 would change the maximum current. For 1amp, R1 should be 0.7V/1A=0.7ohm. – Nicolas D May 19 '14 at 5:57
• For lower voltage operation, this would work as well; just decrease the resistors values accordingly so they let enough current through. 4.5V should work perfectly this way. However 3v is very close to leds forward voltages so the series resistors would have to be reduced to almost nothing - the circuit then gets very sensitive to battery voltage. I think 3v is a practical lower limit for this reason (note that this problem would appear with most circuits anyway). Also, for 3v operation, replace the Zener with an other yellow led (or a low voltage Zener but these are quite leaky) – Nicolas D May 19 '14 at 6:15
• Having the green led only light up above a given current is definitely possible but would probably involve an op-amp, which would make this circuit more complex and with less common parts. Or perhaps use 2 more transistors and resistors (long tailed pair) - at this point, the other answers (the one with microcontroller or the one with in-amp and comparators) offer much more precision and flexibility – Nicolas D May 19 '14 at 6:30