http://tuxgraphics.org/electronics

A Digital DC Power Supply (programmable bench power supply unit), hardware version 3.0 Abstract: A good, reliable and easy to use bench power supply unit is probably the most important and most used device in every electronic lab.



A proper electronically stabilized bench power supply unit is an important but also expensive device. Using a microcontroller based design we can build a power supply which has a lot of extra features, is easy to build and very affordable.



The tuxgraphics digital DC power supply has been a very successful product and this is now the third generation. It is still based on the same idea as the first version but comes with a number of good improvements.



The components + PCB are available as a kit from our online shop: http://shop.tuxgraphics.org/electronic/index-kits.html

_________________ _________________ _________________



Introduction

The display shows the actual measurement values for voltage and current.



The display shows the pre-set limits for voltage and current.



Only standard components are used (no special chips).



Only one power source is needed (no separate negative supply voltage for operational amplifiers or control logic)



You can control the power supply from a PC. You can read current and voltages and you can set them with simple commands. This is very useful for automated testing.



A small button pad is available to directly enter the desired voltage and max. current.



It is really small but powerful.

The basic electrical design idea

The transistor will die when there is a short circuit on the output.

It provides only a fixed output voltage.

A AD-converter to measure voltage and current all the time

A DA-converter to drive our power transistor (provide the reference voltage)

The R-2R ladder

Generating a variable DC signal with PWM (pulse width modulation)



Using PWM to generate a variable DC voltage.

Combining R2R-ladder and PWM

Oversampling

A more detailed design

The DAC (digital to analog converter) can not provide the current to drive the power transistor

The microcontroller operates at 5V so the maximum output of the DAC is 5V which means that the maximum output voltage behind the power transistor will be 5-0.7=4.3V .

Adding an amplifier stage to the DAC

Vampl= (R6 + R7)/R7

Rin=hfe1 * S1 * R7 * R5 = 100 * 50 * 1K * 47K = 235 MOhm - hfe is about 100 to 200 for a BC547 transistor - S is the slope of the amplification curve of a transistor and is about 50 [unit=1/Ohm]

Rout= (R6 + R7) / (S1 + S2 * R5 * R7) = about 2 Ohm

The limits

BD245B: 10A 80W. The 80W are however at a temperature of 25'C In other words add a safety margin and calculate with 60W-70W: (Max input voltage * Max current) < 65W You can add a second BD245B to go up to 120W. To ensure that the current distributes equally add a 0.22 Ohm resistor into the Emitter line of each BD245B. The same circuit and board can be used. Mount the transistors on a proper aluminum cooler and connect them with short wires to the board. The amplifier can drive a second power transistor (that's the maximum) but you might need to adjust the amplification factor. Current measurement shunt: We use a 0.75 Ohm resistor with 6W. This is good enough for about 2.5A of output (Iout^2 * 0.75 <= 6W). Use a resistor with more watts for higher currents.

Power sources

22V 2.5A version: you need a 18V 3A transformer, a rectifier and a 2200uF or 3300uF capacitor. (reason: 18 * 1.4 = 25V) 30V 2A version: you need a 24V 2.5A transformer, a rectifier and a 2200uF or 3300uF capacitor. (reason: 24 * 1.4 = 33.6V) It does not harm to buy a transformer which can provide more ampere. A power diodes bridge with 4 diodes which are specified for a low voltage drop (e.g BYV29-500) gives a good rectifier.

Transformers and laptop power supply bricks

Other voltages and current limits

Testing

make test_lcd.hex make load_test_lcd

A word of warning for further testing with the final software: Be careful with short circuits until you have tested the current limitation function. A save way to test the current limitation is to use a low Ohm resistor, e.g a car bulb.



Set a low current limit, e.g 30mA at 10V. You should see the voltage go down immediately to almost zero once you connect the bulb on the output. There is still a fault in the circuit if it does not go down. The car bulb will protect the power supply circuit even if there is a fault as it is not a full short circuit.

The software

The code in the interrupt must not be too long as it must finish before the next interrupt comes. What counts here are the amount of instructions in machine code. A mathematical formula, which can be written as just one line of C-code may result in hundreds of lines of machine code.



Variables that you share between interrupt code and code in the main task may suddenly change in the middle of execution.

Software: Which file contains what

main.c -- this file contains the main program. All initialization is done from here.here. The main loop is also implemented here. analog.c -- the analog to digital converter and everything that runs in the context of the interrupt task can be found here. dac.c -- the digital to analog converter. Initialized from ddcp.c but used only from analog.c kbd.c -- the keyboard code lcd.c -- the LCD driver. This is a special version which will not need the RW pin of the display. It uses instead an internal timer which should be long enough for the display to finish its task.

Loading and using the software

gedit hardware_settings.h

make fuse This will set the clock frequency of the microcontroller to 8MHz. The software is designed for this frequency. make This will compile the software. make load This will load the software.

Control of the power supply unit from any PC (Win, Linux, Mac,...)



Digital power supply USB interface with galvanic separation.

Note: we finally decided to use a USB-B socket. The power

supply shown in the title image of this article has a different

connector as it was built before that decision was made.

baudrate : 9600 parity : none flowcontrol: none stopbits : 1 databits : 8



Command interface for the power supply

ddcp-script-ttyinit - initialize the COM port (run this once at at the beginning) ddcp-script-getval - get current values (same as you see on the LCD) ddcp-script-setval - send a command to the power supply

#!/bin/sh dev="/dev/ttyUSB1" # initialize the com port ddcp-script-ttyinit "$dev" # echo "current settings are:" ddcp-script-getval "$dev" # echo "setting voltage to 3.3 V" ddcp-script-setval "u=33" "$dev" # echo "wait a bit, it takes a moment for the display values" echo "to adjust as they are polled in intervals by the avr software." sleep 1 echo "the new settings are:" ddcp-script-getval "$dev"

The buttons



The local control button pad.

The display



The fields in the LCD display area. The real measured values and the set values are always shown at the same time.

Some pictures and ideas







The circuit. Very small but with more features and more powerful than many other power supply circuits.





An old Pentium5 aluminium cooler is a good choice for this power supply. It is compact and very efficient. A cooler that provides about 1K/W is sufficient. You might as well consider to under dimension it a bit. It will normally be very rare that you operate it permanently at maximum current with a low output voltage.





Installing the components in a case





The final power supply unit.





The final power supply unit. -With a green display-





... and with a blue display in a different case. Blue displays are bit difficult to photograph. It looks even better in reality than here on the photo.



References/Download

Download page for this article (firmware updates and corrections will also be available from here).

Enhancing ADC resolution by oversampling [PDF]

Datasheet for the ATmega8: go to http://www.atmel.com/ or http://shop.tuxgraphics.org/electronic/detail_atmega8.html

Tuxgraphics online shop, You can order this power supply unit as a kit from here. The kit includes not only the parts but also additional documentation and the circuit diagram.