PWM problems with P-Channel mosfet

Go To Last Post
9 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hey guys, I'm having some problems that I hope one of you can easily fix.

Here's the deal - I'm trying to drive 4 different resistive loads (similar to heating elements) with the PWM outputs of an AVRtiny45. I'm essentially trying to use PWM to modulate the power delivered to the loads. The resistive loads each require up to 500mA of current. They are roughly 10 ohms each, though they can vary slightly. Since the tiny45 can't drive this much current, I'm trying to use P-Channel MOSFETs to switch the current on and off. I'm using P Channel instead of N Channel because I figured it's safer to connect my load to the ground side of things (?).

The problem is, when I turn on the PWM outputs, the AVRtiny45 chip resets.

To make things worse, everything works fine when I remove my resistive loads and instead use LEDS in series with 470ohm resistors. The LEDs dim and get brighter and work just fine, but the load resistance is much higher than my original load.

I'm assuming it all comes down to me trying to power everything from the same 5V power supply - the AVR, the resistive loads, everything. This is the preferred scheme in my application. I only want 1 power line.

I'll try to attach a schematic. What could be causing the chip reset when driving the "high" current PWM?

Other important info:
-P Channel MOSFET is FQPF7P06
-PWM freq is 244Hz
-AVRtiny45 is running off internal 8Mhz Oscillator
-RESET pin is disabled and used as IO instead
-VCC comes from the output of a 7805 chip, which is powered from 9V
-The PWM outputs are changed by I2C communication to the tiny45

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I've just verified the problem still exists (chip reset up PWM output) with an N-Channel mosfet as well (FQP4N20L).

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Is this wired on a PCB? If so poor pcb tracking could be causing voltage drop on VCC when under the higher loads. Your schematic is lacking capacitors - do you have any in your circuit?

This can't be too hard to figure out. I would probably use N channel fets for this application as they will do the same job and might be easier to get / cheaper.

oddbudman

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Put a scope on your +5V line and measure it right at the AVR supply pins with a scope. Sounds like a power supply issue to me. You don't have a single capacitor drawn in your schematic - you ought to add decoupling to your AVR supply pins.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
The resistive loads each require up to 500mA of current.
x 4??? And you are trying to run it from a 1A (at the very best) regulated supply??
:shock:
What happens to the 9V under load?

John Samperi

Ampertronics Pty. Ltd.

https://www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

While it's bad practice to not put a 100nF capacitor over the controllers power supply pins, a stand alone controller might work without. However, pulling large currents from the supply rail will seriously drop your supply rail to the point where the controller won't take it anymore and reset.
Besides that, as John said, you can't drive all of them at the same time if you're using a 7805 regulator. You didn't mention whether that was necessary.

First add 100nF across the controllers power pins.
If you have a scope, have a look at the 5V rails and see how far it drops when switching on the load. Then add a big electrolytic capacitor to the supply rails and see how that solves the voltage drop. Start with 1000uF and add more if necessary.

There migh also be a nasty way to solve this if you don't have big capacitors at hand. Make the resistors at the gate so big, that it will take relatively long to charge the gate capacitance. You might have to make the PWM even slower and the mosfets will get warmer.
I'd still throw some caps at it, but they don't need to be that big anymore.

Good luck,
Igor

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi richara:

For me the problem arises from two things:

a) You are sharing the uC VCC with the load's VCC.
For a frequency of 244 Hz the overcurrent protection of 7805 (2A at the resultant vi-vo differential) becomes active in a "cycle by cycle" basis, effectively lowering the Vcc rail, and you have a POR reset (assuming you fused the tiny45 with the right fuse setup). Notice that these Ilim value is taken from an old Natsemi datasheet. These data isn't generally characterized for cheap regulators like the 7805 and may vary widely (onsemi's 78XX are characterised for 6 points, and at Vi values, not differentials).

b) I don't know if you have capacitors in your power supply side (which doesn't appear in the schematics you supplied) but they are necessary. Also it's necessary to add decoupling capacitors to the Vcc pin in the AVR.

Suggestions:

In this case, and using a 7805 I'd use a 10X6.3 standard tantalum plus a Y5V dielectric 100nF in parallel, near the AVR. For the controller regulator output use a 10X50 electrolytic.
Use a star topology to wire the power supply, and use separated Vcc rails for the controller and for the resistances (a 7805 for the controller and a 78T05 for the resistances, or a transistor-zener regulator for the resistances.) Both regulators must be star wired to the unregulated input with wide pcb traces. Use a 2200X16V bulk filter capacitor on the PS rectifier output.

Nachus

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks for the replies

I think the problem was not enough capacitance on the power lines. I had already included some capacitors (not shown), but they were relatively small (10uF, .1uF). I added a 220uF across the input power, and another 220uF near the avrtiny45 and things seem to have cleared.

No, I wont be running more than 2 loads at once (1A max draw), and I realize now that I need a better voltage regulator. I incorrectly thought the LM7805ACT would supply up to 3A, as stated on Mouser's site - whoops. Shame on me for not reading the datasheet close enough. Regardless, i havent done a full test at 1A yet, and have even bypassed the 7805 chip for the time being.

Is there any benefit to using P-Channel over N-channel? I thought it would be better to have the loads on the grounded side of things, is that wrong?

Thanks for your help!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I guess we would normally run the heavy loads off the "raw" supply rather than the regulated supply. Why stress the regulator? Why live with the regulator losses--they will be considerable. (In fact with a linear regulator I'd wager that this old bit-pusher would lose a bit of skin checking out the regulator case temperature.)

There would perhaps be some variation in raw supply, and as you are pin-constrained you can't do the "normal" method of measuring the raw. Maybe it doesn't matter in your app if there is a closed-loop somewhere that calls for more or less heat.

Lee

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.