Cell tester for my school's FSAE team
One of last year's senior design project proposals from my school's FSAE team was a cell tester that could be used to characterize the cells we use in our high-voltage accumulator. The main requirements for this project were to measure the cell voltage, the temperature of the cell at various locations, and the pressure generated by the cell as it was being charged and discharged at various rates. The group assigned to this project produced a safety enclosure with a thermistor array and a set of load cells for collecting data, as well as a circuit for charging and discharging the cell. While the sensor array circuit worked reasonably well, the charging and discharging circuit was poorly designed and could not handle the desired loads. The circuit also changed several timed throughout the project, and the end result was poorly document. The circuit, as I found it, is shown below:
This circuit has several major issues. First, the circuit was supposed to be able to draw up to 40 amps from the cell and supply up to 25 amps into the cell. In discharging, the MOSFETs would have to collectively dissipate 160 watts. As implemented, there was no heatsinking on any of the MOSFETS. The second major issue was that if the charge and discharge relays are both de-energized but the control relay is closed, then the cell is shorted directly to the 4.2V supply, which would have resulted in an unsafe current flow. The relays and MOSFET gates were also powered from the lab supplies, so it would not have feasible to modulate the discharge current according to real-world recorded data, which would provide the most useful results. Finally, even if this were possible, the actual current can sometimes reach over 150 amps, which is way beyond what the original circuit was designed to handle.
New design
Due to the issues with previous circuits, the cell tester was never used to collect any actual data. Thus, I offered to design a new charge/discharge circuit. The main design requirements I received for the new circuit were that it should be able to discharge at up to 150 amps and charge at up to 100 amps.
My first idea was to use a simple buck-boost converter with a load on the output, as shown below:
The gates of the MOSFETs would be driven via a gate driving circuit from an STM32. When the lower MOSFET is on, the current in the inductor increases, and when the upper MOSFET is on, some of the energy in the inductor is dissipated in the resistor. By modulating the duty cycle of the MOSFETs, the STM32 can modulate the being drawn from the cell.However, this circuit has several issues. First, all parts of the circuit must be rated for at least 150 amps, including the inductor, the MOSFETS, and the connecting wires. Finding MOSFETS with a low enough RDSon would also have been tricky. Second, this circuit would not be capable of charging the cell.
To fix the second issue, one could add a set of MOSFETS to switch the output between the load and an external supply:
However, if the circuit was running at a high current, then the voltage on the load resistor would exceed the supply voltage and the body diode of the P-channel MOSFET would conduct and backfeed power into the supply. To fix this, one could replace the P-channel MOSFET with a diode pointing down, which would only allow current to flow out of the supply. When charging, the buck-boost circuit would feed current from the supply into the battery, and the load resistor would be switched off. When discharging, the load resistor would be pulse-width modulated such that the average current through the resistor matches the current from the converter. This prevents large currents from flowing from the supply directly into the load resistor, especially at low discharge rates.
To fix the first issue, I first considered various permutations of inductors and MOSFETS, as well as putting several MOSFETS in parallel for a lower total resistance. However, these solutions would still require solid high-current connections. I looked at some other power circuits that handle similar currents, and saw that many of them used multiple converters in parallel to achieve higher currents.
Around this time, I grabbed a rather old stepper motor driver out of an electronics recycling bin at my school. Since it still worked, I figured I could use it to test the topology of my new buck-boost circuit. Since the stepper driver had four half-bridges, I designed the converter for four parallel stages. The simplified preliminary circuit design is shown below:
Analysis of the converter
Ideal converter
If we look at a single stage of the converter, the current in the inductor will increase when the lower MOSFET is on, and decrease when the upper MOSFET is on. Let \(D\) be the duty cycle of the lower MOSFET and \(\Delta t\) be the period of the switching. Thus, the duty cycle of the upper MOSFET is \(1-D\). If we disregard any losses in the system, the change in current across a cycle is thus the difference of the increase and decrease:
$$ \Delta I = \frac{V_{bat} D\Delta t}{L} - \frac{\left(V_{out}-V_{bat}\right)\left(1-D\right)\Delta t}{L} $$where \(\Delta t\) is the period, \(D\) is the duty cycle, and \(L\) is the inductance. When averaged over the whole cycle:
$$ \frac{dI}{dt}\approx\frac{\Delta I}{\Delta t} = \frac{1}{L}\left(DV_{bat} - \left(1-D\right)\left(V_{out}-V_{bat}\right)\right) $$At steady state, \(dI/dt=0\), so we can determine a relationship between \(V_{bat}\) and \(V_{out}\):
$$ \frac{V_{out}}{V_{bat}} = \frac{1}{1-D} $$Let \(I\) be the input current to the converter. This current will alternately flow through the upper and lower MOSFETS. The average current out of the converter \(I_{out}\) will thus be \(I\left(1-D\right)\).
When the output of the converter is connected to the resistive load, this is not an issue. The duty cycle determines the output voltage, which determines the output current, which in turn determines the input or battery current. However, when the output of the converter is connected to the supply, \(V_{out}\) is fixed, and \(V_{bat}\) is typically considered to be constant, so there will only be one duty cycle at which the converter is at steady-state. If the duty cycle is slightly higher or slightly lower, the current will drift over time. Maintaining stability in this case would be slightly trickier. The duty cycle would also no longer directly determine the charge current. To increase the magnitude of the charge current, one would have to briefly decrease the duty cycle and then restore it to its steady-state value.
Lossy converter
To model the losses in the converter, the RDSon of the MOSFETS, the resistance of the inductor, and the resistance of the wiring can be combined into one resistor \(R\) on the input of the converter. Losses on the supply side can likewise be represented as a single resistor \(R_{sup}\).
When the output is connected to the load resistor, the current can be calculated as follows:
$$ I = \frac{I_{out}}{1-D} = \frac{V_{out}}{R_l\left(1-D\right)} = \frac{V_{in}}{R_l\left(1-D\right)^2} = \frac{V_{bat}-IR}{R_l\left(1-D\right)^2} $$ $$ I = \frac{V_{bat}}{R+R_l\left(1-D\right)^2} \tag{Eq. 1}$$where \(R\) is the input resistance (including wires and MOSFETS) and \(R_l\) is the resistance of the load, including the connecting wires.
When the output is connected to the supply, the current can be calculated as follows:
$$ I = \frac{I_{out}}{1-D} = \frac{V_{out}-V_{sup}}{R_{sup}\left(1-D\right)} = \frac{V_{bat}-IR}{R_{sup}\left(1-D\right)^2} - \frac{V_{sup}}{R_{sup}\left(1-D\right)} $$ $$ I = \frac{V_{bat}-\left(1-D\right)V_{sup}}{R_{sup}\left(1-D\right)^2+R} \tag{Eq. 2}$$First prototype
The stepper driver I found in e-waste originally had four IR2110 half-bridge gate drivers, each driving a pair of IRFP350 MOSFETs. The gate drive signals were generated by a small CPLD that generated the stepper drive and microstepping signals. The IRFP350 has an on-state resistance of around 0.3 ohms, which is way too high for the desired currents. To make the first prototype, I removed the CPLD from its socket and instead connected an STM32 breakout board with jumper cables. I also replaced one half-bridge with IRF540 MOSFETs, which still had an on-state resistance of 77 milliohms, but was readily available. For the inductor, I used a PQ2614BLA-6R8K 6.8μH inductor with a saturation current of 26 amps. The load resistor was three 0.5 ohm 5W power resistors connected in series. An image of the first prototype is shown below:
To test it, I connected the circuit to a 4.2V supply and measured the current with a clamp meter. While I was able to pull current from the supply and vary the current by changing the duty cycle, the voltage on the output did not increase with increasing duty cycle as expected, but instead decreased. Initially I figured that this was due to the resistance of the MOSFETs and decided to wait until the new low-resistance MOSFETs arrived. It was not until after making the second prototype that I realized that while the MOSFETs were insulated from the heatsink with a thermal pad, the bolt holding the MOSFET to the heatsink still made electrical contact. This effectively shorted across the upper MOSFET through the heatsink, so the lower MOSFET was just shorting out the output.
Second prototype
For the second prototype, I ordered a set of G025N03T MOSFETs, which have a rated RDSon of 2.8 milliohms. I replaced the two IRF540s and the six remaining original MOSFETS with these new MOSFETS. I also stripped out all of the antiparallel diodes across the MOSFETS, both current sense resistors, the two orange film capacitors, and the power connectors for the stepper motor. For the second prototype, my main goal was to clean up the wiring, shrink the loop area for each of the stages, and make the layout more modular. For this prototype, I only populated two of the four stages:
The main change I made was placing the inductor associated with a particular half-bridge directly over the MOSFETS. This decreased the length of the current path and made the routing between the stages more efficient. I also added smaller film capacitors on the input and output of each stage in addition to the bulk electrolytic capacitors on the input and output. Finally, I placed the load resistors in a cup of water to keep them cool when testing.
Unlike the first prototype, the second prototype behaved almost exactly as expected. To characterize the system, I first programmed the STM32 to vary the duty cycle of its output based on the setting of a potentiometer. I then varied the duty cycle and recorded the current measured by the clamp meter. The data I collected is shown below, along with the predicted current according to equation 1 above with \(V_{bat}=4.22V\), \(R_l=1.47\Omega\), and \(R=0.022\Omega\):
In order to support both charging and discharging, I needed to be able to switch the load on and off. For this, I used two MOSFETs connected in parallel to an IX4426 gate driver IC. The MOSFETs and perfboard were re-used from the original charge/discharge circuit. I also swapped out the water-cooled power resistor load for a heater coil from a dryer and replaced the skinny 24-gauge wire with a thicker wire. Finally, I added a differential amplifier circuit to measure the voltage on the output of the converter.
To supply the circuit when charging the battery, I connected a set of parallel diodes between an external supply and the output of the converter. Also, when testing, I noticed that since the wire in the load resistor was coiled, it had a high parasitic inductance. To mitigate potential issues, I added a flyback diode across the load. The circuit now looked like this:
Control system design
One of the goals for this project was to be able to feed in current data collected while driving and "replay" it onto the cell. To make this work, I would need to implement a control algorithm on the STM32 that sets the duty cycles of the converter and the load to make the measured current match the current setpoint.
Load duty cycle calculation
Since the supply diodes force a minimum voltage on the output of the converter, the load must be reduced when the desired current is lower to prevent excessive current flow from the supply directly into the load. If we assume the voltage at the output of the converter is \(V_{set}\) and the desired input current is \(I_{set}\), then the output current can be determined by applying power conservation:
$$ I_{out} = \frac{I_{set}\left(V_{bat}-I_{set}R\right)}{V_{set}} = D_l\frac{V_{set}}{R_l} $$Solving for the load duty cycle:
$$ D_l = R_l\frac{I_{set}\left(V_{bat}-I_{set}R\right)}{V_{set}^2} $$Depending on the sign and magnitude of \(I_{set}\), the calculated load duty cycle may be greater than 1 or less than zero. If the load duty cycle is greater than 1, it is clamped at 1 and the output voltage will be greater than the voltage setpoint. In this case, the converter is running in load-connected mode. The load duty cycle will only be less than zero when charging (\(I_{set}\lt 0\)). In this case, the converter is running in supply-connected mode. If the load duty cycle is in between, the converter is running in load-modulated mode.
Converter duty cycle calculation
In general, the formula for the duty cycle follows a similar form for each of the three operating modes:
$$ D = \left(1 - \frac{V_{bat}-I_{set}R}{V_{out}}\right) + K_{i}\left(\int \left(I-I_{set}\right)dt\right) + K_{p}\left(I-I_{set}\right) $$The above expression for \(D\) consists of a feed-forward term, an integral term, and a proportion term. The feed-forward term represents the duty cycle required to get the desired current if converter behaves according to the lossy model above. To compensate for any differences, I added a PI controller that adds to the duty cycle. The magnitude of the integral term is clamped to prevent the integrator from reaching an irrational value. The program also implements two separate integrators, one for supply-connected mode and one for the load-connected and load-modulated modes.
This algorithm has a tendency to be unstable when \(V_{out}\) is not correctly determined. This is because \(V_{out}\) constitutes part of the feed-forward term, and if \(V_{out}\) increases, the duty cycle will increase, which will in turn increase the output voltage. This results in overshoots whenever the current setpoint changes. For the most part I managed to fix this issue by making sure the voltage measurement circuit for \(V_{out}\) is properly calibrated and by tuning the \(K_i\) and \(K_p\).
Measuring \(R\) and \(R_l\)
The equations above depend on \(R\) and \(R_l\) to determine the converter and load duty cycles. Since the precise values of these resistances will change as the converter and the load heat up, these values must be continually measured. This is done with the following formulas:
$$ R = \frac{V_{bat}-V_{out}\left(1-D\right)}{I} $$ $$ R_l = \frac{V_{out}}{I\left(1-D\right)} $$The outputs of these formulas are low-pass filtered, since the resistances typically only change with temperature. To prevent instability and division by zero, the loss resistance \(R\) is also only calculated when \(\left|I\right|>5A\), and the load resistance is only calculated when \(I>5A\) and \(D_l=100\%\)
Final prototype
To make the final prototype I added the remaining inductors and capacitors and upgraded the battery connection wires from 18 gauge wire to 6 gauge wire. I also soldered all of the free-floating components to perfboard and added LEDs to all of the phases. Finally, I integrated the thermistor array board designed by the original group into my charge/discharge circuit.
The final schematic of the cell tester is shown below:
The following elements on the schematic should be noted:
- The wire colors and connection topology in the schematic approximately match those in the actual device.
- A common-mode choke FL1 was added between the gate drive output for the load MOSFETs and the load MOSFET gate driver itself. This mitigates the effects of high-frequency noise between the ground of the gate driver and the ground of the STM32. Even through the two grounds are continuous, noise is induced in the ground of the gate driver since it is grounded to the ground of the converter stages. Under certain conditions, the voltage difference due to noise is high enough to turn on the gate driver. This would cause high frequency oscillations (~20MHz) in the load and load MOSFETs. These oscillations would then couple to other parts of the circuit and interfere with nearby electronic equipment.
- The resistors R14, R15, and R16 for a voltage divider and low-pass filter with pull-down and filtering capacitors soldered to the breakout board.
+12V_GDon the stepper driver refers to the common power rail for all of the half-bridge gate driver ICs on the stepper driver board. The trace connecting this rail to the output of the stepper driver's 12V regulator was cut and the E-stop switch was soldered in between. Furthermore, the gate driver for the load MOSFETs is also powered via the E-stop.- An MCP6002 op-amp (U3) was added to buffer the outputs from the thermistors and load cells. This prevents voltage from being dropped across the thermistor multiplexers.
- The circuit is powered from a single 12V supply (denoted J2) that powers both the control circuitry and supplies power into the battery when charging.
- The box on the bottom left labeled STAB (Sensor and Thermistor Array Board) refers to a board located incide the cell test enclosure. This board has 63 thermistors arranged in a 7x9 grid across its surface and is pressed against the cell while it is being tested. This allows the thermal response of the cell to be captured and logged by the system.
Conclusion
With the above described algorithm, the charge/discharge circuit of the cell tester can control the current quite well. A plot showing the current setpoint and actual current is shown below.













Comments
Post a Comment