Basic Inverter Voltage regulation

Irving

Joined Jan 30, 2016
3,897
@abdullah8391 Your circuit needs 2 x 2n2222 for each MOSFET to retain the polarity of the drive. Inverting the PWM won't generate the right current in the transformer....

@Ian0 I can see what you intended but it still inverts the drive. You need a PNP transistor to turn the MOSFET on (Gate high) when gpio is High.

1618400666330.png
 

Ian0

Joined Aug 7, 2020
9,847
@abdullah8391 Your circuit needs 2 x 2n2222 for each MOSFET to retain the polarity of the drive. Inverting the PWM won't generate the right current in the transformer....

@Ian0 I can see what you intended but it still inverts the drive. You need a PNP transistor to turn the MOSFET on (Gate high) when gpio is High.

View attachment 235330
I hadn't intended to un-invert the drive - I assumed it could be done in software. Now you've only got 1k pull-down and transistors going into saturation, which isn't going to bode well for the switch-off times.
If the output is meant to be a sinewave, the PWM needs to be at a much higher frequency.
 

Irving

Joined Jan 30, 2016
3,897
I hadn't intended to un-invert the drive - I assumed it could be done in software.
Ah, right, yes of course it can be done in software but there's one good reason not to. When the MCU powers up the gpio are HI-z, then when the outputs are configured they default to 0. In your circuit that means the MOSFETs are switched on, both of them. This won't bode well... Yes it can be overcome with extra hardware or more sophisticated programming but it loses the simplicity of knowing the MOSFETs are off until you want them switched on.

Now you've only got 1k pull-down and transistors going into saturation, which isn't going to bode well for the switch-off times.
Yes, it wasn't necessarily a final design, I put in values to make the simulation work. Having said that, the switching times aren't too bad; ideally I'd prefer a totem pole gate drive, but that adds another transistor into the mix.
If the output is meant to be a sinewave, the PWM needs to be at a much higher frequency.
Agreed, the Arduino could run it 10x faster, but ultimately its the wrong tool for the job!
 

Ian0

Joined Aug 7, 2020
9,847
When the MCU powers up the gpio are HI-z,
Good point - I wasn't sure of the Arduino's state on power-up.
I'm usually working with the NXP LPC micros, which power up with their GPIO as inputs with the pullups switched on. That tends to provide just about enough current to switch on a bipolar transistor, and will always switch on a small MOSFET.
 
Top