NavigationUser login |
Dual power supply with digital readoutsThis was a project I've had on the list for a while. It's nothing special, just a power supply using LM338 regulators to give an output of 2 - 20 Volts at up to 2 Amps, off each channel.
The softwareThis project was written in Hi Tech C for the 16f870. (source code here and here ) It uses a timed interrupt routine to drive the displays and a main loop which takes voltage and current measurements. The displays are multiplexed and driven directly from the processor. This means that the numeric values to be displayed have to be converted into bit patterns to light the correct segments of the displays. These patterns are held in a simple look up table. I decided to run the displays from a 1 mSec interrupt to ensure that they would be refeshed at a constant rate - so the brightness doesn't vary, and one that's fast enough so I don't get any flicker. With 16 displays and a 1 mSec interrupt, each digit gets displayed for 1 mSec in every 16, which comes out at about 60 refreshes per second. I did discover that I was getting a lot of jitter in the converted voltages. After trying a few things, I came to the conclusion that the large currents being switched during the interrupt routine were affecting the ADC, which was occasionally performing a conversion when an interrupt occurred. The simple expedient of disabling interrupts (see the code) while performing an A-D conversion cured this. However I also noticed an odd effect: that when the output voltage was varied slowly from (say) 9 - 11 Volts, the Volts digit and the 10-s of Volts digits would "stick". As an example, I might see values displayed of 9.77 9.86 9.97 9.04 10.10, or (even worse) when going in the other direction: 10.04 19.95 19.82 9.76 where the changed digit wasn't being updated in sync. with the others. I fixed this by adding a little bit of state information to the main loop and interrupt routine, so I would measure all four outputs (Voltage and current from each channel) and only display the data when all the measurements were done - then not update the measurements until all the digits had been displayed. Since the A-D runs fast, and the binary - BCD routine is in assembler (and also very fast - much better than coding it in C) there is no visible delay in updating the displays. In conclusion I'm pleased with the versatility of this power supply. Since I had a few inputs and outputs spare, I've since added a temperature sensor to the power supply's heatsink and added an RS232 connection which outputs the voltage, current and heatsink temperature every 100mSec. Note: these mods aren't on the circuit diagram I've been asked about the front panel I used. This was a standard aluminium panel that I cut rectangles out of for the displays. The red and green filters were stuck to into those holes with hot-melt glue and the decorative front added after that.This was printed onto an A4 sized stick-on label. I designed it using a basic graphics package, printed off the label and applied it to the aluminium front panel of the case. |
Some other sites I visit General websitesSlashdot IT news cynical UK techy news Astronomy WebsitesBrits in Spain |