Taking PWMDIV a step further? More of a good thing.

Dave E

Senior Member
Now that we have PWMDIV4 and PWMDIV16 the question must be asked....
Is there a way to get a PWMDIV 32 or 64 by POKING a SFR?
I know I can reduce the chip frequency but that can complicate matters sometimes.

I have now converted my several solar battery chargers to PWMDIV16 and brought the frequency down to about 490 Hz. The MOSFETS do not get nearly as hot.

Dave E



P.S.
Don't forget boys and girls, at least for very short periods (microseconds), power supplies can deliver many times their rated current. That reminder only cost me slightly toasted fingers.
 

inglewoodpete

Senior Member
PWMDIV4 and PWMDIV16 do the same thing as:
Code:
' 4 second pauses are so that scope can do F measurement
Do
   PWMOut 3, 150, 200              ' set pwm
   Peek $12, b1
   SerTxd ("      Normal: ", #b1, 13, 10)
   Pause 4000
   b1 = b1 + 1                     ' add 1 (bin 1) for TMR2 prescale
   Poke $12, b1
   Peek $12, b1                    ' peek to confirm
   SerTxd ("Prescale / 4: ", #b1, 13, 10)
   Pause 4000                      ' pause 4 s
   b1 = b1 + 1                     ' add 1 (total 2 bin 10)for TMR2 prescale
   Poke $12, b1
   Peek $12, b1                    ' peek to confirm
   SerTxd ("Prescale / 16: ",#b1, 13, 10)
   Pause 4000                      ' pause 4 s
   b1 = b1 - 2                     ' Back to normal (i.e. TMR2 prescale = 1)
   Poke $12, b1
Loop
 

hippy

Ex-Staff (retired)
A inglewoodpete notes the PWMDIV and PWMDIV16 are the same as poking the internal SFR. The division choices of 1, 4 or 16 are set by PICmicro design.

To do PWMDIV32 ... use PWMDIV16 and halve the operating speed with SETFREQ :)

This is a case where using two PICAXE can be an ideal and cost effective solution. The PICAXE can run at whatever speed is best for PWM'ing and be controlled by the master using SEROUT / SERIN. As the PWM is genuinely a background task there won't be any issues with blocking on SERIN. An X1 or X2 slave can use an X1 or X2 and HSERSETUP background receive so there doesn't even need to be much in the way of synchronising master to slave, just don't send too often.
 

Dippy

Moderator
Dave, obv I don't know your circuit, components or requirements, but sometimes hot FETs is due to weedy Gate driving. And sometimes slow switching can 'get around' this.
It MAY be a case for mods to electronics rather than code.
... that's just a thought OTTOMH.
 

Goeytex

Senior Member
Dave, obv I don't know your circuit, components or requirements, but sometimes hot FETs is due to weedy Gate driving. And sometimes slow switching can 'get around' this.
It MAY be a case for mods to electronics rather than code.
... that's just a thought OTTOMH.
This is probably the case.

IF the FET is getting hot at higher PWM frequencies given the same duty cycle then it is most likely due to inadequate drive current.

While FETs are voltage controlled devices, the gate drive circuit must still overcome the gate capacitance of the FET. This take current and time.
The longer it takes for the gate capacitance to charge or discharge the longer the FET is in its transitional area when it switched on or off , the hotter it will get. The more current, the less time in transition..

The lower PWM frequency causes the FET to be in transition less over any given period of time

Many folks assume that because a FET is "Logic Level" that it can switch quickly and efficiently at high speeds when directly gated by a microprocessor , but this is not the case at all. Even Logic level FETs need adequate gate drive current to switch efficiently at high speeds.

A $1 FET driver will probably solve the problem. Check out Microchips
TC1411N FET Driver. These work very well.

Goey
 
Last edited:

BeanieBots

Moderator
Oh, FETs getting hot with PWM.
Doesn't time fly, must be nearly a month since we last had this one. Normally it's every second week.
I vote for slower frequency, cheaper than a driver! (bigger magnetics though)

anyone heard from manie recently?
 

Dippy

Moderator
Haha, yes.
If Goey had been on this Forum for the last couple of years he'd see MOSFET driving cropping more often than the X Factor :)
I only mentioned it tentatively as we don't know the circuit or construction and delicately suggested it as food for thought.

Perhaps MOSFET driving as a Tutorial with nice pictures ....?

All quiet on the manie front - I assume he's busy aligning wheels.
 

BeanieBots

Moderator
@Goeytex,
I nominate you on "FET Driving duty" for the next two months.
Dippy & I need a break! Looks like manie's having his.
 

BeanieBots

Moderator
Reckon I still get more out of the internet than I put in, so yes, I guess you could say I get paid.
The real payment of course is when somebody can get over a little hurdle and get their project working.

We all have to start somewhere and I wouldn't be able to earn the money I do if it wasn't for others who put in the time and patience teaching me.
This is my chance to put a little back (and have some fun on the way).
 

Dave E

Senior Member
Thanks everyone,
It looks like the 08M "PWM driver" is the way to go for lower PWM freqs.

I have a Picaxe driving a 2N7000 which in turn drives the gate on the IRF4905. The output of the 2N7000 changes from 0V to 20V in right at 20uS. I use a 1k ohm resistor from the supply+ to the IRF gate to make sure that there was plenty of I available to turn it off. I started out with 100k but was generating a lot of heat.
Since I converted my charger to PWMDIV16, the cooling fan runs only about half as much as it used to.

Dave E

Here's an afterthought.
Having a PWMDIV64 option would not help much more. With PWMDIV16, the number of off transitions goes from 8000 per second to 500 per. That's a 94% reduction. Using PWMDIV64 would only improve things another 4%.
 
Last edited:

Goeytex

Senior Member
The output of the 2N7000 changes from 0V to 20V in right at 20uS.
If this refers to the turn on time or the rise time then it's not
very good. Before you edited you gave 100 us ... ???

If this refers to to something else , then please explain.

Since you did not post a circuit diagram, I am going to guess that your
circuit is similar to the one I have attached.

In that circuit the main FET dissipates about 295 mw with a 20 volts supply
and a 10 ohm load. This is barely considering the T0-220 package designed
to dissipate 200 watts. ( I assume you are using a heat sink ????)

With a 5 ohm load (4 amps peak) it dissipates 1 watt which is nothing for
your FET. With a 1 ohm load (18 amps) around 20 watts which is normal
and expected but will need a good heat sink.

But once again since we have no information on what the load is and how
much current it draws a .... proper analysis cannot be done ...

In any case ... slowing the PWM to the reduce FET heating is a band-aid to to what appears appears to be an electronics issue.

Goey
 

Attachments

Dippy

Moderator
Dave, if the heating issue is a electronic-related then you really need to look at how a MOSFET driver works.
From what you have said it seems you haven't grasped it.

As Goey has said, a 20uS transition is not good.
You need to drive that MOSFET on/off/on etc. as fast as possible (caveats on noise and ringing etc. accepted).
You need the MOSFET to spend as little time as possible acting as a significant resistor - producing heat.

What you have done is better than direct conenction to PICAXE power pin, BUT using a 1k0 res for the gate 'pull-up' will NOT provide "plenty of I". Don't ignore the charge.

A proper gate driver provides a high-speed and high-current push-pull on the Gate.
You've got to get that charge in and out as rapidly as possible.
And your PCB tracks/traces should be (generally) as short, fat and close as possible.

Think of the gate having a big fat capacitor. A 1k0 resistor will take time to charge it - you do the maths.
A proper driver may use a mere 10 Ohms to charge/discharge that gate with peak currents in the Amps range.
It's a whole league different (and better) than what you are currently (pun) doing.
For reasonable switching efficiency the gate transition times should be well under a microsecond for a medium F PWM.

It would be a really good move for you to read Data Sheets on MOSFET drivers and Manufacturer's Application Notes.
They can explain the complexities and design considerations far better than anyone here.

Anyway, 'nuff said and I'm sure you'll get it sorted :)
 

Dave E

Senior Member
Thanks for the input.

That is the MOSFET circuit I am using except that R3 is 1k.
My scope probe is attached to the gate of the 4905. Voltage drops from +V to zero in a microsecond or so but going from zero to +V (turn off) takes about 20uS.

I was under the impression that 20uS was a fast transition time. I have seen circuits like this where R3 is in the 100k range so I assumed that I had made an improvement. I will reconsider this.

Dave E
 

Dippy

Moderator
What were the circuits for?
If they were for fast gate driving for fast PWM then umm...err...well.
I haven't seen the circuits you have seen, but as a general statement I will say this:
Just because they have been posted doesn't make them good.

Your circuit is pull, and you have a 1K0 to do the push. You need a proper (complimentary style) push-pull with no shoot through.


I'll avoid saying the same things over, so have a look at this App Note to see the basics of a MOSFET driver.
http://www.diodes.com/_files/products_appnote_pdfs/zetex/an18.pdf

Then go to Microchip Home page , and in the search box type in TC44 ... and wait and a long dropdown of MOSFET drivers will appear. Select and read. Look at the schematics if shown and look at the rise/fall times in the spec.
OK you may not get as low as those, but it should tell you that you are orders of magnitude too slow for good switching.

Good luck.
 

Goeytex

Senior Member
Thanks for the input.

I was under the impression that 20uS was a fast transition time. I have seen circuits like this where R3 is in the 100k range so I assumed that I had made an improvement. I will reconsider this.
Dave E
20us is a terrible transition time for repetitive switching. You should be
looking for around 100 -200 nano seconds for your 4095 FET. The 20 us
would be fine for non repetitive switching like turning a lamp on in the
evening and off in the morning. but not for high speed PWM.

You still haven't said what the load current is ... do I have to get out my
teeth pullers ?

While the circuit I attached works OK. It is not ideal. The 2n7002 can sink
about 100ma of current to turn the PFET on ... but it cannot source current
to turn it off. That is done by the pull-up R3. The 4095 FET wants up to 1
amp to overcome its relatively high gate capacitance in a rapid manner.

This is where a totem pole driver excels. It can both sink and source
current at a very high speed.

The attached is what I would use for a circuit if I had to use a PFET.
Otherwise I would be using a NFET with a similar driver.

Note: the TC1411N can take a Vin of up to 16 volts. If your voltage needs
to be higher you will need to find a different driver IC like a TC4432 or similar
offerings from Fairichild, Ixys, TI, and others.

Goey
 

Attachments

Dave E

Senior Member
Thanks Goey, Dippy,
Load current is about 5-6 amps from a solar panel. Open circuit voltage is around 21 V so a different driver would be needed. Just to make sure we are on the same page, the FET is a IRF4905. I appreciate the help. I knew that a shorter transition time was better, just thought 20uS was.

Yea, I know you can't trust everything you see and read on the internet, :eek:, but I was thinking that I have seen several "MOSFET battery charger" circuits and they all were similar. Maybe they were all looking at the same base circuit.

Goey, How are you getting at the 295mW in the circuit shown? And yes, I do have a heatsink/fan combo. After I get this circuit fixed up, I may not need the fan though.:) Also, what did you use to draw your diagram with?

Dave E
 

Goeytex

Senior Member
Goey, How are you getting at the 295mW in the circuit shown? And yes, I do
have a heatsink/fan combo. After I get this circuit fixed up, I may not need the
fan though. Also, what did you use to draw your diagram with?
I used LTSpice Switcher CadIV. It is a free download from Linear Tech.
Then I draw the schematic and run a transient analysis. Next, I capture the
schematic from LTSpice into MS PAINT where I can alter it a bit, convert it to
JPG and post it to the forum.

In order to get the efficiency numbers (watts) you have to add a dummy Linear Tech
device into the schematic capture and then disable it via its shutdown Pin. This
allows you to set the transient analysis to do efficiency calcs.

I have found LTSpice to be an indispensable tool for circuit design and analysis.
It has saved me countless hours of trial and error over the years .

I highly recommend it for anyone who dabbles in electronics circuit design. especially
analog stuff. TI has a similar program called Tina Ti.

If you implement a circuit like the second one I posted you should be able
to toss the fan away and only use a moderate sized heat sink. I have
a device I am working on now where the FET switches 7 - 8 amps at
50 Khz and only uses a copper pad on the PCB for a heat sink and it
barely gets warm. Heat is the enemy !
 
Last edited:

Dave E

Senior Member
Dippy,
I believe that the 4905 was selected from a couple of suggestions for general purpose MOSFET. I picked it because of its 0.02 Rds(on). There are not a lot of P-channel MOSFETS to pick from compared to N-channel. That and I don't think there is a good way to select from among the thousands of FETs out there. There is probably a web site somewhere but I am unaware of it.

Dave E
 

Goeytex

Senior Member
So there is no real reason for having a PFET over an NFET ?

IF that is the case then here is an almost painless way to select an NFET
from the thousands of offerings.

Go to Mouser.com and get to the MOSFET section. then do a parametric
search. Start with filtering only for N-channel and maybe a voltage range.
You can use the Control Key to make multiple selections.

Then filter for Package type type if you want to use the T0-220 or T0 -251.
through hole parts . This will get rid of the SMT stuff.

Now the list will be manageable and you can "sort" by RDSON or Current or
even price.

You can look at a part description and even open up the data sheet right
there. This is how I do it.

Digikey and Newark both have a similar parametric search.


Good luck !
 

Dippy

Moderator
Yes, I do a similar thing.
In UK I use RS Components and Farnell (who own Newark I believe).
And then Digikey and Mouser.

I even have the foot-wide catalogues for them and sometimes find it quicker as parametrics aren't perfect.

And then double-check Retailer data against data sheets - even typists make mistakes:)

But as much as anything, you have to understand the/your design before you can know what parameters to check.
 

BeanieBots

Moderator
As Goeytex states, there really should be no need for a fan at low currents such as 5A - 6A.
Most of the simple chargers I've seen that run from a panel do nothing more than switch off the panel at ~15v and switch it back on again at about 13.8v. (and 15v is not healthy for a Pb battery anyway).
This is very slow switching speed so the gate rise/fall time is of little consequence. If you are trying to use the same drive for PWM, it will end in tears and a lot of wasted power which is not very desirable for solar applications.

I'd love to suggest that you consider the use of a "buck" converter so that you can get even more power from the panel but let's get this sorted first before getting more complex.

To be honest, I don't think the use of PWM is going to do a great deal for you with the setup you have.
Let me turn it around and ask "why are you using PWM"?
 
Top