Saturday, October 03, 2015

An Open Source, Micro Solar Inverter - based on Arduino - Part 2

In the first part of this "Open Inverter" series, I described how Trystan and I had cooked-up a simple inverter based on a mosfet H-bridge, an "Arduino" and a 12V-230V mains transformer.

Before going into too much technical detail, (as I am still documenting it),  I first wish to explain why I think that the combination of microcontroller and H-bridge is an essential building block in modern power electronics, and the ability to efficiently transform ac to dc, dc to dc, and dc to ac are paramount to the renewable energy sector.

FETs capable of switching moderate power levels are available surprisingly cheaply. The ones we used in our inverter were under £1 each.  The driver ICs (IRF2110 or similar) are a couple of quid each.

So, it's possible to make up the H-bridge stage and drivers for under £10 - and that includes some heatsinks.

However, the ubiquitous H-bridge is also available in the form of an IC - or rather 2 ICs - as most implementations appear to use half H-bridges.

Infineon make a range of these - intended for automotive motor control, and so can handle high currents, but generally at 28V maximum.  This makes them suitable for 24V battery systems.

The BTS7960 is typical of the Infineon range.  It has a maximum voltage of 28V, but with correct heatsinking can switch up to 43A.  Theoretically, a pair of these devices would be capable of running a 1kW inverter - but I would be happier in the 250W to 500W range.

It includes over-temperature, over-voltage and current limiting built in. It also outputs an anaogue signal proportional to the drive current - which can be used to monitor the performance.

Ebay is a good source for ready built modules containing a pair of BTS7960 devices.  I bought a pair of these for about £8 each.

A low cost BTS7960 H-bridge module from Ebay or TaoBao

The BTS7960 is also available as an Arduino shield - called the MegaMoto shield, which holds a pair of BTS7960 plus jumpers for easy selection of which pwm to drive them from. At £32 its a bit overpriced, but handy if you are already working with an Arduino platform.

Other BTS7960 boards are availabe from Taobao - of varying design and quality - with or without heatsinks - but I consider adequate heatsinking to be essential. 

This application note for the BTN8962 - a newer, related family member - gives good details on how to get the best from these devices.

Making the H-Bridge Work for Us.

If you look at a typical FET H-bridge, you will see that each FET is bypassed with a reverse biased diode. This is sometimes called the body-diode, and it comes for free, as part of the process of implementing a  FET on the silicon substrate.  It is tremendously important in protecting the FET from inductive switching over voltage spikes - as it returns them safely to the supply rails, but can also work in our favour in allowing easy implementation of rectifier and boost converter topologies.

A half bridge like this one may easily be turned into a boost converter by supplying dc power into the terminal marked OUT, via a series inductor, and extracting the boosted voltage from the terminal marked VS.

Conversely, a buck converter can be made by applying power between VS and GND, and extracting a reduced voltage between OUT and GND - again through a series inductor.

So two of these half bridges, a couple of inductors and you have all the makings of a boost- buck dc/dc converter.

Why would you first boost a voltage, only to buck it down again?  Well if it was the varying output voltage of a solar panel which drifted depending on clouds - it would be handy to boost it so as to properly charge a battery pack at the correct charge voltage.  Then you might want a stable 12V or 5V supply for powering some equipment - in which case you would buck the voltage down again.  

This ability to transform dc power up and down, with high efficiency, or match the varying dc output of a pv panel - so as to capture peak power, is very important - and it can all be done with the H-bridge controlled by an 8-bit Arduino. 

The Tasks of the Arduino.

In the 10 years,  Arduino has become a familiar and accessible microcontroller platform.  Even though it is only an 8-bit, 16MHz device, it can still be used to great effect in power electronic applications.

We built up "breadboard Arduinos" which closely follow Cefn Hoile's Shrimp design. Essentialy a ATmega328 IC with crystal, reset and FTDI cable header.

Shrimp - a minimal breadboard "Arduino" - by Cefn Hoile

The Arduino has to generate complimentary PWM in order to drive the H bridge. In some applications independent PWM channels may be needed to control each side of the H-bridge separately.

In addition to pwm generation, the Arduino should also monitor current, voltage and load regulation.

By making use of "Fast PWM" and "Fast ADC" on the Arduino, the ATmega328 can achieve quite a lot of control whilst generating the sinusoidal pwm.

Our first task on the Arduino is to generate a sinusoidal signal using "Fast PWM".  

For those who are eager to experiment, I have created a Github Gist containing the sinusoid pwm generation sketch.  This produces complimentary pwm on digital pins 3 and 11 - just what you need for driving H-bridges.

To test this routine, make a low pass filter from a 10K resistor and 100nF capacitor and attach to either digital Pin 3 or 11. This will reconstruct the sine wave from the digital pwm waveform - and give you a scope trace similar to that at the start of this post.

In the next part - I will have the schematics for the FET version of the inverter for eagleCAD. In the meantime I encourage readers to try and get the Arduino or Shrimp to produce a 50Hz sine waveform.


No comments: