Firstly, this is my instructables debut so please go easy.
There are many, many, many adjustable power supplies on here. However, most of them consist of noisy buck or boost converters, and that noise will find its way into your measurements or amplifiers. Just look at that oscilloscope trace!
There are also the odd few designs on here with linear voltage regulators and gigantic heat sinks, these are pretty good for noise but usually can't put out much current, and they get warm. Very warm, which leads to drifts in output voltage or current.
For most people these are just fine, especially for digital arduino based projects. But if you need to do some precision analogue measurements or want to mess around with quality audio then you need a quality power supply.
This is a high performance mixed mode power supply, meaning that it has low output ripple, can be configured for high current without the need for monster heat sinks or any fans (so it's silent), and it is extremely stable, so the parameters you set (voltage source or current source) do not vary with time, temperature or different loads. In addition, this design can accurately output ultra low voltages (even 0 V, very useful for trouble shooting). Digital control can be added. It can accurately showoutput voltage to +/- 2 mV and current +/- 2 mA with no calibration. It has little output capacitance (so no current spikes).
Basically: It's a pretty sweet tool that would cost around half a grand!
My design (15 V, 3 A) can be made for around £50 but could be expanded for a little bit extra.
Step 1: Background
So how are these specs possible?
Well first you need to know how the different types of power supplies work.
All power supplies need a primary power supply (confusing. I know). This is simply an AC/DC converter which outputs a fixed voltage, and can handle the amount of current you want to draw (high enough power rating).
After the primary, there are a few different designs which could be used to get the adjustable output voltage/ current:
Switching: these use a buck converter to reduce the voltage to the set output, or to the right level to maintain a constant output current. They are efficient, meaning little power is dissipated on them, but some noise is coupled through to the output, and they may have some nasty RF emissions meaning that everything in the room will pick up some noise.
Linear: these use linear voltage regulators to drop the voltage, with basically no output ripple. However, they are very inefficient. So at big voltage drops and high currents, they will get very, very hot! This usually means that all the control circuits on the same board or in the same box also get very hot, so the output can drift.
Mixed mode: these designs use both switching and linear regulators. Linear regulators require a voltage drop of around 2 V to work properly, but any more is simply a waste of power. So in mixed mode supplies the majority of the voltage is dropped on an efficient switching regulator, and the rest on a low noise linear regulator. This is great as the output is quiet and the minimal voltage drop on the linear regulator means it doesn't heat up like a kettle. In practice however, this means that the feedback network for voltage control can be complicated.
But no need to worry, this design has you covered.
Step 2: The Design
This design is based on an article by Keith Szolusha from linear technology. It might seem complicated but stay with me, it's explained step by step in a few key parts (start with the block diagram).
At the core are the rugged LT3081 linear regulators which can be connected in parallel to output as much current as you want. I won't do LT's marketing for them but they are pretty awesome regulators.
The output voltage is set by inserting a current into the set pin of each regulator. To get accurate results here, a current source and a potentiometer (to set the output voltage) are used. The LT3081's already have a function for limiting current, which is simply set by a potentiometer between the output and the Ilim pin. This design includes a few more resistors to get the most out of the turning range of a potentiometer.
The output voltage of the switching regulator (LTC1624 in this case) is set by a fancy feedback network which puts it 1.7 V above the overall output. This is the minimum voltage drop possible on the linear regulators, so they don't heat up that much in practise.
The specs / my design:
From my experience, most projects only really require 15 V and 3 A maximum, so this is the basis for this design. But I intend to make several of these units so if need be, they can be put in series or parallel to boost the voltage / current required.
The maximum output voltage is limited by the linear regulators and can be 34 V, if you want to alter my design.
The primary power supply:
The easiest solution here is to use a switching module, it's cheap (£7) and throws out 24 V / up to 9 A :
I have found these to be pretty quiet with RF emission as well, but any constant voltage source will do as long as it has enough watts and high enough voltage for your application.
The schematic: Attached is the full schematic for this power supply. I'll explain what each key component does and what you need to look for if you want to use a different chip .
Switching regulator: this outputs a voltage that is 1.7 V higher than the set voltage (or set by current limit). In my design I used the LTC1624, which can be found pretty cheap on Ali Express. But you can use a different one without changing the feedback circuit as long as the reference feedback voltage is around 1.2 V (picture). The regulator must be able to handle the combined current output of the power supply.
Linear regulators: these are the core of the design, and can be found for £8 a pair:
Each regulator can comfortably handle 1.5 A so put as many in parallel as you require. Usually you cannot do this with regulators but the lt3081 are pretty awesome so as long as there is at least 10 mR resistance on the output of each one then it's fine. I need 3 A so I'm putting 2 in parallel.
Current source: this outputs a constant current which sets the output voltage via a potentiometer, around 1mA output per linear regulator is required. Any temperature stable current source will do here, I used the LT3092 as in the original article. It's pretty common so have a look.
Negative voltage source: For the linear regulators to work properly, they need at least 4 mA pulled from their output (each). This is a problem at very low voltages, as a resistor cannot be used. The solution is to generate a small negative voltage (-3.3 V) and limit the current flow into it using a transistor. My design uses an inverting charge pump, LTC1983-3, which only requires a few external caps to work and an npn transistor limits the current to around 10 mA. This could be replaced by any negative voltage source and current set by resistor R12.
Voltage and current measurement: this is not critical to the operation of the power supply, but saves you pulling out the multi-meter every time you want to use it. In my design, I wanted something which is accurate to the order of mA (it's useful to see how much current things draw), stable with temperature and requiring little calibration / re-calibration. The perfect solution is a chip by Texas Instruments. The INA260 has an internal current shunt (2 mR!!!! which is crazy) with a built in adc for current / voltage measurement, and is internally calibrated to be accurate to around +/- 1.25 mA and mV. This is extremely hassle-free and goes perfectly with an arduino. However, it is only available from TI themselves, so it costs around £8 for 2 of them.
It could be replaced with a current shunt and a current sense amplifier, just be careful that you don't put too many volts into your ADC. If you decide to do this then you will also need some precise current / voltage measurement equipment, and go through a lengthy calibration process with some light statistics (chi-squared fitting). So I would say the £8 is worth it.
Voltage /current limit controls: the set voltage / current limit is set by a variable resistor, the simplest solution here is to use some quality, wire wound, 10 turn potentiometers:
Although, these can be replaced with digital potentiometers for digital control, described in the next section.
Microcontroller: this is just to display current / voltage. Or is necessary if you want digital control (next section). I used an arduino pro mini clone as it's small and does the business (can talk I2C). But if you want something with a bit more power then go for an STM32 nucleo board.
Display: to show the current / voltage reading from the INA260 I used a cheap 16x2 LCD display. Use anything here as long as it can interface with an arduino.
The rest: The rest of the components like capacitors, resistors, transistors... you can use anything you want as long as it can take the volts and amps. If you want to add digital control then a rotary encoder would also help.
Bill of materials: A full list can be found on my easy EDA project:
You may have noticed that this is mainly built of LT parts, so I have created a model in LT spice (it's free!!!)
You can use it to check what voltages and currents are at each part of the circuit, or see if you can interchange some components. If you want to REALLY know the details of how this circuit works then playing around with this model is the way to go.
If you dont know how to use it, afrotechmods made a short and helpful youtube series which will show you the basics:
This is a long list but at the end of it you get a quality tool which will last, so definitely worth it!
Step 3: Optional Design Extra: Digital Control
If you want your power supply to be digitally configured (i.e. you don't like messing around with potentiometers) then the simple solution is to replace them with digital potentiometers. The problem however, is that there can be some pretty high voltages floating around the circuit so the cheapo eBay ones won't do. In fact, the only suitable ones that I have found are the MCP41HV51 range from microchip (again not very common I'm afraid).
Keep in mind that a few other issues arise if you want to implement this:
1) The resistance does not go in even steps, therefore some calibration is needed to convert step number (in digital potentiometer) to output current / voltage, this is further explained later.
2) The resistance floats with temperature, so put them far away from the regulators on your board. Also, this will be affected by ambient temperature more than wire wound pots.
3) Digital potentiometers have wiper resistance which is always there (around 50 R), so this may limit your range of output values.
4) The microcontroller code will get more complex.
Step 4: Gather the Components
Aliexpress / eBay should be a good start in searching for the components. You can also use legit sources like Digi-Key, RS, Farnell or simply buy from the supplier. These sources have free to open accounts and do accommodate small orders so don't be scared if you have never bought anything from there.
Packages: when buying any IC, always check the packages it comes in. For this type of project, DIP is preferable but very rare. SO and TSSOP packages are quite common so try to get those. There are some pictures in the next section on how you can solder them by hand without a custom pcb. Avoid any IC with pads unless you can get a custom pcb and are familiar with reflow soldering (I did not use any in my design on purpose).
Extras: I would also recommend a line filter (EMI filer) before the primary, an RF choke after the primary supply and some mounting posts to connect the output to.
Such a huge list of components may be daunting, but go through it methodically and it should cost less than £40 in total.
Step 5: Bring the Design to Life
Time to put this thing together.
For such a circuit, the professional choice would be a 4 layer pcb. I have done so for my design and will be uploading the finalised files shortly. My first design for this project used half digital (for current limit) and half analogue (for set voltage) control, and I used this to optimise the design / measure its performance.
The cheapest place to get a custom pcb made would be OSH Park:
This would cost no more than £60 for 3 boards. But if you are not too fussed about spending a day soldering then just grab yourself some vero board. I would recommend the pre-tinned stuff:
Lay it out nicely, with the output far away from the switching converter, enough heat sinks for the linear regulators, and control circuits far from anything that gets warm but keep the wires as short as possible. You could also add a ground plane to improve your design, simply get some 0.1 mm copper sheet:
add it to the backside of your pcb, poking holes to make ground connections (picture).
Some of the components only come in awkward packages, not to worry, you can get adaptors to DIP:
And I've added some step by step pics to show how to solder to them if you are unfamiliar (it's not hard and does not require a great soldering iron).
I would also recommend using smd resistors and capacitors, as they save space and you get much less unwanted inductance. Again, I've added a few step by step pics to show how to solder them.
Remember to test your design as you go along, if you have missed a connection or something then is a lot easier to trouble shoot in the early stages of assembly.
Step 6: Arduino Code
After you have finished assembling the control circuits, it's time to visualise the output through a microcontroller.
For this I first assembled a prototype on cardboard (picture). This is optional but I would recommend it before making anything permanent.
I have included the arduino code for my design, you can adapt it to suit yours by changing the pin numbers, and look up the set-up commands for the INA260 (page 21 in the datasheet). They dictate how the INA260 averages the values in order to give noise free readings. This code is fairly simple and mainly uses the wire library to talk to the INA260, then does some averaging to spit out the results in amps to the lcd by the liquid crystal library.
I have also included the code for my half digital prototype, this is a lot more complex and involves use of a rotary encode to set the current limit, as well as a menu to decide how to show the results. If you are attempting this then I'm assuming that you know a bit about arduino programming to alter the code as need be.
Step 7: Calibration (Only for Digitally Controlled)
If you have opted for the digital control design (or without using the INA260) then your microcontroller needs to know which stop on the resistor ladder leads to which output current / voltage. For this you need to fit some data to a function. The way to do this is using something called chi-squared fitting. I will explain with an example.
Let's say that you are measuring some value (like current) with an ADC. This just gives you a number that you need to turn into a useful value like current in amps.
So you measure the current with a meter and record what ADC value relates to what current.
Let's call the data that you get (adc output): "data", and what you want to turn in into (i.e. the reading on the meter: current in amps): "real data". What you need is some kind of mathematical function for which you input data and get "real" data out.
Look at the data and decide what function is appropriate. E.g. plot out the data and real data and look at the relationship. If it is a line then you only need a linear function to turn data into "real" data. In practise that has the form y = mx + c OR "real data" = (a*data) + b so you just need to find a and b, which are constants.
This gets more complicated when your data is not linear and the functions get more complex. The most common functions are included in the picture. For digital potentiometers, unfortunately they usually have a sinusoidal component. But this has the same solution, you just need to find the right constants.
Finding the constants
To find the constants, the simplest way is to use Microsoft Excel and the solver add-in, I have pictures of an example for a quadratic function with 3 constants to find. First make a spreadsheet with the following columns:
real data - the values you want to see e.g. current from multimeter
data - the data you measured e.g. values from adc
constants - these are what you need to find, set them to zero for a start
fitted data - this is a function which takes data with constants and, if your constants are perfect, spits out "real" data (this will not be the case at the start when the constants are set to 0 but solver will find them for you). This will look something like "=(B2*B2*$B$21) + (B2*$C$21) +$D$21" (my example).
Chi - this is the difference between the fitted data and real data. For a perfect fit these would be evenly spaced around 0. This will look something like "=A2-C2".
Chi-squared - simply square the previous term.
Sum - this is a sum of all squared chi terms. The best fit is when this is as low as possible (ideally 0).
Now, you need to change the constants to get the lowest possible sum term. Excel has a function called solver which will do this for you. Open it from the data tab and set the objective to the sum cell, the "variables to change" to the cells with your constants in them, set to find the minimum and press solve.
BAM!! If all is well then you have found an equation which can take your data, use your constants and output the "real" data. You can then put this function into an arduino sketch to permanently turn any adc value into a meaningful current!!
Sometimes solver does not give you the best answer you can tell this by looking at the chi plot. If this is not perfectly spread around 0, it means your fit is bad or the function is not the right one for your data (if you have any mathematician friends, I'm sure they would love to help you out for this part). If the fit is bad, you can try getting solver to find the optimum for each constant in turn and see how good you can make it.
I have included my Excel spreadsheet as an example so you can play around with it, and if you want to see how to implement this in arduino then have a look at my code in the previous section. The alternative to this method is to simply put a look-up table into your code, but this does not account for random errors in your measurements and takes up a lot of program space.
Step 8: Admiring / Further Upgrades
Now use your newly acquired power for good.
Let's test the specs that I mentioned at the start:
Look at that clean oscilloscope trace - small analogue measurements are not a problem anymore.
Accuracy tested with the multimeter, very nice. (several pictures)
Let's have a go at measuring the output voltage noise. For this, a low inductance tip is required (picture), and is placed right between the output capacitors. The results? Pretty sweet!! Have a look for yourself.
Remember it's a rugged power supply so don't be afraid of short circuiting it. The only thing I would be careful about is charging batteries, accidentally switching the power supply off while a battery is connected is a known power supply killer, so be careful!
Taking it to the next level: Find a sweet aluminium box to hold your creation. Just look for "electronics enclosure" or "project box" in the usual places. An aluminium box is recommended as you can attach the linear regulators to the box to act as a big heat sink, so no fans needed! You can see mine in the pictures, it's pretty small but that's all that is required.
I would also recommend making several of these boards, as they are not that expensive and can then be combined to give higher voltage / current, or to be used as a negative and positive rail for amplifiers.
In conclusion: Avoid the power supply envy and make yourself something quality.
I would love to hear what you think! If I didn't explain something properly or you have any suggestions then let me know in the comments. Cheers!
RazvanD made it!