VESC Battery Pack Load Tester V1

The VESC based battery load tester is a low cost way to get high resolution battery performance data using standard VESC BLDC motor controllers with a few common components like resistors and relays.

Overview:

What is VESC? 

You can think of it like “Arduino” for motor control in the sense it’s an embedded operating
system with scripting in high level language that is well documented.  It’s intended purpose is to drive 3 phase BLDC motors using FOC control, but it also supports repurposing of the hardware
for other applications. 

VESC is a registered trademark of Benjamin Vedder, the Automated Cycle Tester is a way of configuring existing VESC systems.

Why VESC?

VESC is used to perform constant current control on the discharge load and in the case of automated cycling it monitors pack voltage and starts/stops charging by controlling an external relay.

The VESC Battery Cycle Tester was initially developed to allow me to sanity check the values on cells. I needed to test high volumes of cells, sometimes at high discharge rates (100+ amps). Additionally, I wanted full control on the load parameters with a very high continuous wattage output, something that is not readily available in most other cell load testers on the market.

I found that VESC offered a fully functional lisp based interface complete with plotting and real-time variable reporting. This paired to a VESC high power hardware control system that has beefy fets, multiple temp sense, 2 ADC, lots of GPIO pins, and a wide input voltage range that made it the perfect basis of a battery load tester.

My next objective became automating the whole charge and discharge cycle.  This was significantly more challenging to develop and implement than a single discharge cycle, but in the end it was well worth the effort.

After running 150 cycles:

(at the time of writing this), I am confident the results provided by this solution rival systems 10x their cost, maybe even systems 100x the cost.  That cost advantage is assuming you bought all the parts required to make this system; whereas the expectations of this project is to repurpose vesc hardware you already on hand further cutting costs as you can use the VESC for other applications after you finish your battery testing.

The accuracy is closely tied to your implementation of the system and the load parameters.  More on that in the section about error rate and skew.

VESC High Power Control Theory

Vesc is not natively designed for battery load testing, it’s use in this case is more a byproduct of the underlying requirements of BLDC motor control’s need to track input and output current on multiple phases. In automated cycle testing, we need to control a load and a charge cycle, measuring the voltage and current on both would be the ideal case.

In V1 implementation we are only measuring charge voltage during automated cycling. There is a workaround to measure charge current but it requires a second vesc or manual switching of charge and load paths on phase 1 and 3.

Room for improvement:

The Battery load tester V1 script use of only phase 1 and 3 is a limitation from how it is using the VESC in DC motor mode to drive resistors. While phase 2 and 3 could be used to handle charging, there needs to be some C level firmware modifications to achieve this functionality (the resulting solution would be that phase 3 shares a wire to load and charging, using phase 1 or 2 depending on charging or load stage).

I hope someone who knows C better than I can jump in here and work with me to implement this feature as it would allow full tracking of charge current and voltage. There is the drawback of losing the electrical path to BMS charge as charge would be feeding back through vesc on to the same wires used for discharge.

Alternatively, a CAN bus enabled charger could be implemented for high degree of parameter control and potentially info like charge current feedback to the VESC. This could be implemented in LISP allowing the standard firmware to be used without entangling phase 2 and C firmware development.

Pros:

High resolution cell performance charts

Ppen source, both VESC itself and the Battery Tester lisp script

Easy to replicate

Highly customizable

Low cost to implement (if you already have vesc)

Highly rewarding learning experience to see the inner workings of a load testing system

Cons:

V1 implementation is a 2 wire testing configuration
(Not a con if you are testing the exact setup you will have in
real use case as the v-drop will be identical)

2 wire measuring will skew the wh results lower than
actual due to v sag in the wires going to the vesc

Needs to manually calibrate cut-off voltages comparing vesc and multimeter

Most vesc only support pack testing, not individual cell testing as most vesc hardware require being powered from the pack they test, and they often have minimum input voltages

Manual chart saving and re-assembly required
You will have to save your tests somewhat often or vesc tool will crash

Upper limit of about 50 plots at 5000
x/y points each before it starts lagging badly

Recommended you save every 10 cycles
minimum, more often is better.

Reassembling the charts is a bit
tricky given the sheer number of datapoints,
method for that in the operational guide

Charge current not measured in V1

Discharge Load Tester Build Requirements:

Battery pack to be tested

VESC motor controller

PC with Bluetooth or USB connected during the duration of the testing

Suitable resistor to dump the energy

Many appliances designed for standard AC wall power such as toaster oven, space heater, and similar pure resistive loads can work as your resistor.

Connectors and wire

Optional components:

External temp sense for collecting cell temp

Charge Automation

Charger that can run constantly without getting too hot

Relay

I used a remote control relay to maintain total separation from the vesc inputs, as an added bonus it’s got all the relay driving electronics built in and powered from a separate voltage source than vesc.  With the remote powered by and plugged into vesc, it’s simple cheap isolation.

A wired relay could be used but take precautions against back emf kickback

A resistor suitable for your cycle timeframe

If your resistor is not being returned to the same temp at the end of each cycle it could skew the results or cause it to fail from accumulated heat.

Fans

You will want to make sure that the total system says in a thermal status, this will help to reduce testing skew when temp stays in the same range between cycles

Optional:

Vesc compatible bms

While not yet implemented in the V1 version, it would allow cell level data of all cells.

Not as good as dedicated 4 wire v-sense on each cell but a good middle ground that’s far easier to implement

Likely requires USB connection as the data rate of all cells would be much higher and bt might not keep up with a decent plotting resolution

Some Advice

Don’t leave a vesc plugged into a pack that was recently dropped to 2.5v, it will drain it overnight from the minimal current draw.

Do not use points during plotting or it will slow things down

Save often

Check your plot and cycle values on import of xml

Use a 2nd instance of vesc tool to view graphs instead of the one connected to your active vesc

Setup guide:

Vesc:

Phase 1
Load resistor

Phase 2
unused in V1

Phase 3
Load resistor

+/- Vesc to battery side input Attached to battery directly or through bms

Temp sensor on at least one cell can be wired directly to the VESC motor temp sense

Battery Pack

BMS
Balance wire to each cell
BMS charge protection wired to external relay for cycle control

You may connect the relay to the charger AC input side for lower switching load on it

You may need to bypass the discharge path of the BMS in order to keep vesc from being powered off if any cell momentarily hits below its cutoff voltage (usually 2.5v)

This isn’t a problem for single plots as the data can be captured on the PC in real time, but for cycles it can be a problem

Some BMS will lock charge protection if any cell goes below its 2.5v threshold, this can be a problem for full drain tests so you may want to configure the cut-off above that point

Fan

If you are cycling at high discharge rates, especially in the case of non-welded holders, you may opt for using a fan to keep temp ranges the same during cycles allowing the cells to be cooled down while they charge or at all times

Consider how you will test as you may need a dedicated relay to control this fan.

Load Resistor

Use ohms law to determine the resistance you will need based on your voltage and amperage goals

Assume that you will be running the cells to their lowest voltage

10 cells in series would be 42v full and 25v at end of charge
25v 100a is 0.25ohms and 2500w at 100% duty cycle
42v 168a 0.25ohms at 100% duty cycle

higher voltage draws more current at the same resistance
about 59% duty would give 100a at 42v on 0.25ohms resistor

Duty cycle is fairly close relationship as a percentage of full load current at a given voltage

Vesc max is 95% duty so now you can only reach theoretical 95a at 0.25ohms at 25v

Resistors come in all shapes and sizes

If you want to dissipate significant wattage for cheap, many home appliances have the required resistance values, or can be rewired to match your application

Low s counts like 10s for example needs a very low resistance, you may need to combine multiple appliances in parallel

Any heating element with exposed conductive wire can be tapped at its midpoint to half the resistance to either end for lower voltage tests.

If you are running 24s tests you can use most 120v appliances without rewiring them

This assumes they don’t have motors or other AC input requirements, best to pick the simplest appliances and check their wiring

If you are running 30s or higher you may want to put appliances in series to reduce the amp load on them or carefully limit your max duty in testing to prevent overloading them

If you live in a country with 220v AC standards, over heating won’t be as much of an issue, but low S count tests will be more challenging to source the required appliances for high loads

Thermal stasis

Ensure proper airflow or load parameters to ensure the resistors don’t get too hot

There are many options online for dedicated resistors like water heating elements.

The PC, A critical Part of the System

You must have a PC connected to vesc hardware by USB or BT connection with vesc tool installed to run the vesc load tester.

Windows support for BT isn’t perfect, you may need to reboot vesc tool or unpair/pair in windows bt interface

USB allows faster more consistent plotting

VESC Firmware Setup:

You will need to run vesc firmware 6.02 or higher with matched tool version on the PC

1. Boot up on FOC mode
a. app settings> general>dropdown: no app
b. vesc powered at the operating voltage
c. resistor attached
d. this will make sure the voltage offsets are right
e. now you can switch to DC mode and reboot into DC mode as necessary

2. In DC mode
a. You can do simple testing right away, simply click the play button next to the duty cycle value
b. This is just a test to see how everything is going, you can check real-time current and voltage by clicking RT button
c. You can set the switching frequency between 3-25khz, should be matched to the choice in FOC mode so voltage offsets are right

3. Now you have validated the hardware is working and load is applied to the battery
a. Next take the latest lisp script for single load testing
b. Modify offsets and min/max values accordingly
c. After fully charging the pack and unplugging the charger, type (start) into the command line
d. On the experimental plots tab, you can see your freshly minted wh, ah, current, duty, temp values plotting
e. Select 1-6 to control the plots
f. Save as xml first
g. Then you can save as CSV
h. You can also screenshot the charts, which is better than export if you have high screen resolution

4. The first test doesn’t give the best results as the starting duty cycle value needs to be tuned
a. You can hit poll status to see the arrive-target variable
b. This is the duty cycle value when the amp target was reached, it’s good to set your start duty to that for the next test.

5. Now the next test can start and maintain the ideal amperage through the whole test
a. You will need to manually determine the duty for each current level you want to test at, this will also change with different choice of load resistor ohms

Automated Cycle Testing:

In addition to the above setup process for simple load testing,
Perform the following setup process:

1. You can start cycling in the load or charge stage by (def load 1) for load first, and (def load 0) for charging first
a. Cycle 1 should be used if you are starting on load
i. If you start in charging at cycle 1 it will plot load cycle 2 on the first load cycle, so in this case start on cycle 0 to get it to plot at the right starting index
b. (def plots 0) when starting cycling
i. If you import 5 plots before a load cycle Def plots 5
ii. To clear plots on the start of the next load cycle just (def plots 0)
2. You will want to check your balance time and v start parameters against actual pack values
a. If you want to go to fully charged you can code an additional trigger to determine if the charger has stopped and flip the cut-off relay to it

I recommend you stop at the end of discharge phase by terminal command or unplugging the charger

You can also stop before discharge stage by unplugging the resistive load from the phase 1 or 3 any time before the charging phase finishes.

Situational Handling:

• It’s not plotting
o Is the vesc still connected? Rt amps updating?
o Is the 1-6 plots all checked?
• It’s plotting black or zig zag lines
o Cycle and/or plot numbers not lined up
 Printing black because you didn’t start at the right plot number (higher than the number of created plots)
 Fix by opening xml and manually adding cycle name and color
o Zig zag plotting means you messed up bad, the data is tough to separate now as you have 2 sets of overlapping datapoints assigned to the same plot
• Starting on charging vs load
o Load
 It will iterate the cycle count when load begins
 With load 1, Set cycle 0 for the initial cycle to plot as cycle 1
 Charger relay should have the charger turned off
o Charge
 Charge cycle is attached to the load prior
• if you start load 0, set cycle 0 and it will still plot as cycle 1
 Charger relay should have the charger turned off
• If it’s on, you can simply (def end-of-load 0) to turn off charger relay issue detection for this cycle
• If the rely is off when you run that command, you can run (button-press) to manually flip the relay state

A Dichotic Relationship

In the context of battery cycling, there is this odd situation where you need to cycle continuously to get good data regularity, but it’s risky to leave it unattended. Data needs to be saved frequently, and environment temp needs to be maintained. But batteries are not without risk and shouldn’t be left unattended.

Running hundreds of cycles can be an effort intensive 24hr ordeal, be careful not to make mistakes if you are working late at night(ask me how I know LOL).

You will need to decide which factors you will be testing for and design the testing environment to suit.

Thermal management

Thermal uniformity

Vesc current sense will skew with thermal changes, so make sure it starts +/- 1.5C if you want consistent results

You could control a few additional fans and locate the pack in a box so that you can selectively ventilate the vesc/batteries to outdoors/indoors in a way to keep thermals uniform test to test.

A way to achieve thermal stasis using what’s already available is to arrange the thermal output of the tests to be either indoors or outdoors. Some fans and directional ducts can achieve this.
There are 3 key temperatures to be concerned about:
Cell temp as a base variable for the tests.

Vesc temp as it skews the current measurements and the load profile
Ambient temp as it skews how the prior two will behave at a given load.
With intensive fast charge fast discharge cycling, a key objective should be to maintain a minimum cell temp significantly higher than your ambient temp, this allows you to cool the cell by increasing airflow to it (or into its compartment), and heat the cell limiting airflow.

If you put a fan on your vesc, consider it will push towards the ambient temp, so this may be a concern if you don’t have dynamic control on it. The alternative is to connect the vesc to a decent size chunk of metal that will hold enough thermal energy to keep it more constant cycle to cycle, alternatively you could expand the thermal system to pull warm air from the end of the load test to correct the vesc base temp on a cycle by cycle basis.

Circulating air in your room may impact how the cells are cooled, so consider all the variables before starting.

Water based heat dumping will cause evaporation even if not boiling, so make sure it’s filled for long automated cycle runs.

Insulate your temp sensor wires, electrically and thermally.

When using small temp sensors, their results can be skewed by any ambient airflow even over the wires leading to them, so avoid using enameled wire and instead use wire with thicker insulation.

Don’t connect the sensor to too large a gauge of wire or it will act like a heat sink.

Cell Holders vs Welded Packs

In my testing I’ve used 3d printed cell holders, this is the largest source of headache in this whole project due to its use of screws to tension the copper tabs. This is accomplished by using a multiple component holder where the cells are held in place with normal cell holders and there is another compression “cap” part that transmits force from the screws to the tabs. The cap was printed with SLA resin that’s rated to about 100C before serous deflection, but I found that it does slowly stretch when heated to 60C-70C ranges. This required me to tighten the holders several times, for the first 50 cycles it was more of a problem, at 100 cycles it was less of an issue as the elasticity was reaching its limit. I recommend tightening it when it’s hot as that’s when the plastic parts will stretch. This elasticity resets if you take the holders apart.


Even better yet, don’t use cell holders at all if you can just weld the pack. However, some use cases require the cells remain non-welded during testing phase, so feel free to follow the links to the files and try it yourself.


I had issues with copper tabs as a contact surface because they would oxidize and reduce conductivity, increasing that tabs heat and also increasing its oxidation rate, fueling an annoying cycle of having to clean them. This is why brass is usually used as a contact as it’s not going to oxidize so easily. Not sure how I feel about these findings, maybe brass coated copper would be the ideal long term solution. I feel like it has to be a multiple contact patch solution so that each can have its own spring loading

The nature of testing equipment is that there are several factors of skew.
• temperature sensitive
• initial component tolerances
o specific component tolerances
• calibration
o initial point calibration
o over a thermal range (future version)
o better to just maintain the same ranges

That's it for now

More details will be updated as it's developed, check back regularly for updates.

I'm happy to talk about the VESC tester or the testing process, feel free to reach out to me on the Contact Us page