Concerned with your project’s power consumption but don’t want to constantly leave an ammeter wired in series with your power supply? [Rajendra] feels your pain and has recently documented his solution to the problem: a variable-output bench top power supply that clearly displays load current consumption among other things!
Everything is wired up in a nice roomy enclosure that has front-panel access to ±5V and variable outputs, an adjustment potentiometer, and even an input for an integrated frequency counter. A PIC16F689 MCU runs the show and displays the variable output voltage and current on a 16×2 character LCD. Although clearly useful as is, the PIC has plenty of I/Os and muscle left for future expansion and a capacitance meter has already been hinted at as and addition for version 2!
The power supply itself is pretty straight forward and uses 7805 and 7905 voltage regulator ICs to provide ±5V DC output. A LM350 IC also provides a variable output of between 1.25V and 9V – limited to 3V below the input voltage, in this case a rectified 12V from a standard transformer.
In order to measure current, a shunt of low but known resistance is wired in series with the output. In high-current applications these shunts are typically made of alloys that maintain a fairly consistent resistance across a wide temperature range. Since the currents in this project will be limited to a few Amperes there shouldn’t be too much resistive heating going on, and a 5 foot length of 22AWG wire wound into a coil provides a convenient and low-cost alternative. The voltage dropped across this resistance can then be measured and is directly proportional to the current flowing through it as related by Ohm’s law. This voltage drop reduces the voltage presented to the actual load as compared to the output of the regulator IC where the voltage is being measured in this case, but is accounted for in the code before the value is displayed on the lcd.
Full source code and schematics are provided and plenty of time was devoted to explaining some of the trickier concepts such as amplifying or decreasing signal amplitudes to levels suitable for ADC input and how to use a prescaler to count high frequencies exceeding the PICs own 20MHz oscillator. Also, although this design limits the current sensing capabilities to 1.2A, alternatives to the op-amp stage are discussed that could increase this limit.
Overall this project should be very approachable to even novice hackers and is a great way to practice many basic electronic concepts. What makes it even better is that the end result is a useful tool for future prototyping.