Well, that was an interesting failure mode…

I have a bunch of eBay-sourced DC-DC converters that I use for a bunch of purposes around the house. Most are ordinary “LM2596” (in scare quotes, as most seem to be clones: they’re marked as LM2596 and generally work well, but have different switching frequencies. Supposedly this is an issue with such things.) buck converters configured as adjustable, constant voltage power supplies where the output voltage is set by a multi-turn potentiometer. Very handy.

Others can be used in either constant voltage mode or constant current mode. For the latter, a serpentine strip of PCB trace acts as a low-value sense resistor. An LM358 dual op-amp integrates the difference between the voltage across the trace and a voltage set by a potentiometer, with the output connected to the regulator’s feedback pin via an LED so you can tell when the regulator is in constant current mode.¬†Another potentiometer sets when the “charging” LED lights up; this is purely cosmetic, and the LED turns off when the current through the regulator drops below the setpoint set by the potentiometer.

Caleb Engineering has an excellent teardown of such a regulator here.

Here’s a few pictures of mine:

The overall regulator module. The input is on the left and the output on the right. The three potentiometers control, from left-to-right, the constant-voltage setpoint, the “charging” LED setpoint, and the constant current setpoint. Sorry for the bad lighting, but you can see the main regulator chip on the left, the op-amp on the right, and the linear regulator supplying the op-amp in the center.
The serpentine PCB trace used as a sense resistor. I typically measure around a¬†9mV drop from the “OUT-” pin in the top-right (to which the load’s 0V/ground is connected) and a test point partially seen at the extreme left of the picture when a current of 500mA is flowing.

Today, I wanted to use one of these modules to charge some supercapacitors in a controlled way, so I grabbed one of the buck modules, set the voltage limit to 2.6V (to stay within the 2.7V maximum limit of the supercapacitor) and the current limit to 500 mA. For testing, I connected the input to a 12V supply and everything worked fine.

I then connected the input to a 5V supply, which is more convenient for most things I do, only to watch the regulator go into current-limiting mode and pushing out 3.5A (!!). The current limiting potentiometer did nothing, even when turned all the way down to zero. The capacitors and the LM2596 started getting toasty warm (uh-oh), so I unplugged things to investigate.

It turns out I forgot a crucial detail: the op-amp is powered by a 78L05 5V linear regulator connected to the input voltage. Although the LM2596 switching regulator used to power the load has a dropout voltage of less than a volt (and the 2.4V difference between the 5V input and 2.6V output is perfectly suitable in any operating condition), the 78L05 regulator for the op-amp requires at least 7V input to stay in regulation. Supplying it with only 5V input meant the output voltage was less than the regulator needed, and so the feedback loop was broken and the LM2596 tried its hardest to pull the voltage up to 2.6V, maxing out its output current.

The culprit.

As soon as I connected the input of the module to a 9V or 12V supply, it worked great, since the 78L05 had a sufficient voltage difference to stay in regulation.

It’s worth being aware of this issue, particularly if your input power supply doesn’t have a lot of “oomph” behind it: if the input voltage ever drops below 7V (such as when supplying a heavy load) the 78L05 will drop out of regulation and the LM2596 will draw even more current, thus holding down the input voltage and preventing the system from recovering. Fuses are your friend in such conditions.

To prevent such issues, you might consider using some of the buck-boost modules (which are also available in constant voltage only, or CV/CC variants). They use a boost converter to first step up the voltage to a higher voltage (I have several different ones, some with LM2575 boost converters, while others have XL6009 chips, both boost to around 28V), which the LM2596 then bucks down to the desired output voltage. The 78L05 can handle input voltages up to 30V and the op-amp currents are low, so it works fine. There’s some loss of efficiency when using two converters instead of one and the maximum output voltage is slightly lower, but I haven’t found any edge conditions in the buck-boost configuration that cause bizarre failures like with the buck-only converters — one such buck-boost constant current supply has been driving the IR LEDs in my DIY babycam for more than a year from a 5V input without any hitches.

My Daughter’s First Circuit

My daughter turns three in June. Yesterday, we were playing and an idea popped into my mind: she likes to help me build various electronic things at my desk, but she’s never really built anything of her own. I asked if she wanted to make something with me and she energetically agreed.

Here it is:

It’s a simple two-transistor astable multivibrator that alternates between the red and green LEDs at around 2Hz. Everything to the right of the red wire is pretty bog-standard: 5% tolerance 470 ohm current-limiting resistors for the LEDs and 100k ohm resistors for charging the 10uF capacitors. Two BC548 transistors do the switching. Some 24 AWG wire connects parts too far apart (or awkwardly placed) for component leads to reach.

In retrospect, I could have laid things out better, but she didn’t mind. The only major thing I’d change is using ceramic capacitors instead of electrolytic, as I’d like to keep this circuit around until she’s older and have it still work without the capacitors drying out, but I didn’t have any 10uF ceramics at hand. I’ll order some, have her pick them out, and swap them out.

On the left is a simple terminal block for connecting a power supply. I wanted the circuit to be robust in terms of polarity, so I used a bridge rectifier so it can operate regardless of how the DC power supply is connected (I could have added a filter cap so AC could be used too, but I don’t have any wall warts with AC out, and she likes batteries, so this was not a major design consideration). I could have used a cheap diode, but the bridge rectifier uses Schottky diodes and so drops only 0.6V compared to a 1N400x’s 0.7V, plus it means the circuit will work (rather than simply not be destroyed) regardless of how it’s connected, so that was an easy and robust choice.

A 50mA polyfuse provides protection from faults (important when using old cellphone Li-Ion batteries as a power source). All the exposed underside contacts of the unfused section (i.e. terminal blocks and rectifier) are liberally coated with hot glue for insulation, with the jumper wires on the top and bottom tacked down with hot glue as well. All solder and components are lead-free, with burrs and other sharp points on connections filed smooth for minimal danger.

My daughter loved picking the components out of the parts drawers, listened attentively while I explained what they did and how they work, and helped me put them in the correct places on the breadboard. After things worked and she (later) went to bed, I moved the same parts over to a protoboard for a bit more durability. Now she’s running around the house waving it (and the 1000mAh cellphone battery stuck to the bottom with double-sided tape) around, blinking it at her baby brother, and integrated it into playing with her other toys.

This makes me happy.