Category Archives: PSU

Programmable Lab PSU

Starting at left with 230VAC input we need a classic rectifier and filter that will produce high voltage DC out. This is input to a PWM driver that will use HEXFET’s to generate a MCU controlled PWM into the isolation transformer. The duty of the PWM decides the output voltage. If we have 400VDC and a duty cycle of 10% we will have 40VDC in average out. The 2nd rectifier ensure we got all positive voltage out and the end Filter (illustrated below) convert this to a stable DC out. To Control this we use fast ADC’s to read output voltage and current into the MCU that control PWM duty.

The core of any PWM driven PSU is the prinsiple that we provide a PWM in where an output filter consisting of a coil and capacitor force this back to a stable DC. Voltage out is a simple average calculation, meaning that we control voltage with setting PWM duty.

Building a 0-50V/0-20A Lab PSU

I ordered a DPS5020 (50v/20A) Lab PSU for 45.- USD with USB connector. I intend to hack that serial port and extend the HMI with my own interface, but my primary challenge is finding an affordable AC/DC that will deliver 60V/20A as input. I did find some interesting alternatives:

This is 36V/5A and well suited as input stage for a 0-30A/0-5A Lab PSU. It is also quite small. I ordered one of these because it only cost ca 11.- USD P&P included. A 20A PSU is a monster needed for motors, but a 0-30V/0-5A is a “bread & butter” PSU that you need several off.

The best priced single 60V/20A unit I found is this that actually is 25A at 124.- USD. You have to be aware that both voltage and current will drive prices a bit, but as I know that higher currents are the worst to deal with I looked for 60V/10A units and found the one below.

This cost ca 30.- USD if you order 10 units so I need to think about that. You can also buy them single units for ca 36.- USD. To achieve 20A I would need 2 of these that require some size, but the advantage is that I make 20A wires myself which makes each driver PSU cheaper. This gives me a cost of a driver stage around 70.- ++ USD which is decent.

Getting a box for the largest 50V/20A Lab PSU will cost around 100.- USD sadly. Adding 70.- for a driver stage and 45.- for the module + an estimated 30.- for extra bits I will land on ca 245.- USD for a 0-50V/0-20A Lab PSU.

The “bread & butter” 0-30V/0-5A Lab PSU is easier. We can pack 2 modules into the 16.- USD Blue box I showed you before and with 2 x 30.- + 2×10 and some 20.- in extra parts we should have a small, dual PSU for ca 116.- USD (of ca 58.- USD each).

Both those are decent options taken into account what the spec of these PSU’s will be – that said I want to receive the units and do some testing before I invest more time and Money on this.

0-50V/0-20A Programmable Lab PSU – DPS5015 & DPS5020

DPS5015(0-50V/0-15A) and DPS5020(0-50V/0-20A) are DIY modules available for ca 40.- USD. It exist several of these. Notice that input here is 60V DC, so you need a AC/DC converter in front of this.

I have looked at these for a while as I plan to build some Lab PSU’s.  It is an interesting option. The USB/Bluetooth adapter with the software below is very interesting. The module uses a UART With Modbus RTU – the protocol doc is in Chinese, but I hope someone will translate this to English.

One can never have to many lab PSU’s ….

3.3V 5V, 12V or 15V Switched PSU

This is the PCB for my switched PSU. It takes 40V in and can be made to produce 3.3V, 5V, 12V, 15V etc. With Pictures you loose a bit feeling of the actual size, so I put a TO247 transistor next to it – this is the smallest PCB I have made so far.

It is designed as a drop in replacement for linear regulators since I often need 2-4 PSU’s on a motor/PWM design. Regulating from 40V to 3.3V means you use a lot of Power. Will assmble a few of this for testing later.

Lab PSU 0-30V /10A – Part 13

Right now I am waiting on heat sink material so we can start testing the regulator with 5-10A continuous. I have done a few tests without and managed to burn transistors. My small fan’s do help a lot, so I expect a combination of heat sinks and fan’t to do Wonders.

Heat dissipation is the Achilles of this old linear regulator but, I just fancied doing this old design before I start on a more modern, digital PSU. The advantage of this design is low noise – or at least should be.

I had some challenges with the current regulator, but finally realised reading up on the issue that voltage between pin 2 & 3 on LM723 need to be ca 0,62V before it start working. This means I probably need to consider using a relay to switch current range between shunts for 5A & 10A because shunts designed for 10A will have little impact in the lower area. I will return to this as soon as I get the heat sink and fan’s mounted properly.

The blue metal box I purchased (below) is ok. For 17.- USD this is good value, but it is a bit small for what I want to do. I probably need more space due to heat dissipation at 10A, but we will see – I actually ordered more of these boxes due to their good value.

Something else that is very clear is that I need to mount temperature sensors and activate overheating logic by cutting output if the transistors overheat.

PLC Backbone Block Diagram

Using STM32F405RG on everything is an overkill, but I can always consider dropping down to STM32F105RB/C later. This M4 gives us a powerfully MCU on each module capable of truly distributed processing as we are promoting in Plain.

Ethernet Module is what I have started on now. This will host a STM32F405RG, 2 RS-485’s for the backbone, a W5500 based Ethernet and optionally a ESP-12 module for wireless. I am also adding RTC battery, SPI flash and a SWD connector. I need to see what space I have available, but as with my previous Raspberry PI Hat’s I intend to re-use much of the MCU related design on every Board if pins & space allow it.

RS-X Module connect the 2 backbone lines to 3-4 isolated network lines. I want isolation on anything in & out of the PLC.

Mobile Phone module is for internet connectivity on remote places or as a secondary backup should a primary internet be cut. It exist so many small, low cost modules these days that we just grab one of those.

Battery Control Module is so we can connect a LIPO package to operate if mains fall out. This should also include charging and monitoring of the battery.

PSU Mains Module is basically PSU modules needed for 5V, 12V, 24V &48V.

Raspberry PI Module will allow us to interconnect with a Raspberry PI for computing, Ethernet, Wifi, USB, Bluetooth etc. The target here is Raspberry PI 2, 3 or Zero W.

Analogue Input Module is a x channel 16 or 24 bit ADC input module. This allow us to read analogue sensors with some accuracy. We need more than the internal 12 bit ADC, so I am thinking maybe a low cost 12 bit board and a bit more expensive 24bit board.

PWM Module is a x channel PWM output, each channel formed as a Half H-Bridge and supporting 2A continuous current. We probably should manage 8 channels – not shure.

Composite Camera Module. I am not sure about this board as I am tempted to use H.264 camera’s only in which case I will ditch this module.

Sound In/Out Module is basically targeting doorbell, but I am open for the possibility to provide a multi-channel music mixer as well. I need to consult with friends in the London music industry a bit, and it is possible this actually will be several boards to adapt to a stage show.

DC/Stepper Module will basically be very similar to the PWM module, but I probably need various currents & voltages for different motors. I am thinking only of small motors supported directly because I expect separate controllers for the larger motors.

3-Phase Motor controller – well, the name say it all, but I am not sure I want to make this board. The reason is because a 3-phase motor usually require some power that is better handled on a separate controller on the other side of an isolated RS-X. Let’s see…

Servo Controller is probably a 16 channel controller like we created before on a Hat, but I will be using Timer’s for PWM this time to get a 16-bit resolution on the PWM duty out.

As mentioned a few times before – this is an idea draft and I write it down to let it mature – plans will change.

Lab PSU 0-30V /10A – Part 12

The good thing about a blog is that it is excellent for notes – if I make my work-notes here they are called “documentation” 🙂

The following are programming notes for the PSU Control Board:

PA10 – GPIO J1-4 Relay 1 – Connect extra 12V – 36V If Relay 2 is On.
PA9 – GPIO J1-5 Relay 2 – Connect extra 12V – 24V
PB1 – GPIO J1-6 Relay 3 – Switch On/Off Output from regulator.
PA7 – ADC J1-7 Temperature 3
PA6 – ADC J1-8 Temperature 2
PA5 – ADC J1-9 Temperature 1
PA4 – GPIO J1-10 Fan 3
PA3 – UART1 J1-11 RX
PA2 – UART1 J1-12 TX
PA1 – ADC J1-13 V Out. Measure Out Voltage in a split 10:1
PA0 – ADC J1-14 CSense Out. Measure Voltage in a split 10:1 before current shunt. CSense – V Out = shunt voltage.

Current Out = Shunt Voltage / (0.47R / 2)

PF0 – GPIO J2-6 Fan 2
PF1 – GPIO J2-7 Fan 1

Note 1: A 12 bit ADC scaled for 30V (30/4096) will detect ca 7mV changes in voltage drop over the shunt. Given a shunt resistor of 0.235 Ohm (0.007V / 0.235R) that gives a resolution on ca 31mA on the current calculations. This is a little less than I hoped for, but the alternative is to use an external current sensor to increase accuracy – I need to work on this a bit.

Lab PSU 0-30V /10A – Part 11

This pic shows my analogue regulator. You can see the 2 transistors and a fan in the back and my DIY load array on top left. I am actually quite happy with this after I mounted it on a proper PSU source in. The only things left is to get the current regulator working, but I am a bit handicapped in testing before I get a proper heatsink mounted. I have so far only tested 5A for a short period and had to abort as transistors started to overheat.

This shows my Control board. I have done more mistakes on this than I like to admit. The red PCB on left is the MCU – had to mount an adapter to allow for SWD connection so I can program it. Will start working on this a bit later. From my previous test I notice that the analogue regulator need ca 4V to work on, so I need to connect the 2nd PSU at 8V and the 3rd at ca 20V.

A few things to work on:

  • Need to get current regulator working.
  • Need to verify 10A continuous.
  • Connected GND rather than 12V on FAN output’s.
  • Forgot pull-up’s into ULN 2003 so relay’s hit in at random before MCU take control.


I purchased this Lab PSU 0-30V /5A from ZHAOXIN a few years back, but I have not really been using it much. What I discovered as I started using it was very dissapointing.

This Lab PSY from ZHAOXIN is far from cheap – it usually cost 80ich USD + 50ich P&P as well as ca 30ich in customs fee – so the real cost is close to 170.- USD if you import one to Norway.

I discovered that it’s out voltage drop under load and decided to do some testing. Adding a resistor array and measuring out with amultimeter I get the following table:

Display Out Current Multimeter Measure
12.3V 0A 12.3V
12.3V 2.1A 8.2V
12.3V 3.2A 6.1V

I actually like this PSU due to it’s cute design & look. As the picture above show it also have a nice, switched design on the inside. But, looking at the table above it is quite clear why I have been having some problems with applications earlier. I can sadly not recommend that anyone spend their money on this one!


Lab PSU 0-30V /10A – Part 10

These cost almost nothing, so I bought a few and plan to use them on my Lab PSU. They have separate PSU and measurement cables – so initially I connected the PSU to the same PSU as I use – the result was that Voltage increased as Ampere increased. Realising the mistake I connected a separate PSU to power the meter and voila – the difference between my meter and multimeter is constant.

It shows that as I increase load and current the out voltage will drop ca 10mV from 0A to 4A – compared to the ZHAOXIN PSU this is great news. The meters above have calibration points on the back. The most important is that the way I mount them is guaranteed to show actual values out – not some fictional setting values.