Sunday, January 13, 2013

Boost regulator efficiency meter

This is a project I've been working on from time to time for a while now, but now it's time to wrap it up and document it.  The whole thing started with me building a couple of boost regulators for charging the cell phone (inspired by Minty Boost). I used one regulator from LT and one from TI, and I wanted to compare their energy efficiency.
 Boost regulator from LT (LT1302)
To do this one needs to measure power on both sides of the regulator and present the fraction of the output to the input. This was done using a PIC 16F690, which has plenty of IO's and a 10 bit ADC with several channels. Measurements can be done using four ADC channels and the result can be presented using LED's on the rest of the IO's.
Voltage measurements where done by connecting the 3 volt regulator side directly to an ADC channel. Since the PIC is thought to be running from 4.5V battery power, this will be the absolute upper limit of what the ADC can measure. The output of the regulator is 5V, so that voltage was connected to the ADC through a voltage divider.
Current is measured by measuring the voltage drop over a milliohm resistor in series with the load. We don't want the resistor to load the circuit to much, but a small resistor mean a small voltage drop, so we will use an operational amplifier as a differential amplifier to amplify the drop before it is measured with the ADC.
I generally try to use scrapped or salvaged parts and I had two milliohm resistors lying around at work, one 0.1 Ohms and one 0.02 Ohms, so I used those together with a couple of rail-to-rail op-amps (Microchips
MCP6271) that I bought. I started out experimenting with some old LM741's, but they needed a few volts both over and above their maximum output, which did not fit well with my ambition to power the circuit with three batteries.
 Lab setup.
 Finished board.
The gain of the differential amplifier was chosen so that a current of 2A would give an output signal of around 4 volts. The schematic of the circuit can be found here. The PCB was made using double sided toner transfer, which didn't work all that good. Also, I mixed up the power terminals of the op-amps (fixed in the schematic above), so there were quite a few straps made.
The PIC source code can be found here. The code does the job as long as one is only interested in comparing regulators. The code is only calibrated against one ADC channel at a time and test measurements showed an efficiency of under 50% for both of the regulators, which seems a bit low. It would probably be better to use two known power inputs and calibrate efficiency against those.
Calibration was done using a known current source. By knowing the current ,$I_{in}$, and reading the ADC binary output $I_{bin}$, we can get the conversion factor (k) if we have the linear relationship $I_{in}=k \cdot I_{bin}$. By making a few measurements of this kind we can use the very smart website http://www.wolframalpha.com/ to get a linear fit with the measured data. Here's one of the calculations (actually for a voltage input, but the principle is exactly the same) using the command: linear fit {{1023,5.44},{511,2.7},{255,1.33},{127, 0.65}}. In the end, what we will calculate in matter of ADC outputs is $E=(k_{out-I} \cdot I_{out-bin} \cdot k_{out-V} \cdot V_{out-bin})/(k_{in-I} \cdot I_{out-bin} \cdot k_{in-V} \cdot V_{out-bin)}$, and hopefully we can group all k's into a nice, single, integer (0.6 in our case, not so nice...). The observant reader will notice that there is also an offset term missing in $I_{in}$, which is actually there in the Wolfram Alpha output. I haven't looked into this yet, but for now I will ignore this since I actually don't a whole lot of accuracy and the offset is pretty small. A complete error analysis of the measurement system would be interesting but time consuming, maybe I'll come back to that on a rainy day. (By the way, I used MathJax to display mathematical equations...)
Sample rate of the ADC's are adjusted to what looks stable on the output LED's, which is quite a lot slower than what could be achieved. An algorithm for more samples than LED updates would probably be good. Let's see the present code as work in progress, shall we?
This is a topic that can be explored deeply, both the measurements aspect and the regulator aspect. Right now, however, I'm eager to get my hands on a couple of other projects, so the efficiency meter will be put on the shelf for a while. I'm sure I'll come back to it in the future though...