Basic functionality of an H-Bridge Inverter (12V DC --> 230V AC)
- Microcontroller (Raspi Pico) generates a sine PWM as a control signal
- Sine PWM goes into a gate driver (Bootstrap)
- Bootstrap (one for each side) controls H-Bridge MOSFETs --> sine_wave AC
Fig.1 - Simple H-Bridge
- based on sPWM_Basic/sPWM_Basic.ino
Fig.3 - Sine PWM Output
- source of high side MOSFET floats between V_AC (here: 12V AC) --> V_GS at the high side MOSFET must be high enough to safely switch on/off the MOSFET
- if low side MOSFET on, Bootstrap capacitor is chraged up to V_DC (here: 12V DC, voltage drop over bootstrap diode negligible)
- if high side MOSFET is switched on, the capacitor delivers its voltage to the control pin of the high side MOSFET
Fig.4 - Bootstrap CIrcuit
- Infineon IR2104 was used
- Dimensioning based on TI Application Note
- MOSFETs: IRFB7537
-
$Q_G = 210nC$ from Data Sheet MOSFET -
$I_{HBS} = 50 \mu A$ from Data Sheet Gate Driver -
$D_{max} = 1$ (will be slightly lower beacause of 520ns Dead time, 100% assumed for conservative caluclation) -
$f_{sw} = 10kHz$ -
$I_ {HB} = 55 \mu A$ from Data Sheet Gate Driver
-
$V_ {DD} = V_{DC} = 12V$ -
$V_ {DH} = 1V $ from Data Sheet 1N4148
-
$V_{HBL} = 9.8V$ from Data Sheet Gate Driver
-
$V_{DD} = V_{DC} = 12V$ -
$V_{Boot,Diode} = V_ {DH} = 1V $ from Data Sheet 1N4148
-
I_{peak} = I_{FSM} = 2A from Data Sheet 1N4148
$V_{Gate} = V_{DC} = 12V$ - $I_{o+} >= 130mA $ from Data Sheet Gate Driver
$V_{Gate} = V_{DC} = 12V$ - $I_{o+} >= 270mA $ from Data Sheet Gate Driver
- second order passive lowpass filter (LC filter)
- Cutoff frequency
$f_g = \frac{1}{2 \pi \cdot \sqrt{LC}}$ (see ElectronicBase.net) - Cap chosen based on availabilty in store:
$C_{Filter} = 10 \mu F$ (use film cap, not a polarized one) -
$L_{Filter} = 100mH$ -->$f_g = 159.2Hz$
The higher the resolution of the sine PWM (pwm_periods & scaler, see code) the clearer the sine wave output gets. Since the performance of the C code is better than the Micropython code (see below), the sine wave from the C code has less ripples. The amplitude is relatively low at the moment since there is no output voltage regulation yet.
Fig.5 -Resulting Sine Wave with Micropython CodeFig.6 -Resulting Sine Wave with C Code
Disclaimer: I know Micropython is not made for high performance applications, but rather for rapid prototyping and easy debugging. I still wanted to see how far I can get with Micropython and compare it to C. Also the C code can become much faster by shorten the timer callback, using bit operations and more. I am looking forward to any improvement suggestions :)
Language | Code Version |
|
|
|
---|---|---|---|---|
MicroPython | 26/12/2024 | 50 | 50 | 5 |
MicroPython | 26/12/2024 | 100 | 100 | 10 |
MicroPython | 26/12/2024 | 500 | 105.3 | 10.5 |
C | 02/01/2025 | 50 | 50 | 5 |
C | 02/01/2025 | 100 | 100 | 10 |
C | 02/01/2025 | 500 | 444.4 | 44.4 |
- shorten timer callback
- add output voltage regulation
- (if inductive load: add external flyback diodes in parallel to MOSFETs)