An open hardware platform for experimenting with DC-to-AC conversion, power and energy metering and grid tie inverters.
The openMicroInverter, or in short oμiv, is an Arduino-UNO based DC-to-AC power converter. The oμiv platform is meant for doing experiments with power electronics and energy systems. The oμiv is intended to be configurable as:
Why then using the 8-bit Arduino-UNO? Just because it is fun to squeeze the most out of it:-) Furthermore, this project shows the full capabilities of the TrueRMS Arduino library from one of my other repositories. Applications i, ii and iii have been successfully realized so far...
This is work in progress...
The converter topology of the oμiv is a single-phase, single-step, transformer coupled power converter with a full-bridge inverter. This type of converter is not as efficient as the combination of a high frequency switching boost converter with DC-to-AC converter, but the oμiv is simple to build and it is relatively safe to operate.
There are two versions of the hardware. The first design is the development model and second design is the final design of the oμiv platform. The development model has been used for the development of the software. Please refer to the schematic diagrams to understand further explanation.
The openMicroInverter development hardware A rapid prototype of the inverter was realized for doing software development. The schematic of the development model is named openMicroInverter_dev.pdf. A somewhat older H-bridge driver, the HIP4082, is used for the design. The HIP4082 is a medium voltage, medium frequency full-bridge driver, nowadays by Renesas. The driver has a build in turn-on delay to create dead time required for switching between the top and the bottom FET's. With this feature it is possible to drive the chip directly from the PWM generators of the ATmega328P (which are less sophisticated than the timers of STM32 micro-controllers...).
Currently I am investigating to use the Dual Channel H-bridge Motor Shield from Elecrow to enable experimenting with the inverter without to overcome too many hurdles to set up the hardware. The high power DC-motor shield from Elecrow is a relatively new shield for Arduino including two 8A full H-bridges with discrete power MOSFET's.
The openMicroInverter hardware The plan is to design a single PCB module for the oμiv and to use low-cost components.
To be continued...
Arduino-UNO Pin-out:
Pin | In/Out | Function |
---|---|---|
A0 | input | scaled ac mains voltage biased on 2.5V DC |
A1 | input | scaled ac inverter current biased on 2.5V DC |
A2 | input | scaled ac inverter voltage biased on 2.5V DC |
A3 | input | scaled battery current biased on 2.5V DC |
A4 | input | scaled battery voltage input |
A5 | input | optional analog input, currently used as potmeter control input |
D2 | output | islanding relay (future function) |
D3 | output | AHI control signal to HIP4082 H-bridge driver |
D4 | output | debug output pin |
D6 | input | external reference voltage input of the analog comparator (ZCD). |
D8 | output | inverter enable output (a high=ON) |
D9 | output | PWMB signal to HIP4082 H-bridge driver |
D10 | output | PWMA signal to HIP4082 H-bridge driver |
D7 | input | analog comparator input (AIN1) for zero-cross detection (ZCD) of the grid voltage. The analog comparator input is connected in parallel with A0. |
D11 | output | BHI control signal to HIP4082 H-bridge driver |
D13 | output | Arduino LED (future PLL-locking indicator) |
The use of Timers The standard Arduino library functions like analogRead, analogWrite and digitalWrite are very time consuming and can not be used with the oμiv. The software requirements are:
Different schemes are are now being investigated to fit it all inside the Arduino and are::
Scheme | Description | Remarks |
---|---|---|
scheme-1 | TIM1 generates a PWM-frequency of 16MHz/512/4 = 7812.5Hz (128μs). The 50Hz reference waveform is generated by the DDS algorithm inside the TIM1 ISR. Each TIM1 interrupt the PWM is updated. The ADC-start is triggered by TIM1 and stays synced with TIM1. Six ADC-channels are time-multiplexed. A complete sequence of six channels takes 768us. The closesed whole number of samples that does fit in a 20ms mains cycle is 26.041. This causes a small ripple in the RMS readings. | With scheme, 1 the remaining available processing time in the TIM1 ISR is not enough for implementing power measurements. |
scheme-2 | TIM1 generates a PWM-frequency of 16MHz/(2*1333) = 6000Hz (166.67us). The TIM1 ISR function is empty and only needed to trigger the ADC. All DSP work is done inside the ADC ISR. The 50Hz reference waveform is generated by a DDS algorithm. Each ADC interrupt the PWM is updated and a single analog to digital conversion is processed. Six ADC-channels are time multiplexed. A complete sequence of six channels takes 1ms. Exactly 20 samples do fit in one mains cycle of 20ms. | So far the best scheme. Switching frequency is rather low and the duty-cycle ranges from about 12% to 88%. This is a little too limited and more than needed to keep the HIP-4082 hi-side chargepumps running... |
scheme-3 | TIM1 running at 6kHz triggers the ADC. The PWM is generated with TIM2 at the highest possible frequency. The PWM is not synchronized with the sampling proces and the wave amplitude resolution is only 8-bits. | To be confirmed... |
scheme-4 | ADC is free running and the PWM is generated by TIM1 or TIM2 for respectively 10- or 8-bit amplitude resolution in the output wave. The ADC frequency can not be a multiple of 50Hz and a ripple occurs in the RMS readings. | Scheme 4 doesn´t work. There is too much jitter in the sampling frequency when the ADC is in free running mode to be useful. |
Clocking scheme The implementation for the clocking scheme 2 as selected above, is shown in the following figure:
In this scheme, the zero crossing detector is no longer needed. The phase is detected by using quadrature sampling of the input signal and a CORDIC algorithm for calculating the phase angle relative to the ADC sampling clock. Both, the phase of the grid voltage and the phase of the DDS reference wave (switch to A), or the measured phase of the inverter output voltage (switch to B) are detected. Example sketch Inverter2.ino is with the switch to position A sketch Inverter3.ino is with the switch to position B. The phase offset makes no sense in closed loop with the switch set to position B because the loop compensates for phase offsets. This simplifies the signal generator. The clocking scheme simplifies to the diagram shown below. The idea behind the structure of Inverter2 might be interesting for future applications. For now the development continues with Inverter3...
H-bridge switching mode The following switching schemes have been implemented:
The PowerSys Library Refer to the readme file of the PowerSys Library.
The project's to do list
Connecting the transformer: Both legs of each H-bridge are in-phase, simultaneously switching. Tie M1_A and M1_B together and also tie M2_A and M2_B together. Connect the low voltage winding of the transformer between M1_A (M1_B) and M2_A (M2_B) or with double low voltage windings; connect the low voltage winding-1 between M1_A, M2_A and low voltage winding-2 between M1_B and M2_B. Check the phase of the windings first!
Conclusions:
A lot of time was saved in development time by using the alternative Arduino-IDE Sloeber. Sloeber is a wonderful Arduino plugin for Eclipse.