Important news about HackSpace

We have some important news to share about HackSpace: Issue 81 was the last issue of HackSpace as a standalone magazine, and HackSpace has become part of The MagPi, the official Raspberry Pi magazine. Starting with issue 145, We’ll be adding pages to The MagPi to make room for the stories and tutorials you’ve come to expect from HackSpace.

Variable power for your projects

By Jo Hinchliffe. Posted

Lots of the time, when experimenting with electronics, we need to feed a particular voltage into a system, and it’s a rite of passage for many to wire up a voltage regulator to create a fixed voltage supply that we need. Linear regulators, such as the ubiquitous LM7805, are great in that they can take an unregulated voltage between 7 volts and 25 volts, and regulate the output to a fixed 5 volts.

However, linear voltage regulators aren’t the most efficient approach and often have to dissipate a lot of energy as heat, and you may have to add increasing sized heat-sinks for them to be able to cope if you draw a lot of current. Also, whilst linear regulators have many great uses, sometimes you might want to have the ability to vary the output voltage – this is where variable DC ‘buck’ converters can be very handy. Variable DC step-down or buck converters are a type of switch-mode converter and can be incredibly efficient. They are available in lots of different forms, and they have become cheap and easy to source online.

One of the first we looked at is a cheaply available board built around the LM2596 IC (Figure 2). This board is available in a few different form factors, with the most common and cheapest being one that has a simple input end, an output end, and a small multi-turn variable resistor to set the regulated output voltage. Taking an input voltage between 3.2 V and 40 V, and outputting a lower voltage between 1.25 V and 35 V, it‘s capable of delivering up to 3 amps.

A collection of DC-DC buck converters, some with variable voltage, and some with both variable voltage and current regulation

Figure 2: One of the commonest boards is this one that uses the LM2596 IC, and has a single trimming potentiometer to adjust the output voltage

The basic LM2596 is simple in operation – attach a supply to the input, then your multimeter and hold the probes to the output. Using a small flat-head screwdriver, adjust the small pot, and you can vary the voltage to suit your needs. A common hack with these, to make them more useful for experimenting with use across a range of projects, is to replace the tiny potentiometer on the module and wire in a larger multi-turn potentiometer. In Figure 1, you can see that we built a simple, yet accurate, variable power supply suitable for small breadboard projects by adding a ten-turn potentiometer and also a small three-wire voltage meter LED display, which can be found online for very little cost. It seems this popular use for the LM2596 has been noticed by manufacturers, and they are now sold with built-in LED displays, as seen in Figure 3.

Here's a variant of the LM2596 converter with a switchable LED voltmeter that can show the input voltage and also the variable output voltage

More recently, cheap buck converter modules have appeared that can not only regulate voltage but also have the ability to regulate current output. This can be a very useful function to have in a power supply and can, for example, create a very efficient method of driving high-power LEDs. The module we bought is based around the XL4015 IC, and can regulate an input voltage of 8 V–36  V to an output of 1.25 V–32 V with current output adjustable up to 5 amps. The basic module we bought is sold as having a battery charging function which we haven’t explored, but it’s pretty simple to work with to supply a constant voltage and a constant current. The module that we have (Figure 4) has two small multi-turn trimpots again, to adjust the voltage and the current, but these are unlabelled, so the first task was to discover which was the voltage one! We hooked up a supply voltage and connected our multimeter, set the multimeter to measure DC voltage, and then we adjusted both trimpots to identify which one changed the voltage.

Figure 4:  Identifying which trimming potentiometer adjusts the voltage, and which adjusts the current

As an example, a great use for these constant-current-capable boards is to drive high-power LEDs. We wanted to drive a 1-watt ‘warm white’ LED we had, which required a forward voltage of 3.3 V. So, to give this LED 1 watt of power, we rearranged the power formula where power in watts (W) is equal to voltage in volts multiplied by current in amps (P=V×I). Rearranging this formula, power divided by voltage equals current (P/V=I). We can then substitute in the values of 1 W and 3.3 V to return the current as 0.3 A.

Having set the voltage to 3.3 V, we then need to swap the probe connections on the multimeter to configure the latter to measure current. The multimeter we used has connections for a range of currents up to 600 mA, and a connector up to 10 amps. While the 600 mA range would be enough, we were aware we could easily turn the trimmer a little too vigorously and go out of range, so we used the 10 amp connection.

Connecting the multimeter and turning on the power supply, the module detects that the output is essentially shorted, indicated by the red LED, and it indicates that it is in constant current mode by the blue ‘load present’ LED. We then used the current-adjusting trimming potentiometer to set the current to 0.3 A (Figure 5).

Figure 5: Adjusting the current to the desired amount that will deliver 1 watt to the LED at the correct voltage

Our supply was now ready to use with our 1 watt LED and, as such, we connected it and powered it on. The module now detects that there is a load present on the output and lights the blue LED and, of course, the 1-watt LED lights up, having been fed the correct voltage and current.

There are lots of variants of these types of cheap modules out there, and they can be utilised in projects in lots of ways. If you find an interesting variant, or come up with an interesting use for one, do get in touch.

From HackSpace magazine store

Subscribe to our newsletter