To interface between renewable energy sources like solar and wind and a load where that energy will be used, we need a means of storing energy and converting it from a DC signal to an AC one.
We built a small-scale battery-charger to inverter system to do just that.
The topology shown uses a half-bridge converter to take DC photovoltaic panel voltage to DC battery voltage. The panel we are using is the Canadian Solar CS6P-235P, 235W solar panel. The maximum voltage range for this panel is 0-36.9V, and a short circuit current of 8.46A.
We are using 8 Panasonic CGR18650CG 2200mAh 3.6V nominal lithium-ion batteries, 2 in parallel and 4 in series to store excess energy from the solar panel for later use by the load connected to the inverter. Each cell varies between 4.2V and 3.2V, resulting in a total voltage needed across the batteries from 12.8V to 16.8V.
In order to bring the panel output voltage to the battery voltage, we used a PWM-controlled buck converter. The voltage required across the batteries during charging mode needed to be higher than the total series terminal voltage of the battery packs. Instead of calculating this overpotential for every point along the charging curve, we determined a safe charging current of 0.5 amps (C/4.4), and implemented a feedback controller to ensure that current would not deviate from this chosen charge rate. Because of this, building an accurate current sensor was critical.
After the constant current charging regime, the batteries would be held at constant voltage to avoid overcharging, while the remainder of the PV output was sent to the inverter.
Constant-current, constant-voltage charging
We decided to build the circuit using PCBs and surface mount components, and had to start very early on the design in order to get the boards printed in time. The circuit was quickly built in LTSpice using MOSFETS for resistive cell balancing, but ultimately built the schematic and board layout in EAGLE. The cell-balancing was then achieved using BQ29209DRBR cell balancers from Texas Instruments that are able to automatically balance 2 cells in series and 2 in parallel between 4V and 10V using external resistors. This simplified the control of overvoltage and undervoltage protection.
Battery charger LTSpice schematic
EAGLE PCB schematic
Half-bridge
Cell balancers
Battery Voltage Dividers
Full circuit
Component selection
For the benefit of future battery charger builders, here are the components we used in the construction of the battery charger stage.
1x STM Discovery microcontroller board
2x NMOS transistors
1x half-bridge driver
22x 150nF ceramic capacitors
3x 33uF aluminum capacitors
2x 470uf aluminum capacitors
1x 22uH inductor
2x IC cell balancers
1x 5-20V input, 3V output LDO
2x 15A diodes
1x instrumentation amp for current sensing
10x resistors for voltage sensing for 4 battery modules and PV input
2x 4.7 ohm resistors for gate signal
1x 1 ohm resistor for gate driver Vcc
1x 4 pin header for gate driver PWM inputs
1x 3 pin header for gate driver supply inputs
1x 6 pin header for voltage and current sensing
8x 2 pin headers for battery inputs
8x 3.7V nominal 18650 Li-ion batteries
1x LCD screen
Final EAGLE PCB Layout
Control Algorithm Test Circuit
While we were waiting for our PCBs to arrive, with our stomachs full of Thanksgiving Turkey, we built a circuit using the gate drivers and MOSFETs in the lab to test our duty control algorithm. The first goal was to use the current and voltage sensing circuit we had built while constructing the energy meter earlier in the course with the control algorithm. The algorithm used P-D control with current as the input, and duty was adjusted accordingly to achieve the desired current. The goal for these simulations was to keep current at .5A. While current and voltage were sensed correctly, the batteries had not arrived and we could not try our hand at cell balancing before the PCBs arrived, so we simulated our batteries with a resistive load, and were able to adjust current accordingly.
The PC Boards arrived on the last day of class!
PC Board without Components (Front)
PC Board without Components (Back)
PC Board with Components
The Circuit
After mounting our components, we assembled a circuit simulating the inverter load with a resistive load. We only used four batteries for the initial setup so it would be easier to monitor our control algorithm. Our Discovery Board was able to sense and then report on an LCD the current through the batteries and the voltage across each battery.
The PWM Signal Controlling the Buck Converter
Batteries Charging
Final Stages
We were never able to successfully connect the battery charger with the inverter PCB. Complications with gate drivers slowed down progress considerably. The final circuit was one that allowed for the charging of a battery based on the current provided by the power source, and so only the power path was ever truly tested on the PCB in the limited time that we had to test it. Some debugging of the instrumentation amp circuit also needs to happen in order to end up with a very dependable current reading for the control algorithm. In the future, we would like to better tune the hardware and control so that the rate at which the batteries charge can be set through the user interface. We would also like to connect the two PCBs into one circuit and connect this to a solar panel, creating a scalable off-grid system with 1 solar panel, 8 Li-ion cells and a small load.
If you would like to see, synthesize, manipulate the files used in this project:
The task at hand was to make an AC signal from the DC output of the battery-charger. As Professor Bill Dally says, “AC really is just slow-varying DC.” What this boils down to is the need to produce a different value of a DC signal in a short period of time such that a sine wave with some desired frequency is the overall signal produced. Our goal was to produce a single phase 120V 60Hz AC signal as one would in the outlet of a household in North America.
Full Bridge Topology
Full Bridge Topology Inverter
Our inverter is based on a full bridge topology with four switches to generated the sine wave. The 60Hz frequency is generated with PWM from the microcontroller which also bucks the battery-charger input to a controlled voltage that we then step-up with the transformer.
Inverter spice schematic
PCB Design
The process involved a few iterations on the schematic and more than a few on the board.
And finally,
And our various boards, from early vestiges to final product:
This was our first attempt at PCB design, hence the series of boards. We initially designed to isolate sensitive signals from noisy ones, but that proved to be very complicated to route. We then opted to design for a board that would be easy to route the traces. Our final product tweaks this design to include consideration for the high/low current isolation.
Final board
Control
For our inverter control we used pwm unipolar control. This type of control can be viewed as operating the full bridge as two buck converter. The left two FETs operate as a buck to create the positive part of the sine wave while the right FETs have the top FET open and the bottom FET closed. Then at halfway through the sine period we start to create the negative part of the sine wave by using the right two FETs as a buck converter and leaving the bottom left closed and the top left FET open. One of these cycles happens every cycle and we are operating at 60Hz.
The input voltage is the battery voltage which is anywhere between 12.8V-16.8V. In some inverter designs we looked at online they designed the control to have a look up table the Duty factors to get each voltage along the sin wave. I used matlab to create an array of the voltages along 1 period of a 60Hz sine wave being set at about ~10kHz (the speed of adc). However because our input voltage is variable we instead created a look up table of voltages along the sine wave and then used feed forward control to find the correct duty cycle.
We used two pwm channels to implement this control.
PWM signals for Full Bridge Inverter
Transformer Design
Confronted with various options on Newark, we whittled down our considerations to E and ETD cores.
We compared different cores based on general specifics.
After considering which had the lowest rated losses at 100kHz, we calculated copper and core losses at our estimated current and B field.
Based on our initial calculations, we chose the ETD 29/16/10 core. Seemed convincing. However, our estimate for the current and B field was lower (1.2A and .05T) than we would actually expect with a 40V solar panel (~20A and B field closer to core saturation).
We then transitioned to using the core we had as part of our prototype. We conservatively measured the amount of wire we needed in order to have enough wire to wind the primary and secondary. Folks on the second floor of Packard were amused with our extensive layout of multiple strands of copper wire.
Our glorious transformer
We then twisted the wires together, which is easier said than done, and then wound the core. We ended up winding 10 strands on the primary and 140 on the secondary with 5 parallel strands of 20AWG magnet wire per turn. We came up with these values as part of a compromise on the core we already chose, the wires in the lab, values we calculated, and what would really fit. Given more time, we would choose a larger E core and use a larger gauge wire such as 16AWG wire to handle a larger current.
Components
This was an incredible learning experience for us. If you’re interested in replicating or improving upon the design –yeahh open source- here is what we used in the process:
Our boards took a while to come so while we were waiting on them, we built our inverter with the green electronics lab kit. This turned out to be more difficult and time consuming then we had originally predicted.
We aimed to produce a sine wave at 60Hz with our inverter. With feed forward control adjusting the duty, we had a noisy sine wave output at 60Hz. After increasing the speed of the pwm, the ringing on the edges of the sine wave decreased.
After generating the sine wave with the inverter without the transformer, we added the transformer for the voltage step up. After adding the transformer, the noise on the sine wave further decreased.
PWM for one of the channels controlling a half bridgeVoltage output without TransformerVoltage Output with TransformerBoard with Heat Sinks
And finally, if you would like to see, synthesize, manipulate the files used in this project:
Note to other groups working on their final project:
Label your wires with some tape [especially your primary and secondary windings of your transformer. But if you didn’t, there’s always the connectivity test]
If you’re considering not using a transformer, reconsider. Actually figuring out what you need to make a transformer function properly is far more interesting than just thinking about a turns ratio. Also remember to use sandpaper to remove the enamel from the ends of your magnet wire when you want to connect it.
The ADC on the STM32 can’t run faster than 10kHz because it requires 10us cycle time.
Check your grounds. Consider connecting your microcontroller and half bridge grounds.
The oscilliscope is your best friend. If you are having an issue, the first step is to start probing your nodes to see if you are getting what you’d expect.
When laying out a PCB, put a lot of thought into your power paths. Doing this early will save you a lot of time in the long run.
Ground planes are an amazing thing.
Learning new skills [ie. PCB design] will put you behind, so try to be realistic about your time. However, it is totally worth it.
Future Work
The next step for our project would be to get our PCBs working together and hook our system up to a solar panel.
In the future, we would like to expand the inverter system to output three phase AC to drive an induction motor. We would also like to implement a maximum power point tracker and the final functionality of a three-port inverter. That is, we would like to enable charging of the batteries from the “grid-tied” load when there is no power coming from the solar panel.
Acknowledgements
We would like to thank Ned Danyliw, Andrew Ponec, Hong En Chew, Steven Clark, and Professor Bill Dally for their support, patience, and motivation in this project and throughout the quarter.