CC-CV power supply as a contolled load for batteries (i.e. Rigol DP832) - Page 1
Forum section: electronics / projects

author: RoGeorge
author_rank: Super Contributor
timestamp: April 01, 2022, 10:24:46 pm
content: This is about how to use a normal CV-CC power supply as a controlled load for discharging batteries with a constant current, and thus measure a battery's capacity C (mAh).A normal power supply can control the current through its load, and the top voltage, too. However, a normal power supply can only source current, it can not sink current and it does not support negative voltage applied to its output.The goal is to connect a battery in such a way that we can keep current flowing out of the power source, and voltage on the power source to stay positive, while the current through the battery under test acts as a discharging current. Else said, the battery needs to be connected in reverse, with the positive terminal to GND. Then, we will need a drop voltage bigger than the battery's open voltage, so to create a positive voltage for the power supply's positive terminal.That can be done with a series resistor and a big enough current set from the source, so the URs= Rs * Is >= Vbatt, or with a Zener diode, or an active circuit to drop a voltage >= Vbatt, etc.Some batteries can deliver huge currents, so special measuresmustbe taken to protect the output of the power supply. Here, diode D1 is connected in reverse at the output of the power supply, so to avoid negative voltages. Diode D2 protects in case V outside is bigger than V generated by the power supply.The set current in the power supply will be the discharging current. The set voltage of the power supply will limit the min discharge voltage for the battery. For example, if the battery has to be discharged with 1A until it reaches 10V, then the power supply must be set for 1A and 5.5V (-10V on battery, 15V on Rs@1A and 0.5V on D2).Note that the actual load is the resistor R, not the power supply. The power supply only helps with keeping a constant discharging current, and with monitoring the current and the voltage (also with logging, in case of a DP832).LATER UPDATE 2024-12-13--------------------------------------The schematic I am using now and the DP832 software to tell the mAh are in this post:https://www.eevblog.com/forum/projects/cc-cv-power-supply-as-a-contolled-load-for-batteries-(i-e-rigol-dp832)/msg5744693/#msg5744693

author: macboy
author_rank: Super Contributor
timestamp: April 03, 2022, 05:47:09 pm
content: This is a non-obvious way to use a CC/CV power supply, that most people wouldn't think of. You are not the first. I read about this in HP Harrison Labs Tech Letter #2 - CC-CV Regulated Power Supplies.Note that with a single power supply, the discharge is not automatically stopped. To accomplish this, you must use two supplies, one used to set the constant current discharge (as you described), and another one to stop the battery from over-discharging. This one is connected directly across the battery and set to be equal to the final discharge voltage (e.g. ~10.5 V for a 12 V Pb battery, or ~3.2 V for a LiPo cell), and current limit greater than the discharge current. When the battery reaches the discharge voltage, this supply takes over supplying current to the load (the load still dissipates the same power even after the battery stops discharging).Try simulating it in LTSpice (etc.) with a large capacitor of several F set to an initial voltage of around the fully charged battery voltage. Add realistic ESR to the cap for the internal resistance of the battery, and some resistance for the connecting leads between power supply and load to give a more realistic transition at the end of discharge.

author: RoGeorge
author_rank: Super Contributor
timestamp: April 04, 2022, 12:47:53 am
content: Quote from: macboy on April 03, 2022, 05:47:09 pmI didn't know about Harrison HP. Found the Harris Tech Letter you mentioned, will give it a read, thanks!http://hparchive.com/Application_Notes/Harris-Tech-Letter-02.pdfAbout stopping the discharge, I think it can be stopped if a bidirectional power Zener is used instead of the former discharging resistor Rs. Something like this:The X axis represents the voltage of the battery under test, while it is discharging from 18V to 8V.The green, yellow and red traces correspond to DP832 set for 1A and 3V, 5V or 9V. Note how the voltage setting of the DP832 determines the stop discharging voltage (i.e. for DP832 power supply set to 5V, the stop discharging voltage is about 14V, while for DP832 set to 9V the I(Battery) current becomes negligible after Vbatt becomes smaller than 10V).- Dp1 and Dp2 are protection diodes against accidentally pushing current into DP832 or connecting a reversed voltage- Dz1 (Zener 15V), R1, Q1, R2 and Qload together form a power Zener with a constant VCEvoltage drop on Qload- Qload transistor is the main load that discharges the battery, must be able to dissipate about 20W- D1, D2, D3 and D4 form a bridge that keeps the same polarity for the power Zener circuit, just in case DP832 becomes zero (e.g. a mains power surge).- Dcv simulates the set constant voltage for the DP832 power supply, and together with I1 they form a crude model of a CV-CC power supply, where I1 (here 1A) is the current to be set on the front panel of the DP832, while the forward voltage of Dcv (here the Vdp832 parameter, 3V for the green trace, 5V for yellow trace or 9V for the red trace) is the voltage to be set on the front panel of the DP832.

author: RoGeorge
author_rank: Super Contributor
timestamp: May 06, 2022, 05:31:02 pm
content: In practice it turned out that the previous schematics are too complicate for the goal of testing AA/AAA batteries.For small NiMH, NiCd or alkaline batteries, a simple series diode with Vdrop > Vbatt would be enough. The usual 0.6V drop of a single Si diode is not enough, so a Zener diode might be used instead, or maybe a chain of 3-4 series 0.6V diodes. A LED might be used as well.Mains light bulbs usually have 14 power LEDs inside, and already mounted on a radiator. Each LED can support 100...200 mA (connect more LEDs in parallel if higher discharging currents are needed), and the voltage drop is about 2.5...3.5V per LED.Power LEDs will be ideal for a load here, and they can be scrapped for free from defective light bulbs.This is the latest schematic of the AA/AAA controlled discharger adapter for DP832 (or other CV/CC power supply), which is nothing more but a fusible and a power LED in series with the battery to be measured:DP832 maintains the constant discharging current, can log the voltage/currents during test, and can also cut down the power when the battery reaches the minimal voltage.On the X axis is the voltage of the battery under test, while discharging it from 1.5V to 0V. On the Y axis, on the left is the voltage seen by DP832 (plotted in green), while on the right is the discharging current (plotted in red).Note how the DP832 sees a raising voltage while the battery under test is discharged. This can be used as an indicator to automatically cut down the power when the voltage raises too much. By setting the OVP (Over Voltage Protection) in the DP832, the discharge can be ended at the desired minimal voltage (to avoid battery damage by over discharging).Once a DP832 channel is turned off, the current through the battery under test will become negligible, because a typical white LED voltage drop is about 3V and an AA/AAA battery doesn't have enough voltage to make the current flow through the LEDs.

author: RoGeorge
author_rank: Super Contributor
timestamp: December 12, 2024, 12:53:03 pm
content: In the meantime, I've used this idea with various type of loads, from a simple resistor, to series diodes (or diode bridge connected as 2 series diodes), to plates of LEDs from defective light bulbs and so on.For these type of loads, the exact voltage drop has to be known at the given current, and for diodes the voltage drop also varies with temperature (they may heat enough to produce a significant change in their voltage drop, so a complicated calibration procedure).Eventually, I've found to be much easier to use a load that has constant voltage drop no matter the battery discharging current, or the temperature or the current. This TL431+BD680 schematic worked very well to emulate a 5V power Zener (schematic from the 431 datasheet).For a 5V drop between CE, the R1, R2 are of 2k7 each, and the R between BE is 220\$\Omega\$In practice there are a lot of wires to test 3 batteries at once, and the radiator will need a fan, the one in the picture is a 12V ATX FAN powered with only 5V to make it silent. No enclosure yet.I've used this only for 1.2V NiMH/NiCd, or for 4.2V Li-ion (V battery has to be lower than the 5V of the V Zener has). The battery to discharge in series with a power Zener circuit for each DP832 channel.The plus of the battery is connected to the minus of the DP832, and the katode of the power Zener to the plus of the DP832 (in the above schematic, the Katode of the power Zener is at the Emitter of the transistor, and the Anode at the Collector of the transistor).As for the software part, made 2 scripts:1. - one is in Python 2, to log from Rigol DP832 power supply the I and V during battery discharge. The Python2 script saves the data as a CSV file, and it closes the file after each new line it wrote, which means you can copy or open it while the script is keep logging the discharging batteries (so you won't have to wait for hours before looking at the data).This python script will make a new file each time it is started (with a timestamp to distinguish the file), in a sub-directory named 'csvLog'. The DP832 has to be connected by LAN, and it won't need any drivers installed. You'll have to install Python 2, of course. Sorry for not porting this logger script to Python 3 yet. Both Python 2 and Python 3 can coexist, you can install Python 2 even if you already have the newer Python 3. They won't interfere with each other.2. - the second script is a GNUplot script (you'll have to have GNUplot installed). The .gp script displays a chart of I and V for each battery, while the batteries are discharging. The charts are updating live, and they can be handled using the mouse or keyboard, to pan or zoom for details while the batteries are keep discharging. This .gp script can be as well stopped or restarted at any time, during the data logging or afterwards, it won't affect the data in any way, it only displays the plots.There are a few lines at the beginning of the .gp script, to adjust the script with your hardware.To use all these:- first, with all the channels off, you set the DP832 voltage to something more than 5V (I am using 5.3V for each channel), then- set from the DP832 the discharging current. Typical is to use 0.2C, where C is number of mAh of your battery. For example, if you want to test a 2300mAh battery, you set the current to 0.2*2300=460mA- set from the DP832 OVP (over voltage protection) to ON. This will detect when the battery is fully discharged (the minimum discharging voltage). For example, if you want to stop the test when the voltage became smaller than 0.5V on the battery, you set the DP832 OVP for 5V (power Zener voltage) - 0.5V (minimum battery voltage) = 4.5V. So you set the OVP to 4.5V, turn the OVP on, and the respective DP832 channel will automatically turn off when the battery discharges to 0.5V or lower.The 0.5V minimum battery voltage used here is just an example, typical discharge limit for NiMH is 0.9V, or 0.8V sometimes, not 0.5V- connect the load (the 5V power Zener) and the battery in series, by the idea shown in the very first post of this thread. The DP832 normally can only source current, can not sink current, but with the trick with the series 5V power Zener, you can use a DP832 for discharging batteries and measure their mAh- start the logging .py script (the Python 2 one). Your DP832 has to be connected by LAN, and you'll have to know the IP address of your DP832. For example, if your DP832 has the address 192.168.1.4, to start the data logging open a terminal and typepython2 DP832_logger_Linux.py 10 192.168.1.4The number 10 (before the IP address) tells the logging time interval, here 10 seconds. Can be as small as 1 second. Leave this terminal window open during the entire discharging time of the battery under test.You can stop the logging at any time with CTRL+C (or with ESC, though that might seem unresponsive because of the logging rate, it is safe to stop this script with CTRL+C at any time during logging, won't lose the data)- now you can turn on the DP832 channel(s), and let it discharge the battery/batteries under test. Can test up to 3 batteries at the same time, one on each DP832 channel.- leave it running, each DP832 channel will turn off automatically, when its battery reaches the minimum voltage (during discharging, the voltage displayed on the DP832 panel willincreasewhile the battery voltage isdecreasing, thus the OVP can be used here to detect minimum voltage allowed for the battery under test- when discharging at a current of 0.2C, the discharging process is expected to take 5 hours. If you want to watch the discharging curves live, or to zoom into details, during all this time you can start (or stop) the GNUplot .gp script at any time. The .gp script is looking for a .csv file with the same name as its own name. For example, if you name yor .gp scriptBattery 1 test 1 460mA.gp, then it will expect to find a .csvBattery 1 test 1 460mA.csvin the same directory.- to fulfill the above for the .gp script, create a symlink (shortcut in Windows) from your curently data logging file inside the csvlog directory, to the same directory whereBattery 1 test 1 460mA.gpis, and rename this symlink (shortcut) asBattery 1 test 1 460mA.csv.This scheme of organizing the files will allow to keep all the logged csv files in one centralized place (the 'csvLog' directory), and to create anywhere else on the disk a directory for each tested battery, where to keep the specific .gp files and a symlink (shortcut) to the logged date. You can even have consecutive smaller batteries tests made with the same channel in a single CSV file, then display each test with its own directory with its own .gp and only a soft link (symlink, or shortcut for Windows) to the corresponding data file.The idea is to have a copy of the .gp and a .csv symlink for each discharging test you want to plot, and to group repeated tests of the same battery in a directory, one directory for each battery. This way you can move, change settings, or rename the display files upon wish, at any time, without messing with the log filesIn the attached zip there is already one measurement .csv file, as a sample to check if you have all installed. Prerequisites are to install Python 2 and GNUplot.- unzip- navigate to directory myBatteries- run (or double click) thedisplay_the_sample_data.gp, and you should see a plot, with the Wh and mAh displayed at the legend, in the upper-right corner of the chart.- to start a new battery test and data logging, navigate inside the directoryDP832_charger_loggerand follow the 9 steps above (runpython2 DP832_logger_Linux.py 10 192.168.1.4, make a new directory with a copy of the .gp script in it, and a softlink/shortcut to the currently logging data file from the csvLog directory).Should work with Windows or other OSs, too, but I've only tested it in Linux (Ubuntu 22.04 LTS).Example:To display the sample chart for the included sample datafileCode:cd myBatteries./display_the_sample_data.gpTo start a new logging from DP832Code:cd DP832_charger_loggerpython2 DP832_logger_Linux.py 10 192.168.1.4leave this running during the entire battery discharging test. To close the logging, use CTRL+CTo display the currently logging data while the logging is in progress, fromanotherterminalCode:cd myBatteriescp display_the_sample_data.gp my_first_test.gpln -s ../DP832_charger_logger/csvLog/DP832A_2024-12-12_14.18.33.csv my_first_test.csv./my_first_test.gpYou should see a live chart, with data points populated while the logging from DP832 is in progress. You can zoom, resize, turn each plot on/off by clciking in the legend, etc. The chart window will respawn if closed. To permanently close the chart, CTRL+C in the terminal window where from the .gp script was started.

author: tszaboo
author_rank: Super Contributor
timestamp: December 12, 2024, 02:23:47 pm
content: Quote from: RoGeorge on April 01, 2022, 10:24:46 pmI've blown up more power supplies than I'd like to admit to attempt charging or discharging batteries with a power supply anymore.If you connect it in reverse they blow up the output protection diode. If you connect it the right way, it blows up the output SCR when switching off the charging. If you loose the mains power all kinds of bad things happen. Sometimes the control loop goes crazy on you.For alkaline batteries, and other primary batteries with similar capacity, just connect a 5.6KOhm resistor on the battery, and measure it with a multimeter. Not only this is a safe way to measure them, you will get results that are comparable to other batteries, and industry standard.

author: RoGeorge
author_rank: Super Contributor
timestamp: December 12, 2024, 03:37:14 pm
content: I should have open a new topic, this one is a continuation from 2 years ago. The goal of the reply #4 was only to attach the software that shows the V/I chart and calculates the mAh. Then tried to describe the usage, but got many interruptions during the edit.The result was a very long and unclear post.To summarize, I use this to test (discharge) recheargeable batteries, to appreciate their health and to find their true mAh value. The power supply used here (DP832) can not discharge batteries, but there is no danger in damaging it (or any other normal power supply) if the battery is connected in series with a Zener, like this:Normal power supply (source current only) connected to discharge batteries and measure the mAh.The Zener must have a voltage bigger than the battery. In my case, because I want discharging currents more than a normal Zener can support, I've used a Zener-like circuit, with a TL431+BD680, to make a 5V Zener that can support max 3A. There is no danger for the power supply. It's the BD680 transistor that actually discharges the battery, not the power supply.The power supply only keeps a constant current, it never sees a reverse voltage at its output. The energy discharged from the battery (and a little extra coming from the power supply) is all dissipated by the 5V power Zener circuit (by the 3 x BD680 transistors on the radiator).

author: jwet
author_rank: Frequent Contributor
timestamp: December 12, 2024, 04:39:14 pm
content: Clever- the Harrison labs stuff is an eye opener for a lot of things. The paper "The Present Attainments of Adjustable Power Supplies" hurt my head the first few times I read it. It seems like everything is upside down but I finally got the point.Very Cool.

author: jbb
author_rank: Super Contributor
timestamp: December 13, 2024, 01:10:38 am
content: I too would like to discharge test some cells but only have a programmable power supply.I came up with a more complicated circuit (attached) which uses a current mirror (U1, Q1, R1 and R2) to convert the power supply sourced current into a sinker current out of the cell under test. Thus, the current setting on the bench supply sets the discharge current.Next I added what I’m calling a voltage mirror (U2, Q2) to clamp the supply voltage vs to the same value as the cell voltage vc. Thus, the measured voltage on the bench supply is equal to the cell voltage (give or take opamp offset voltage).Haven’t prototyped it yet…

author: RoGeorge
author_rank: Super Contributor
timestamp: December 13, 2024, 07:25:51 am
content: Quote from: jwet on December 12, 2024, 04:39:14 pmThank you, seems the paper was digitized, will give it a read.http://www.hparchive.com/Journals/HPJ-1962-07.pdf

author: RoGeorge
author_rank: Super Contributor
timestamp: December 13, 2024, 07:52:10 am
content: Quote from: jbb on December 13, 2024, 01:10:38 amInteresting idea to copy back the battery voltage, I like that.I'm not sure if that will be stable or it will oscillate. In practice it may need a series resistor to the MOSFET gates. The good part is that the current mirror ratio can be made different from 1:1, so the bench supply can work at a much smaller current than the battery discharging current.The drawback (for my use case, when compared with the series Zener method I'm using now) would be that the opamps will need yet another power source.

author: jbb
author_rank: Super Contributor
timestamp: December 13, 2024, 09:31:32 am
content: Quote from: RoGeorge on December 13, 2024, 07:52:10 amYeah, I think the circuit as sketched would oscillate terribly. Either straight away or the moment you decided it was working and left the workshop... Will need gate resistors and filter capacitors at the very least.Needing another supply rail is definitely a drawback. I am in the fortunate position of having two bench supplies.