Circuit for testing LiPo batteries?
I was actually planning on building one of these.  I decided that it would be easiest to start with a USB Arduino to have easy data logging to the PC.  I figured I'd use an Uno, even if I wrote the code in native AVR C, rather than Arduino.

For this, you are looking for a constant current sink.  Something that will pull a constant current, even as the voltage of the battery drops.

You need two ADCs to measure voltage.  First will measure the actual battery voltage.  Depending on how accurate you want to be, you can either use the 5V power as the ADC reference or use a more accurate ref chip.  You will need some type of shunt to measure current.  (A shunt is a known resistance.  So by measuring voltage across it, you can know the current flowing through it via Ohm's Law.)

Lets work backwards from the battery.  If we have a logic level N Channel MOSFET as a controller and an accurate resistor in series with the Drain/Source.  The resistor will work as our current shunt.  The battery + connects to the source of the MOSFET, then the resistor connects the drain to ground.  The battery - is also to ground.  If you have 1 Ohm resistor, and measure 1 V across it, you know that 1 A is flowing through it.

(A Logic Level MOSFET is one that will turn on with a gate voltage in the normal range of logic chips, generally fully on before +5V.  It is useful for driving heavier loads from low current capable logic.)

OK, now we need to control the MOSFET.  Hook up an Op Amp as a voltage follower, with the + input for setting the voltage (more about that later) and the - connecting to the drain/resistor junction.  The output of the Op Amp goes to the gate of the MOSFET.  The Op Amp will adjust the gate of the MOSFET, until the voltage at the drain (and across the resistor) meets the voltage presented at the + input of the Op Amp.  This means it will consume a variable amount of voltage to maintain maintain a constant voltage across the resistor and therefore a constant current through the resistor.  (And a constant current draw from the battery.)

Remember that the ideal Op Amp model is such that voltage between + and - is 0V.  In reality, there is a little, but you will be compensating for this so it doesn't matter unless you try to drive it too close to the rail.

So we now have a circuit that will draw a current in amps equal to the voltage in volts that you provide to the + of the Op Amp.

The last things we need is to measure voltage and current and generate that voltage.

You can use the PWM output of the micro to generate an analog voltage.  You would hook a resistor in series with the pin and a capacitor from the end of the resistor to ground.  This junction will feed the + input of the Op Amp.

Now we need to feed the voltage across the shunt resistor into one ADC input.  This will read discharge current in Amps if you use a 1 Ohm resistor.  Use this to drive the PWM output until you are pulling the desired current from the battery.  It may be better to drive a voltage divider with a trimmer resistor, so you can tweak the circuit to give outputs that correspond to given PWM duty cycles.

The last hookup is an ADC input from the battery itself.  If you are using a battery that is over your supply voltage, you will have to use a voltage divider to get it down to a range that the ADC can handle.  You may need a switch to have a few different dividers, based on the number of cells you will hook up.

Once you have registered a voltage down as low as the battery should drain, set the PWM output to ground and this will turn the MOSFET off and stop draining the battery.

Add the associated logging to the PC and you are done.  



Make sure you get proper power rated MOSFET and shunt resistor.  If you are driving 5A through the 1 Ohm resistor, you will need 5W resistor.  It might be easier to put a few in parallel to get to the desired value and power.  You also need a MOSFET with enough power handling to sink the voltage difference between the battery and resistor at that current.  And you will need a good heat sink for running higher power.  The MOSFET and shunt are the only parts of the circuit that will be handing large currents.  All the others should be fine.

With this circuit, you can use it for more than just battery testing.  If you are developing a power supply and want a 1A load on it to see how bad the ripple looks, hook it up.  As long as you don't exceed the power ratings of the MOSFET or Resistor and stay within the proper bounds of the ADC inputs, it will work.