Workbench Variable PSU 15V 1A
Table of Contents
- Workbench Variable Power Supply Made From Reclaimed Parts.
- Preliminary Construction
- Voltage Regulator/ Current Limiter Circuit
- Microcontroller and Digital Circuitary.
- PC Software
- Conclusion
Workbench Variable Power Supply Made From Reclaimed Parts.
Background
Recently, while cleaning out some of my junkboxes to make room for some new and improved junk, I had a bit of an epiphany: instead of just keeping the junk in a crate for a few more years before throwing it out, I could actually use it to make something useful, maybe even something that I could use on my workbench.
The Dick Smith 7-digit frequency meter kit from Electronics Australia came in a nice aluminium case
and would have been a nice bit of gear on the hobbiest's workbench circa 1978. It certainly would have looked rather spiffy,
from the outside at least, but perhaps not so much on the inside.
I reckon that designing and building PCBs back then would have been nowhere near as much fun as it is today.
Anyway, the mains wiring and front-panel switch were decently done and in good condition and with a nice multitapped transformer marked as 15V 1A,
Requirements
I figured that a 15V 1A power supply with variable voltage and current limit would be a worthy repurposeing for the old frequency meter and in keeping with it's junk-box origins, I set myself the criterior to only use components reclaimed from other junk-box junk as much as possible. If any non-recycled components were to be used then they must be already on hand, ie there was to be visit to Jaycar nor orders from China.
I also figured that a LCD display showing the voltage and current would be nice, so a microcontroller unit (MCU) was called for, and then, if the MCU could shut down the power supply I could implement an over voltage and over current protection. For example, if I was powering 5V circuitry then I could set the over-voltage value to 5.2V say and then if I accidently knocked the knob and turned it up 12V then the MCU would have shutdown at 5.2V and saved the day.
Furthermore, I have a large number of rechargable batteries that I want to test for capacity so it would be nice to be able to measure the amount of charge in Watt-hours or Joules or whatever, and then too it would be nice to be able to record this data on a PC, so a RS-232 serial connection between the MCU and the PC was called for.
Here's what I ended up with:
A new front panel was made with a piece of PCB cut out and fitted on top of the old panel. The labels were done with iron-on toner transfer and came out okay, mostly in the right places or at least close enough for me not be bothered trying to do it again. From a distance and with eyes slightly squinted, I am quite happy with the copper and black look.
The yellow banana socket is the chassis ground. I painted a red socket yellow as I didn't have any green paint.
Preliminary Construction
These bits, I figure, will be needed regardless of what circuitry I decide upon for the voltage/current regulator and for the MCU/digital stuff, so proceeding in a step-by-step, modular fashion was desirable.
Mains Filter
Firstly, I figured that it would be nice to have a fuse on the transformer primary side. I got a nice leaded one from an old PC power supply and also some class X and class Y capacitors and a common-mode choke thing, so why not make a mains filter while I'm at it? I thought.
Trying to remind myself not to touch the exposed live bits:
The 700k resistor discharges the capacitors on disconnect so to avoid zapping when touching the mains pins.
On fitting, I managed to insulate and protect the exposed live bits:
Bridge Rectifier and Smoothing Capacitors.
My PCBs always come out very professionally in the Kicad 3D renderer:
But not so much in the corporeal world:
I did learn that a paper silkscreen-layer works okay when it is soaked on with superglue.
The rectifier came from an old stereo amplifier, I looked up the datasheet which said that it's rated for 4A so hopefully it's sufficiently over-spec-ed for this application.
And a fuse for the transformer secondary, the fuse-holder is new. 3200uF smoothing capacitor and an option another one if I figure that's needed.
Those green power connectors are pretty handy, I've used them throughout the project. If anyone knows what they are called then please let me know so I can order some more.
5V Power for the Microcontroller and Digital Electronics.
I had a heap of those H7350 5V regulators in the parts bin. I seem to recall buying 100s of them at a few cents a piece. 200mA with thermal protection if I recall.
I hadn't used that device previously and so, of course, I made the PCB with the footprint the wrong way around. Some long leads covered with heatshrink soon fixed that though.
The 200mA current limit might be pretty close to how much the 5V electronics, including the fan, is using. The regulator runs hot to the touch. I superglued a piece of PCB to the case so that might help. Anyway, so far so good, the 5V rail measures at 4.9V.
Thinking that I was being a smart guy, I figured that I could use the 6V tap on the transformer to power the board. Fortunately I woke up one morning with the realisation that it likely wouldn't go well a all. Adding a little 6V transformer from an old radio avoid the potential problem.
Voltage Regulator/ Current Limiter Circuit
I decided on a nice looking circuit designed by Harry from Harry's Homebrew Homepages. If you're not familiar with Harry's website, he has a lot of excellent radio-related content and projects and well worth a look.
- Website: http://sm0vpo.altervista.org/
- Easy Bench PSU: http://sm0vpo.altervista.org/use/psu3.htm
Harry's Circuit
Voltage regulator:
- The two diodes and 150Ω resistor cause TR1 to supply a constant current to the zener diodes, keeping the zener voltage constant regardless of variations in supply voltage.
- The zeners are arranged such that 7.7V is provided as the reference voltage to base of TR4 in the differential amplifier.
- The 50k pot can provide 4.7V to 10.7V to base of TR3, ie a swing of 3V above and below the 7.7V reference on TR4
- TR3 - TR5 and the 22K and 33K resistors work as an op-amp, causing the output voltage to range between 0 and 15.4V.
Current Regulator:
- Rx is sized to cause voltage drop of 0.7V at the maximum current. I wanted 1A max and so used two 1Ω 1W resistors in parallel, which is close enough.
- As voltage across Rx increases, TR2 starts to turn on thus starting to turn off TR1 thus reducing the current through the zeners, hence reducing the reference voltage and hence the output voltage and therefore the output current.
- The 1M pot causes TR2 to turn on sooner and is used to set a current limit below the maximum of 1A or whatever.
Sadly I had no 1M log pots, so had to use a linear and so all the adjustment happens in a very limited amount of travel, making current adjustment a frustrating experience. Seems that 1M log pots are not easy to come by these days. I'm keeping an eye out for one.
I made a couple of mods to the circuit:
- Added another PNP transistor in parallel with TR2, that way the MCU can pull the base low and effectively shutdown the power supply.
. Put a 10k resistor across the output, otherwise, with no load, output will not go below 7.7V because it is connected via the 22k and 33k resistors to the 7.7V tap on the zeners. . Put a schottky diode on the output for use when charging batteries. This ensures that having a voltage at the output will not cause a problem when powersupply is turned off.
Simulating the circuit in LTSpice probably wasn't really called for, but for a hobby project why not?
The spice files are here if anyone is interested.
Transistors and diodes came from an old VHF transceiver, including a nice BD945 power transistor with gold plated bits and all. One doesn't see BC338 and BC337 transistors being used much these days.
Other bits came from various junk except for the zeners which I had to order. To avoid the 6 to 8 week delay coming from China I had to order them locally on Ebay and only available in surface mount. Paying $2 each for 3 little bits that I can barely even see was a little painful, but oh well, everything else cost nothing, and also an opportunity to try my hand again at homemade surface mount PCBs.
Previous attempts at homemade surface mount had not been encouraging, therefore I decided to divide the circuit up into three separate boards: voltage reference, current regulator and the main driver board. That way, if the little surface mount board failed then I'd only have to redo it and not the whole lot.
To my great surprise it came out good on the first try, even the copper writing came out readable.
Encourage by my success, I decided to make the current regulator board surface mount too:
Which came out not so well, but still useable. You might notice a track running between the pads on the 1206 sized resistor. This was a major technological first for the VK2AAV homemade PCB workshop.
The through-hole driver board came out nicely:
As I recall, the heatsink came from an old switch-mode power supply.
Maximum dissipation is close to 15W, so I reckon that the fan is required. The MCU rougly calculates the dissipation in the heatsink and turns the fan on if it's more than a couple of Watts.
Microcontroller and Digital Circuitary.
MCU is an ATMEGA328 mounted on the blue PCB, these were sold as 'Pro Mini' module. I'm not sure if they're still available. This one, along with the rotary-encode and the LCD came from an old 'digital VFO' project, so they all qualify and being recycled.
The IC to its left is MAX323 which converts 5V UART to RS-232 voltages for connection to PC.
The MCU:
- connects to the externally mounted 1602 LCD and the INA219 current/voltage sensor modules via I2C bus.
- Reads the rotary encoder mounted on the front panel is used to set current and voltage limits.
- Drives fan via a 2N7000 MOSFET.
. Drive power LED and load-enabled LED. . Uses analogue-to-digital converter to figure out when the load is switched on
INA219 Voltage and Current sensor.
This is a nice little device, it will measure voltage up to 26V and will measure the voltage drop across the shunt resistor, amplify it by a programmable amount, do a 12-bit analogue-to-digital conversion and then make data available to a MCU via I2C bus. It will measure current in both directions. It can also be programmed to convert the raw voltage and current reading to actual volt, amps and it will even to the multiplication for watts. In practice though, I found it easier to just do these conversion on the MCU. The datasheet states the accuracy as 1% for the A version, 0.5% for the B version.
PC Software
The power-supply communicates with a PC over RS-232 serial line using a simple message protocol.
A utility developed in the Python language runs on the PC side:
~/work/Bench-PSU-1A/controller/src>./bench_psu.py --help
usage: bench_psu.py [-h] [-p PORT] [-b BAUD] [-l] [-sc] [-rb] [-tf TICK_FREQ]
[-rj]
optional arguments:
-h, --help show this help message and exit
-p PORT, --port PORT Name of serial port eg: /dev/ttyUSB0.
-b BAUD, --baud BAUD Baud rate, default 38400.
-l, --list-serial List available serial ports and exit.
-sc, --set-clocks Set the clock and sysclk seconds on the MCU to the
current time.
-rb, --reboot_mcu reboot the MCU.
-tf TICK_FREQ, --tick_freq TICK_FREQ
set the MCU ticks per second value.
-rj, --reset-joules reset the count of joules to zero.
-sd, --shutdown shutdown the power suppy.
It's still being worked on but currently does the important bits. The crystal oscillators on the tested MCU modules were way off frequency, by measuring the seconds gain or loss over a day of so, and compared to an accurate NTP synchronised PC, this is corrected with the -tf option. Measured inaccuracy was 10 parts per 1000 on one device (ie 1%, 36 seconds per hour!), 6 on the other. When counting joules it is important to have accurate time. With correction, the MCUs are within about 1 or 2 seconds per day.
Running it and charging a 12V lead-acid shows:
LOG:INFO:184337:1691484217:bench_psu.py:172: {'volts': 13.7548828125, 'amps': 0.809863269329071, 'watts': 11.13957405090332, 'joules': 181.865234375}
LOG:INFO:184339:1691484219:bench_psu.py:172: {'volts': 13.9228515625, 'amps': 0.48515623807907104, 'watts': 6.754758358001709, 'joules': 181.865234375}
LOG:INFO:184341:1691484221:bench_psu.py:172: {'volts': 13.7197265625, 'amps': 0.45136716961860657, 'watts': 6.192634105682373, 'joules': 181.865234375}
LOG:INFO:184343:1691484223:bench_psu.py:172: {'volts': 13.7236328125, 'amps': 0.427734375, 'watts': 5.87006950378418, 'joules': 215.8739471435547}
LOG:INFO:184345:1691484225:bench_psu.py:172: {'volts': 13.7314453125, 'amps': 0.4256835877895355, 'watts': 5.845251083374023, 'joules': 215.8739471435547}
LOG:INFO:184347:1691484227:bench_psu.py:172: {'volts': 13.7314453125, 'amps': 0.4102538824081421, 'watts': 5.633378982543945, 'joules': 245.5730743408203}
LOG:INFO:184349:1691484229:bench_psu.py:172: {'volts': 13.7353515625, 'amps': 0.4046874940395355, 'watts': 5.558525085449219, 'joules': 245.5730743408203}
LOG:INFO:184351:1691484231:bench_psu.py:172: {'volts': 13.7392578125, 'amps': 0.4013671576976776, 'watts': 5.514486789703369, 'joules': 245.5730743408203}
LOG:INFO:184353:1691484233:bench_psu.py:172: {'volts': 13.7392578125, 'amps': 0.3882812261581421, 'watts': 5.334695816040039, 'joules': 273.9256286621094}
So it will be possible to deliver a certain amount of charge and then turn off. This will be good for charging NiCd and lithiums I guess, but also for testing ie how much charge was put in compared to how much was got out.
Kicad Files and Software are on Github
The Kicad file for the controller PCB, the C source code for the microcontroller and the Python code for the PC utility are available on Github here.
Conclusion
The boards expand to fill the space available, or something like that.
The bridge rectifier does get quite warm when running at higher power, originally the plan was to mount it at the left side of the heatsing so the fan air exiting the heatsink would cool it, but alas, the little transformer had to go there. Holes drilled in the sides of the lid allow for air to enter and exit.
All in all, and even though there was a lot more work involved than what I first might have envisioned, I have to say that I'm pretty happy with it. It's an addition to the workbench that I will use on a regular basis and being able to configure things so I can't blow up my circuit by accidently turning up the voltage know will definitely save heartache in the future. Aditionally, the regulator circuit looks to be a good one and could easily be scaled up for higher currents with the addition of only bigger output and driver transistors.