24V 3A ampere motor drive using atmega32 pwm

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

I want to drive a PMDC motor whose rating is 24V 3A using atmega32 controller. I found some article they have used IRF540N (MOSFET) to control speed motor  but they used ic555 to control drive mosfet. Can i give the PWM signal directly to the gate of IRF540N or i have to use driver for IRF540N. or anyone will suggest me how to control the speed of motor using atmega32 PWM

Note: i want to rotate motor only one side, i just want to control  motor speed by atmega32 pwm.

Thanks in advance.

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

The IRF540N is not the best choice for your application, however, at 3A it should work. If you look at the graphs for current vs gate voltage, 4-5V is at the minimum. The 555 would most likely be driving the mosfet with >10V on the gate which is what it expects. 

I'd suggest something like a IRL3705Z or similar as these are better suited to being driven by 5V logic levels. Make sure you have a fast diode across the motor otherwise the mosfet probably won't last long. I use a MURS340 diode.

 

For the mega32, choose a 8bit pwm mode with a frequency of around 500Hz. If you use Arduino tools for the mega32, then doing pwm is trivial.

 

Be careful with your wiring - 3A is enough to cause problems if you don't choose the correct size of wire and routing. Current flows in a circle, so ensure the mega32 is not in the motor current loop.

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

I would also add a resistor at about 220R between atmega and mosfet gate. At low frequency it should work as long as gate voltage can turn the mosfet properly on. Reason for the resistor is, that the mosfet gate have a fairly high capacity, giving high inrush current. The resistor protects the atmega. On the other hand, I omitted the resistor in my selfmade home automation, and there has been no faults in more than 5 years. But better safe than sorry.

 

If the mosfet gets hot, you may need a dedicated mosfet driver. Use a scope to see if mosfet on-resistance is too high.

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

Most power MOSFETs need a 10V to 12V pulse on their gate to fully turn on (minimum Ron).

Does your board have such a high voltage, besides the usual 5V?

 

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

Kartman wrote:
I'd suggest something like a IRL3705Z or similar as these are better suited to being driven by 5V logic levels. Make sure you have a fast diode across the motor otherwise the mosfet probably won't last long. I use a MURS340 diode.

Thank you sir for reply,

Using IRL3705Z can i directly connect atmega32 pwm o/p to the mosfet for 5V logic. what will be minimum duty cycle for mosfet to turn ON.

Thank you advance.

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

 

The IRL3705Z (the Z is the critical option - this is the low voltage option). I connect the microcontroller via a 22 Ohm resistor to the gate of the IRL3705Z.

 

mc_coder wrote:
what will be minimum duty cycle for mosfet to turn ON.

 

The mosfet will switch very fast. I doubt this will be an issue. The motor, on the other hand, will require a minimum amount of energy to move. In terms of a duty cycle value, you'll have to determine that experimentally.

 

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

Kartman wrote:
The mosfet will switch very fast
 

Is snubber circuit is required for mosfet or not?

 

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

A snubber is required - this is the diode i mentioned.

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

A few tips:

 

Depending on your needs, you may want a gate driver, like the fan3100...This can greatly improve your efficiency at higher PWM freqs. If efficiency is not a concern & you stay at low freqs, then a simple resistor is prob ok.  However, I prefer to  PWM at higher freqs & tend to use one of the PLL-type chips like an tiny261...then I can get 15-20KHz PWM (which requires a gate driver).  

 

For reasonable currents & a strong fet, you typically don't need the recirculating diode, since the fet has a zener built in.  Avalanche-rated fets are made for this purpose, though most FETs work fine if they hare not pressed near their limit.  The FET diode has a high breakdown voltage which allow valves coils & such to deenergize more quickly than using a parallel diode (some folks use a zener-schottky series diode combo for the same effect).   You DO need to use care here & it is often easier to just throw in the parallel diode.  

 

A different approach uses a zener to reactivate the gate (upon the high voltage spiking) to "quench it"...so Motorola/ON semi mosfets have this built in.:  https://www.onsemi.com/pub/Collateral/AND8202-D.PDF

 

Regardless of what you use, be sure to put a 12V zener from gate to gnd to protect the FET gate from ESD.  Of course, some fets include that too. 

https://toshiba.semicon-storage.com/us/design-support/faq/mosfet/is-it-ok-to-use-the-body-diode-parasitic-diode-between-the-drain.html

http://www.vishay.com/docs/90160/an1005.pdf

https://www.onsemi.com/pub/Collateral/AND8202-D.PDF

https://www.nxp.com/docs/en/user-guide/MOSFET-Application-Handbook.pdf

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

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

Kartman wrote:
I connect the microcontroller via a 22 Ohm resistor to the gate of the IRL3705Z.

Sir please can you explain me about gate resistor calculation, how did you come to 22 ohms resistor and effect of gate resistor.

Thank you in advance sir. 

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

Infineon/international rectifier have a wealth of information. 22R is a common value for a ‘gate stopper’.

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

Kartman wrote:
22R is a common value for a ‘gate stopper

i am new in this field. Can you explain selection of resistor this with an example please.next time i will be capable to calculate gate resistor at least. 

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

Kartman wrote:
22R

If i will put 22ohms between gate of mosfet and atmega32 then atmega32 high voltage 5V/22Ohms = 222.2mA current will flow.

but atmega32 max current source is 20mA. will atmega32 will get damaged or not. Please explain.

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

No, it won't be damaged.

Now, you have to find out why this is the case from the datasheets of ATmega32 (electrical characteristics) and MOSFET in general (concerning the gate input impedance).

 

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

You could use NO resistor & the fet will drive on/off fine, at least at low freqs.  However,  adding some resistance has several desirable effects--which you'll soon see.  The value is not too critical,, it could be 10 ohms 50 ohms or,  if low freq, 1000 ohms (not so good for high freq pwm).  Also look at EMC generation as well.

 

 

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

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

why at low frequency and what will be gate current with and without resistor flowing from atmega32 to gate of mosfet?

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

Did you not learn about mosfets?  If you plan to use, at least know something about them!

Static gate current is essentially zero, at room temp.  Dynamic (switching) is much higher (due to capacitances), depending on how fast you want to transition (switch) states---ns, us, ms, you choose.   Conversely, the limited pin drive capacity essentially limits the max transition speed you can get without using a driver chip.  Slow transitions, therefore, also limit the max PWM frequency. Slow switching transitions produces heat, fast switching transitions produces EMI (RF noise).

If leads are long, then there is also lead inductance effects, at high currents.

You will use enhancement fets.

https://www.electronics-tutorials.ws/transistor/tran_6.html

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

Last Edited: Sat. Dec 14, 2019 - 08:23 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Can someone suggest me how to select mosfet driver. I am using mosfet IRF540n.

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

You have still neglected to say what your PWM freq is...200 Hz?  5 KHz? 25 KHz?

Note the IRF540 almost requires a gate driver, since it potentially has a large threshold voltage.  Usually if the Vgs max is 20V, you will encounter this.

 

Fets with 15V or 10V max Vgs, typically have a corresponding lower gate threshold & better suited for 5v logic

 

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

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

If you are constrained on your selection of mosfet, does this constrain your selection of mosfet driver? Depending on what pwm frequency you choose, helps to determine what driver. For low frequencies, something like a 40106 with a number of the buffers in parallel, a handful of transistors or l293. For higher frequencies, something like a tc4426.
Personally I’d just choose a suitable mosfet - much simpler.

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

I am new l have lots of question.
1) I read various article and I know I increase frequency then I required more gate current and for more gate current I required driver.
2) but I don't what is optimum for more mosfet.
3) how to calculate switching frequency for mosfet.
4) how to calculate required gate current for mosfet.
5) How to select gate driver.
6) Calculation for Gate resistor value
Can someone please give a suggestion for above question I want to learn all things I don't want stuck.

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

We've given links in #9 and #13. Why have these not addressed your questions? The last link in #9 is a pretty thorough treatment of just about all you need to know about mosfets.

 

Note - you don't so much 'calculate' the switching frequency - this is a tradeoff based on a number of constraints - the first would be the device generating the pwm. For simple motor speed control, I use 500Hz (Arduino). That seems to work adequately. I chose a mosfet that would work with 5V logic levels for the gate. The 22 Ohm gate stopper is a generic value. Since I'm not doing anything particularly critical, not too much thought has to be put into selection. If the application has high switching spped, high voltages and high currents, then you need to be more careful with the design.

 

I purchased a cheap motor speed controller recently and it used a NE555 to generate the pwm and drive the mosfet. It used a irf540 mosfet.

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

Kartman wrote:
22 Ohm

rating of resistor????

 

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

0.25W is more than adequate. In surface mount i use a 0603 size resistor.

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

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

mc_coder wrote:

Is it correct caculation for power loss . If it is correct means i dont need any heat sink for mosfet. If it is wrong or i miss calculated then please correct me.

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

We can see the conduction loss is the significant value. How did you calculate the temperature rise? At a guess, the C/W value of a TO220 package is probably around 70C/W, so this means the mosfet will be around 30C over ambient. So you need to consider your worst case ambient temperature, add 30C then determine if this value is still within the specification for the mosfet (Tj max?). As well, parameters change with temperature, so you need to verify that parameters like gate threshold, RdsOn etc are still acceptable at this temperature. If they are, then you're home free, otherwise you probably need a heatsink.

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

You should try using a spreadsheet---will be much handier as you try different Rds, currents, frequencies, etc.

At 3 amps, your worries will be small if you have a low Rds...even a rather sad 0.1 ohm fet is less than 1 static watt loss, dynamic (switching) is  higher.

A 20 milliohm part, will be 5x less heating

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!