Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

PWM for push-pull

Status
Not open for further replies.

4AVR

New Member
Hi all,
I am trying to construct a circuit with ATmega88. At first, I used SG3525 for a 30-kHz inverter with comparators and opamps for sensing battery voltage, overload and different conditions. Now I want to do this with ATmega88. I can do all the sensing with ADC, that's no problem. My problem is how can I generate two PWM signals like the SG3525. They are not be inverted of each other but symmetrical, like in the SG3525 so that I can drive two MOSFETs in push-pull configuration, such that there won't be core saturation.
Is there any way to achieve this using the present PWM modules?
I tried, but failed. Say, I have 10microsecond period. If I set duty cycle at 30%, I have 3us on and 7us off on one pin, but on the other, 3us off and 7us on. Instead, I want it like on first pin 3us on then 2us off and then 5us off during which time on the other pin, firstly the whole 5us off, then 3us on, and then 2us off.
I hope I could make the problem clear.
Thanks in advance.
4AVR!
 
Have a look at phase-correct PWM. In this mode, the counter counts up and then down continuously (instead of wrapping around as in fast pwm mode). While the count is towards the top, OCxA is high. While the count is towards the bottom, OCxB is high. The time that one outputs are off will be equal for the up count and fo the down count (provided the sum of the 2 output duty cycles is <100%)
 
Hi dougy83,
Thanks for the suggestion. I tried that, but I could not use it for two channels, like I said, for push-pull. If it is possible, an example would help.
4AVR!
 
Try the following timer initialisation code and see how you go
Code:
// Timer/Counter 0 initialization
// Clock source: System Clock
// Clock value: 8000.000 kHz
// Mode: Phase correct PWM top=FFh
// OC0A output: Non-Inverted PWM
// OC0B output: Non-Inverted PWM
TCCR0A=0xA1;
TCCR0B=0x01;
TCNT0=0x00;
OCR0A=0x40;
OCR0B=0xC0;
OC0A and OC0B are the 2 outputs to check
 
Last edited:
Glad to hear that.

The section in the datasheet explains it pretty well; though I must admit the first time I saw 'phase correct PWM' I thought it was useless and a waste of time.
 
Hi dougy83,
There's a problem.
I used an NPN transistor to step the 5v logic upto 12v to drive MOSFETs. The pulses appear to look fine on the oscilloscope but when I connect them to MOSFETs and ferrite transformer, the 12v power supply turns off, indicating a short circuit, whereas if I drive the FETs from SG3525, it all works fine. This means that the ferrite core is entering saturation mode. Any way out of this???
The changes made to the code were:
I made OC0B inverted and OC0A non-inverted. I changed OCR0A to 104 and OCR0B to 152, to change the duty cycle.
Thanks.
4AVR!
 
Would you mind posting an image from your CRO showing the gate voltages?
 
Hi,
Sorry, my CRO is analog and I don't own a camera, but I'll try to give a rough diagram by drawing it myself, if that helps.
Any idea why my core may be saturating?
Thanks for all the help.
4AVR!
 
Any idea why my core may be saturating?
If the waveforms from the AVR are the same as sg3525, then the saturation should be no different. I can only assume that the waveforms are different. Perhaps both transistors are on at the same time?
 
There's a problem.
I used an NPN transistor to step the 5v logic upto 12v to drive MOSFETs.
You've probably got a very long rise time on the gates. You should be using a proper low side driver chip/circuit. A single NPN and pullup resistor isn't going to cut it.
Did you invert the PWM from the AVR to compensate for the inversion from the NPN transistors? If not, the turn-on times are most likely overlapping so that both FETs are briefly on at the same time.
EDIT: Post the gate waveforms from the CRO while in dual channel mode.
 
Last edited:
Hi,
I inverted the PWM from AVR to compensate for the inversion from NPN transistors.
I don't think the transistors are overlapping as I can see quite an evident deadtime.
Which low-side chip do you suggest? Is it not possible with transistors, as the only gate drivers I have in hand are IR2110, IR2113, IR2117 and IR2118.
And yes, I do notice a large on-time but no overlapping.
Thanks.
4AVR!
 
It is possible with maybe 3-4 transistors per FET, but the transistors must drive the gate with a low impedance push-pull output capable of 0.5 amp or more depending on speed. Hence the development of lowside drive chips. You could possibly use the IR2117-8 as a low side driver, but it would be a bit of a waste.
 
Last edited:
Hi,
Thanks. I'll give it a try.
But, did anyone of you try to implement push-pull PWM on ground with ferrite transformer and output load?
 
Hi all,
Thanks for the help. I finally did it using IR2113. It works.
But there is a slight problem. I tested it with an ATX power supply (12v output used). When I run the circuit, I can hear tremendous amount of "sound" (noise) coming from the power supply as well as the mains line, whereas this problem does not exist when I drive using SG3525. Any idea why this happens?
Besides this, everything is fine.

4AVR!
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top