Introduction: DIY Variable Bench Power Supply
Second Prize in the
Power supply is an utmost essential tool for an electronic lab. It comes in handy for powering up various applications and circuits. However a fixed voltage, fixed current power supply is sufficient for basic needs but a variable one is good to have because different circuits and components operate at different voltages and consumes different current. When it comes to an electronic hobbyist’s lab, a good power supply is must to have. Also if the power supply boosts additional features like on board voltage and current display, it comes in handy as one can know the exact voltage at the output terminals and also the current drawn by the load. But in the electronic market, those power supplies are not economic are meant for industrial purpose . Here in this article I present an economical and cost effective yet efficient variable bench power supply that is capable of providing 1.2 to 25 Volt variable supply up to 5 Ampere through one channel while 5 Volt, 1 Ampere and 12 Volt, 1 Ampere supply through other two channels thus having one variable and two fixed supply channels. It also displays the voltage on the output terminals and also the current and instantaneous power drawn by the load on an on board LCD display. Not only this one can connect this power supply to his personal computer via the serial port and can see the voltage, current and power drawn by the load graphically. The project is portable and simple to build that even a newcomer can build this power supply with ease and add into his lab. The project uses component that are easily and cheaply available. The project is composed of two modules, one is main power module that consists of linear voltage regulators with rectification and filtering circuitry for supply generation and regulation while the other is composed of a micro controller which is used to sense and display the current and voltage across the variable supply channel. The second section only provides an additional functionality of displaying current and voltage, however one can build the power supply even skipping the second section leaving it functional but without the display feature.(Actually this version 2,I have already build one which was later modified with new features).
Step 1: The Power Section Block Diagram
The block diagram is divided into two parts, one for each section :
The main power section is the one which is used to derive a regulated DC voltage from the mains 220 V AC input. The diagram is divided into four sections. First one is the step down section which converts the 220 V AC input into 20 V AC. This uses a step down transformer. Then second section is the rectification section which rectifies the AC component of the signal of its input. It uses a bridge rectifier. Then the signal is passed onto the third section which is the filtering section which consists of capacitors which act as a first order low pass filter and further smooths the signal. After this stage, we get a smoothened DC voltage which is ready to be interfaced to the next section which is the regulator section. Now as we have three channels for our supply output that is one variable supply channel and two others are fixed ones, so the regulator section is further divided into three sections one for each channel. The two regulator sections comprise of a fixed linear voltage regulator while the third one consists of a variable linear voltage regulator. Thus at the end, we get our three channels of power supply which goes to the output terminals.
Step 2: The Interface and Display Section Block Diagram
The block diagram for the second (version 1) section is given below. This is the interface and display section which senses the current and voltage on the variable supply channel and gives off the readings to the LCD display and computer.It consists of a voltage divider section and a series shunt arrangement at the variable supply channel for sensing the voltage across the terminals and current through load respectively. A non-inverting amplifier is used after the shunt arrangement to amplify the voltage drop across the shunt resistor. The outputs of the voltage divider network and the non-inverting amplifier goes to analog-to-digital converter inputs of a microcontroller in the next stage which converts these real time analog data into digital ones so that it can be processed in the microcontroller, interpreted and sent off to the serial interface and display section. Two buttons are provided to act as inputs and a buzzer is there to give audio messages.
Step 3: Power Stage Circuit Description
Version 2 description (in addition to version 1) :
Version 2 of this power section is similar to the version 1, rather only some minor improvements were made like we have increased two more 4700uf,50V filtering capacitors, and added 100nf ceramic caps after LM7805 and LM7812 for functional stability purpose. Now earlier,we were directly feeding >25v DC to the inputs of LM7805 and LM7812 regulators which was not a good idea because the power (as heat) dissipated from the regulator is directly proportional to the voltage difference across it and current taken from the regulator, so to minimise the power dissipation, we have to minimise the voltage difference across the regulators. So we have included a series array of 1N4002 (or any general purpose diode) to make an appropriate voltage drop before it goes to the two fixed voltage regulators.So after diode D18, we will get a nominal voltage of 16v which feed the LM7812 and a nominal voltage of 10v after D26 which feeds the LM7805. Although this is not the best way to do it, you can also use a dual secondary core transformer with lower voltage at the second secondary to feed the LM7805 or LM7812.
Version 1 description :
It comprises of a step down transformer (TR1), four 6A diodes(D1-D4), regulator LM338(IC1), regulator LM7812(IC2), regulator LM7805(IC3),and a few discrete components.
A fuse of 0.6 Ampere rating is connected in series with the primary of the transformer to prevent short circuit. The step down transformer can be any with primary input of 220V AC and secondary output of 20V AC with a current rating of >7Ampere. The four diodes used are any general purpose power diode with current rating of more than 6 Ampere, example GI820, MBR750, P600, etc. A 100nF, 50V capacitor is connected in parallel to each of the rectifier diodes(D1-D4).These capacitors are mainly meant for smoothing purpose. Instead of these four diodes, one can use a single module bridge rectifier with power rating of more than 6 Ampere.
The LM338 is an adjustable 3-terminal positive voltage regulator, capable of supplying in excess of 5A over a 1.2V to 32V output range. It is exceptionally easy to use and require only 2 resistors to set the output voltage. A unique feature of the LM338 is time-dependent current limiting. The current limit circuitry allows peak currents of up to 12A to be drawn from the regulator for short periods of time. This allows the LM338 to be used with heavy transient loads and speeds start-up under full-load conditions. Under sustained loading conditions, the current limit decreases to a safe value protecting the regulator. Also included on the chip are thermal overload protection and safe area protection for the power transistor. Overload protection remains functional even if the adjustment pin is accidentally disconnected. The device provides an excellent line regulation of 0.005%/V when 3V ≤ (VIN − VOUT) ≤ 35V and load regulation of 0.1% when 10 mA ≤ IOUT ≤ 5A.
The LM7805 and LM7812 are three terminal positive regulators are available in the TO-220 package and with fixed output voltages of 5V and 12V, making them useful in a wide range of applications. Each type employs internal current limiting, thermal shut down and safe operating area protection, making it essentially indestructible. If adequate heat sinking is provided, they can deliver over 1A output current. A maximum of 35 V DC can be supplied to the input of these regulators provided that the device is properly mounted on a heatsink.
The 20V AC secondary output of the transformer(TR1) is fed directly to the bridge rectifier which rectifies the AC component and convert it into DC voltage.
As because, we are using bridge rectification configuration, the ideal average magnitude of the output of the bridge rectifier is given as:
V(peak) = V(rms) X √2 = 20 X √2 = 28.2848 volts
And after subtracting the voltage drop of the two diodes that work in series in working of bridge rectification,we get the actual approx output voltage as:
V(actual) = 28.2848 - (2 X 0.7) = 26.88 volt
which is approximate to 27 volt.
This is filtered with the help of C1 capacitor which acts as a low pass filter there.
The LED(LED1) lights up when the circuit is switched ON.Then this signal is fed to the input of the three regulators.
Referring to the datasheet of LM338, a dropout of 1.5 to 3 volt appears in the output of the regulator from the input when the working temperature is increased from -75 degree celcius to +150 degree celcius. However at normal working range from 20 to 40 degree celcius, a typical dropout of 2.6 V is obtained when the current drawn from the device is max 5 ampere.
Thus at practical 27 volt DC input we obtain a variable voltage range from 1.2 volt to 24.4 volt which is sufficient for our purpose. A fixed voltage of 5 Volt and 12 Volt is obtained from LM7805 and LM7812.The LM338, LM7805 and LM 7812 should be mounted on a proper heatsink. However, it is very important to note that the heatsink of LM338 should not touch the heatsink of the other two regulators. It should be mounted on a different heatsink. This is because, the metal cap(body) of LM338 is connected to its V(out) internally while that of LM7805 and LM7812 to the ground pin. If all of them are connected on the same heatsink, it will lead to short circuit of LM338. When external capacitors are used, it is sometimes necessary to add protection diodes to prevent the capacitors from discharging through low current points into the regulator. Most 20 μF capacitors have low enough internal series resistance to deliver 20A spikes when shorted. Although the surge is short, there is enough energy to damage parts of the IC. In operation, the LM338 develops a nominal 1.25V reference voltage, VREF, between the output and adjustment terminal. The reference voltage is impressed across program resistor R1 which is of 240 ohm and an external potentiometer of 5 kilo ohm is connected between the adjust pin and ground.
Step 4: Interface and Display Circuit Description
Version 2 circuit is also shown (I recommend to build this).This one has additional features to switch ON/OFF load and more features.Sorry the description of v2 is not done,but is actually the same as v1(which you can read below with reference to the version 1 circuit above) with some minor amendments.Also to remember to connect the NORMALLY OPEN relay contacts (in version 2 only) in series with the output positive load rail (variable channel) after the V_sense(B) wire.
Version 1 description :
This stage is composed of a stepdown transformer(TR2),an AVR microcontroller ATmega8, serial interface MAX232,an op-amp LM741, a 16X2 character LCD and a few other discrete components.
This stage is powered by a different transformer(TR2).This is because if we power this section with that of the power section transformer only, and if a heavy load is connected at the output of any of the regulator, it will drop the voltage across the terminals which will either restart the microcontroller or not let this section to function properly because microcontrollers are more sensitive to voltage fluctuations. A 500mA , 220V AC to 9V AC stepdown transformer is sufficient here to power this module. Using bridge rectification by four 1N4007 diodes and filter capacitor C1, C2 and another LM7805 regulator, we obtain a regulated 5 volt output which powers the microcontroller.
ATmega8 is a low power,8-bit microcontroller based on the AVR RISC architecture. It has 8kB in-system programmable flash memory with read-while-write capabilities, 512 bytes of EEPROM,1kB serial random-access memory(RAM),23 general purpose input/output (I/O), 32 general purpose working registers, three flexible timers/counters with compare modes, internal and external interrupts, analog to digital converter and a two wire serial interface.
The LM741 is a general purpose op-amp easily available in DIP8 packages.
However other op-amps can be used but LM741 is an efficient and economic solution for what we need in our application.
MAX232 is serial interface IC that provides voltage level conversion between the serial port of microcontroller with that of the personal computer. This is essential here, as the microcontroller operates at max 5 V DC supply and the computer’s serial port operate at different voltage levels like it uses -3 to -25 volt to indicate logic 1 while +3 to +25 V to indicate logic 0. So MAX232 acts as a translator between the two devices.
Two switches A and B are connected to pins PC.5 and PC.4 of the atmega8 respectively externally pulled up by 10k resistors, which will be used for changing the display mode of the supply and for enabling/disabling the serial transmission. A LED is connected to pin PC.3 which is used to display the status of serial transmission. A piezzo buzzer is also connected to pin PB.0 which gives audio beeps when device is switched ON or a button is pressed to change the menu.
As shown in the circuit,the lower D port is connected to the lower nibble of the LCD, and the E and RS pins on the LCD are connected to PD.3 and PD.2 respectively. Pin R/W on the LCD is grounded. The pot R3 here is used to adjust the contrast of the LCD.
The TXD and RXD pins of the microcontroller are interfaced with the MAX232 on pins 10 and 9, and pins 7 and 8 are connected to the external DB9 serial connector which can be connected to the computer via a serial cable. Pin 16 and 15 of MAX232 are Vcc and ground respectively.
Pin 20,21 and 22 on the atmega8 setups the configuration for using internal 2.56 voltage reference for the inbuilt ADC of the chip. Pin 1, which is the reset pin is pulled up with the help of an external 10k resistor.
Now coming on to the current and voltage sensing sections, a voltage divider made up of two resistors R6 and R7 scales down the variable supply channel voltage so that it can be interfaced to the inbuilt analog to digital converter of atmega8.This is the connected to ADC0 (pin PC.0) of the controller.
For current sensing we use a shunt resistor of 0.3 ohm in series of the variable supply channel, thus a voltage Vsense is developed across the resistor which is amplified with the help of non-inverting amplifier made by LM741 op-amp. The gain is set to 1.7 with the help of resistors R9 and R8.
The connection A is connected to after the shunt resistor, and connection B to positive terminal of LM338 output as shown in the last figure.The ground of the two sections is made common and is utmost necessary to connect the ground of both the sections with each other.
Step 5: The Microcontroller Code (for V2)
The code for the microcontroller is developed using BASIC language in BASCOM compiler.
It is hence very easy to comprehend. Initially we set the microcontroller configuration file and the crystal frequency. It is important to note that the code is developed to run on 8MHz frequency and the internal 8MHz RC oscillator is used here because this much frequency is more than enough for our operations and we use internal oscillator of the microcontroller only so as to reduce the cost of space and cost of external crystal. The baud rate is set to 9600. After that we initialize various variables to implement our algorithm, and the ADC, IO ports, LCD is also configured. The software uses two functions that is the movingaveragevoltage and movingaveragecurrent which implements the moving average window for the calculated values of current and voltage. This increases the accuracy of the calculations and also maintains stability of the display variables. Instantaneous power is also calculated and displayed using these variables only. The software calculates the current and voltage after getting reading from the ADC0 and ADC1 and the uses some inverse ohms law and display it on the LCD. For serial transmission, it frames the values of current , voltage and power in a string and send it to the computer which is decoded at the computer side only which is running a Visualbasic application.
Two zip files are enclosed here:
MCU CODE v1 zip file----> for version 1 power section and display section circuit
MCU CODE v2 zip file----> for version 2 power section and display section circuit
Step 6: The Computer Application
The computer application is designed using VisualBasic 6.0,which is a rapid application development platform for developing GUI based applications for windows operating system. The complete source code is provided with the project. The screenshot of the application is shown in fig.6 below. The application boosts an onboard digital display that reads the actual current, voltage and power readings from the hardware. The application uses the MSCOMM32.ocx object to display the data on a graphical chart .The chart is internally in sync with the latest reception of coded framed string by the hardware. The string id decoded in the application the current, voltage and power readings are extracted. The application also displays the maximum value of current, voltage, and power registered on the output terminal of the hardware.
To start the application, simply select the com port number from the dropdown menu to which your hardware is connected to the computer, then press the “Open” com port button. The com port is ready to receive data now. Now on the hardware,click “Button B” which will enable the serial data transmission from the hardware. Now you will see that the updation of reading is started in the application. You can stop it using the same button again. To reset the graph click on “Reset” button. You can also change the strip chart view by using additional buttons provided to the left side of the application like WRAP/PAN mode,enable handles,enable grids,etc.To stop the com port simply click on the “Close” button.It is to note there that if you want those digital display fonts in the application,simply copy “digifaw” font provided in the source code folder to your font folder in the computer and then restart the application.
Step 7: Precautions
One of the major thing to note while using and designing the power supplies is that the regulators get hot in case excess current drawn from them. It can be handled by using adequately sized and good quality of heatsinks on the regulators. The LM338, LM7805 and LM7812 in the first section should properly be mounted on heatsinks keeping the LM338 on a separate one. It is optional but good to add a fan near to the heatsinks that will displace the hot surrounding air near the heatsink to outside the hardware chasis. Simply connect a 12V DC fan to the unregulated DC output of the power supply in section second power supply just before the LM7805 regulator that will power the fan from there and place the fan very close to the heatsinks. No heatsink is necessary (but recommended) for the LM7805 regulator of the second section because the microcontroller circuit consumes current less than 300mA which will obviously not heat up the regulator as it is rated upto 1 Ampere. I enclosed my project in a plastic case but it is recommended to use a metal one.
We have a be nice policy.
Please be positive and constructive.