Test controller, Battery Test popup

This page can do a full battery test with multiple currents, it will save both date (csv) and charts (png) files of the test. It will also save a summary and a list of equipment used for the test. At the end of the test it will combine all tests into a single chart and save files that are aligned on time, capacity and energy.
At the current time only LiIon and batteries with similar charging algorithm are supported.
Contents
Connection
User interface
Control
Setup
Summary
Log
Equipment
The flow of testing
Input
Init charge
Init resting
Discharge
Cooldown
Charge
Resting
Done
Abort
Time for testing
Adjustment made in TestController
Equipment supported
Electronic load
Power supply
Relay
Voltmeter
Thermometer
Check what #interface command a device supports
Scripting
Example
Main page
Connection
Up to 5 devices can be used, here is some connection examples:

This is the most simple connection for automatic testing: a load and a power supply. The setup has some inhered problems, mostly voltage drop in the wires and connections and not all power supplies like getting voltage input on the terminals.

Adding a relay will protect both the power supply and the battery much better and may also increase the precision because any standby drain from the power supply is avoided.

Adding four terminal connections (Also called Kelvin connections) will improve precision significantly and increase charge speed a bit.
It is recommended to place a 100ohm to 1kohm resistor between the output and sense terminal on the power supply, this prevents mishaps with some power supplies.

Adding a voltmeter directly connected to the battery improve accuracy and mostly void the requirement for four terminal connections.
Adding a thermometer will make it possible to record battery temperature and stop if it gets too high.
There is no requirement to use both meters at the same time, either one will work alone.
Any meters supported by TC can be used, but be aware of the time a test takes, a battery powered meter may not be a good option!
Any combination of the above connections can be used and TC will adapt.
User interface
The user interface has five pages, here is a overview of them.
Control

This page gives a overview of the testing and provide controls to start/stop it.
It shows the follow parameters:
- Red bar at the top is battery voltage between "Discharge stop voltage" and "Charge voltage", there are tick mark for every 0.1 volt and a arrow is added to show charging or discharging. The purpose is to show at a glance where TC is in the current test cycle. If only a load or power supply is connected the scale will use initial battery voltage for one end of the scale.
- State refer to the chapter below: "The flow of testing", the current listed is not the charge/discharge current, but the latest discharge current setting used.
- Info is a text describing what is going on, it is mostly useful when a abnormal termination happens.
- Voltage will always show the current battery voltage, measured with either the load a power supply or a voltmeter.
- Current show charge or discharge current, either from the power supply or from the load.
- Capacity shows charged or discharged capacity.
- Energy shows charged or discharged energy, if a voltmeter is connected it will be used for the calculations.
- Time time in the current state.
- Temperature is battery temperature and is only present when a thermometers is connected.
The Start button will start a test.
The Stop/Abort button will stop a test and change from done to input state.
Setup

This page is used to configure the testing parameters.
- Charge voltage is the battery charge voltage, for a single LiIon cell it is 3.6V, 4.2V, 4.3V or 4.35V depending on chemistry. For battery packs it will be a scaled by the number of series connected cells.
- Charge current is the battery charge current, this depends on the size of the battery and the chemistry. For 18650 batteries 1A is fine.
- Charge end current the termination current for charging, it is usually a few 10's of mA, again depending on battery size and chemistry.
- Discharge stop voltage what voltage to test down to, 3V is usually a good value, but both lower and higher values can be used.
- Discharge currents is a list of test currents. For standard loads avoid going below 0.1A, it will usually reduce precision significantly, the high end depends on the battery and load, it can be 5A to 30A for 18650 cells depending on chemistry. It is usually best to list the low currents first.
- Time to wait after charging the battery is a delay for the battery to cool down and voltage to stabilize after charging.
- Relay settings when a relay is used this defined the value to write to it for charging and discharging (It is a bitmask of what channels to turn on). The relay must be place between the power supply and the battery.
- Capacity safety limit this value must be at least 10% higher than the battery capacity and is used to detect abnormal conditions.
- Max. battery temperature is a safety limit for the battery temperature, this is only needed when using high charge or discharge currents. If the battery ever gets above this temperature the test will be terminated.
- Remote sense enable remote sense on power supplies and loads that support it (Some equipment will do remote sense without a command).
- Prefix for saved files all generated files will use this test as prefix, if the field is empty no files are saved.
Most input fields has a right click menu with some suggested values.
Summary

Shows a summary of capacity, energy and time for both charging and discharging.
Log

This is a timestamped log of each step in the test. At the top it will list the parameters used for the test.
Equipment

List equipment used for the test, this may include serial numbers for the equipment.
The flow of testing

There is a fixed flow for testing, it is shown in the chart.
Input
This is the initial state where the test parameters can be entered on the setup page. It can also be verified what equipment is used on the equipment page
TC will be measuring battery voltage and count time, but not do charge/discharge to the battery.
Init charge
First step is to charge the battery to assure the test is done with a full battery. This used same charge parameters as the regular charge page.
Data is recorded and saved together with a chart.
If no power supply is connected this step is only active for for a very short time.
if no load is connected, this is the only step performed.
Init resting
Let the battery rest after charging, this allows the battery voltage to drop a bit to better reflect full voltage after storage.
If no power supply is connected this step is only active for for a very short time.
Discharge
The testing discharge, it will use one of the specified testing currents (They are used in sequence). The testing will discharge down to the "discharge stop" voltage, then continue to cooldown phase.
If no power supply is connected this step is only done once with the first listed current.
Data is recorded and saved together with a chart.
Cooldown
The cooldown phase is for lettering warm batteries cool down, when the battery is not warm the phase will only last 1 second.
This phase requires a temperature sensor to be activated for more than 1 seconds.
Data is recorded and saved together with a chart.
Charge
Charge the battery after the test.
Data is recorded and saved together with a chart.
Resting
Let the battery rest after charging, this allows the battery voltage to drop a bit.
After resting TestController will jump back to discharge if there are more currents else continue to done.
Done
All testing is done, the data is finalized and saved.
Abort
This is the same as the done state, but is used if "Stop" is pressed or TestController discovers a fault condition.
Time for testing
Battery test takes time, often a lot of time. A single battery test with multiple currents can take a week!
Some times:
A 3000mAh battery discharged at 0.1A is 30 hours discharge time.
A 3000mAh battery charged at 0.5A is around 7 hours charge time (The tapering at the end of charge can add a hour or more to that, depending on battery age and four terminal or not connection from the power supply).
Based on the above a 0.2, 0.5, 1, 2, 5 sequence is 26 hours discharge time and 42 hours charge time (At 0.5A) for a total between 2½ and 3 days.
Be aware that the .csv files will be a few megabytes each, due to the 1 second sample rate. They compress really well and storing a full battery test in a .zip file will save a lot of space.
A full example of a battery test can be seen here: Example
Adjustment made in TestController
To make the test and result generation as automatic as possible, the battery test will adjust some settings in TC.
Before drawing a chart it will select curves: Voltage, Current, Capacity and Energy
The voltage scale is adjusted to match the requested voltage range, no other scale is changed.
It will add its own formula to the math page and delete any other formula with matching name, that is Capacity and Energy, they will be adjusted to follow charging and discharging operation.
Logging is turned on at 1 sec interval before each charge/discharge and turned off at the end of resting or cooling, then the data file and chart is saved.
These adjustment is made before each charge or discharge, i.e. any change made during a charge/discharge will be included in the saved files.
TestController do not lock any controls and changing settings may affect the saved data and chart or the test itself if commands are send to the used devices.
Equipment supported
A list of different equipment can be used and will be used to give the most precise test result. The minimum equipment the page can work with is one electronic load or one power supply, but both need to be present to do a automatic test.
Electronic load
This is the main piece of equipment for testing batteries, it is used to discharge at a specific current. When no voltmeter is present it is used to read the voltage and it is recommended to use four terminal connections, when a external voltmeter is used there is no reason for four terminal connections.
A 150W to 300W load works fine for single cells, but when using battery with more voltage, be aware of the loads power limit.
For it to be used it must have these commands in the definition:
#interfaceType Load
#interface setCurrent
#interface getCurrent
#interface readVoltage
#interface readCurrent
#interface setOn
Optionally: #interface setRemoteSense
Power supply
A power supply is used to charge batteries, this means it will be used in constant current mode. When no load or voltmeter is present it is used for voltage readings. It will generally benefit from four terminal connections (This will charge the batteries slightly faster), when a relay is used it must break both the main supply and the sense wire, to avoid tripping a power supply with check on the sense wire a 100ohm to 1K resistor can be place between the sense and the power output wire.
Not all power supplies like getting external voltage into their output connectors, it may drain current or damage the supply. Using a relay will prevent that.
For it to be used it must have these commands in the definition:
#interfaceType ps
#interface setCurrent
#interface getCurrent
#interface setVoltage
#interface getVoltage
#interface readCurrent
#interface readVoltage
#interface setOn
Optionally: #interface setRemoteSense
Relay
To avoid sending voltage into the power supply on the output terminals a relay can be used in series with the output and sense wire, i.e. one or two switches on the relay.
This kind of relay can be made very easy with a Arduino and a simple program. One way is to replace the opto couples and FETs with relays in this schematic: https://lygte-info.dk/project/SSRelay%20UK.html
Connect the relays (Use relay modules with transistors) to the same pins and use the software publish for the project and it will work.
Connect the relay so it has to be energised for the power supply to be connected, this way it will always disconnect the power supply on a power failure.
It is possible to get a preassembled relay module that have been tested from: Eletechsup 10IOA01, 10IOA02, 10IOA04, 10IOA08, note that a USB<->RS485 adapter is needed for these modules (They are fairly cheap).
For it to be used it must have these commands in the definition:
#interfaceType Relay
#interface setRelays
Voltmeter
A DMM in volt mode will be assumed to be connected directly to the battery and will be used for voltage readout and for power calculations.
This negate any need for four terminal connection from the load.
For it to be used it must have these commands in the definition:
#interfaceType DMM
#interface readValue
Thermometer
A thermometer or a DMM in temperature mode will be assumed to be measure battery temperature and will be used to stop discharge if the battery gets too hot and hold a cooldown after discharging if the battery is warm.
For a DMM to be used it must have these commands in the definition:
#interfaceType DMM
#interface readValue
For a thermometer to be used it must have these commands in the definition:
#interfaceType Thermometer
#interface readTemperature
For a multichannel thermometer the readTemperature is supposed to return the temperature of the first channel and that is the value that is used
Check what #interface command a device supports
This is fairly easy, first select the device and then open this popup menu:

This popup will show all defined #interface:

For devices with channels the battery test will use the first channels (Relays excepted).
This popup can also be opened for devices before they are loaded:

Right click on the device name and select preview.
Scripting
This popup can be controlled with:
#BATTERYTEST V chargeVoltage chargeCurrent chargeEndCurrent dischargeStopVoltage restingTime
#BATTERYTEST C dischargeCurrents...
#BATTERYTEST M relayCharge relayDischarge cápaityLimit temperatureLimit remoteSense filePrefix
#BATTERYTEST Start
#SHOWPOPUPSYSTEM BatteryTest {x y {w h}}
#CLOSEALL