PWM using DC motor

Thread Starter

sanaamjed

Joined Nov 30, 2008
8
i am using a 24V motor dont know much about the motor(will update when I find out more about the motor).I would like to control the speed of this motor using PWM.I have a fair idea about what I have to use but not too sure about the software side of the project.a help regarding circuit diagram will be much appreciated.Here is my idea,see if its right track,if not please help......
Using 16F877 with line driver from 24V input supply going into a voltage reg(i have an idea which one to use,suggestions appreciated).the output is driven throgh a N-channel MOSFET(please suggest a possible 20A rated MOSFET from RS,i could find one but not from RS).
This is my simple idea,but I would like to ask for suggestions if im on the right track.Also i'd like to gradually ramp the speed of the motor rather than go from 0-highest value,because that would be meaning that the motor will start with a it will clog.any ideas?
 

mik3

Joined Feb 4, 2008
4,843
Use a LM7805 as a voltage regulator for the PIC. You can find MOS in ebay at reasonable prices. Have a look.
 

Thread Starter

sanaamjed

Joined Nov 30, 2008
8
thanks for the replies,it is much appreciated!
I would hoever like to mention that I'd like to control the PWM via a PIC(16F877A).Regarding the PIC can any one help me with the circuit?thnks


Sana
 

mik3

Joined Feb 4, 2008
4,843
You don't need to use such a high pinout PIC. You can use the 16F877 but you have a smaller one use it.
 

mik3

Joined Feb 4, 2008
4,843
Alberto in you diagram you are using a N-channel FET transistor. This type of FET needs a negative voltage with respect to its source to turn off. In your case, not only it won't turn off but it will get destroyed. Replace the FET with a N-channel MOSFET transistor.
 

Thread Starter

sanaamjed

Joined Nov 30, 2008
8
thanks for the suggestions
Alberto-electrolytic capacitor = 1000uF 50 volts
Why have you suggested this value of capacitor?
This capacitor value is not suited for high frequencies so could you explain why you suggest using it?
Thanks!
 

mik3

Joined Feb 4, 2008
4,843
It provides sudden increases in current caused the motor. You are right that is not very suitable for very fast changes in current. To improve this you can put a 100uF capacitor in parallel with it which responds better to high frequencies.
 

Thread Starter

sanaamjed

Joined Nov 30, 2008
8
Thanks mik3!
Just a bit concerned about
using the MOSFET NTE2985 suggested by Alberto because it’s a 18F252 PIC I’m using(finally decided on it because it can use 20 MHz crystal and can have a higher frequency which I need to drive the motor.
Concern about the MOSFET is 1st,I cant seem to find a detailed datasheet of this MOSFET.2ndly,as with MOSFETs, how can I get a MOSFET which can work fairly well in high frequency? Can anyone possibally give calculation either done or suggections on how to calculate the resistor value which comes out of the pin13 of the 18F252?If I use 640ohms as suggested by Alberto ,(which maybe appropriate for 16F877,thnx Alberto!) but when I looket at port C of the pic block diagram, there is complementary MOSFET used which I think if I use 640 value resistor,I will get high power(=I2R).and it will possibly blow the MOSFET NTE2985.Please suggest calculation for the right resistor value and again a MOSFET which can be used for a high frequency.Thanks!
 

jpanhalt

Joined Jan 18, 2008
11,087
Why do you need 20 MHz for just motor control? Most PWM motor controls run at 2KHz to 20KHz or so. I prefer the higher frequency as it produces less audible noise, but neither requires a particularly fast PIC.

In terms of driving the mosfet, typical gate drives produce up to several amps for very brief preiods. The gate resistor is usually there to prevent oscillation, not over drive of the mosfet. In fact, that resistor seemed a bit large, particularly if your are planning on very fast switching. Remember the gate capacitance needs to charge through it. At high frequency, that can lead to a lot of the time spent in the partial conducting zone for the mosfet and a lot of heat.

John

Edit: Here's a nice link to an application note by Microchip. And another that discusses the gate capacitance simply and clearly.
 
Last edited:

mik3

Joined Feb 4, 2008
4,843
A for the choose of the MOS you will need to consider the starting current which is higher than the running current and in case the motor stalls what will be the current through it? The MOS has to be able to handle it unless you sense when the motor is going to stall and switch the MOS off. I suggest you use MOS with a current rating double the current you need as they will last longer.
Also, driving the MOS from the output of the PIC is not a good idea because it won't turn on fast and it will get quite hot (more time in linear region during turn on). You have to use a BJT between the PIC output and the MOS to decrease turn on time.
About the PWM frequency if you are planning to use a range in the MHz region don't do it. It is not necessary and you will have problems with the motors inductance (it will start slower and may get burned). About 50 kHz is enough and it won't be audible.
 
Last edited:

jpanhalt

Joined Jan 18, 2008
11,087
Also, driving the MOS from the output of the PIC is not a good idea because it won't turn on fast and it will get quite hot (more time in linear region during turn on). You have to use a BJT between the PIC output and the MOS to increase turn on time.

I agree on the direct drive issue. I found it difficult to find specific recommendations on the Microchip site with respect to direct driving mosfets. The Microchip forum has a couple of posts recommending something like a 200 ohm gate resistor (i.e., 25 mA at 5V). I am currently doing that with a small P-mosfet and a pull-up resistor for a capacitive load.

Re. bolded: Do you mean increase or decrease turn-on time?

John
 

mik3

Joined Feb 4, 2008
4,843
I agree on the direct drive issue. I found it difficult to find specific recommendations on the Microchip site with respect to direct driving mosfets. The Microchip forum has a couple of posts recommending something like a 200 ohm gate resistor (i.e., 25 mA at 5V). I am currently doing that with a small P-mosfet and a pull-up resistor for a capacitive load.

Re. bolded: Do you mean increase or decrease turn-on time?

John
I meant decrease:)
 

Thread Starter

sanaamjed

Joined Nov 30, 2008
8
well thanx but I have an issue here.If say I was switching 10A @2KHz.What power will the MOSFET be dessipating considering 50percent duty cycle?this calculation may help me find the resitor value as well as the type of MOSFET.coz NTE2985 is not available at RS, and I would like to order on RS.thnx!
 

Thread Starter

sanaamjed

Joined Nov 30, 2008
8
Please someboady reply to my previous post.................THANKS!(copy below)

Just a bit concerned about using the MOSFET NTE2985 suggested by Alberto because it’s a 18F252 PIC I’m using(finally decided on it because it can use 20 MHz crystal and can have a higher frequency which I need to drive the motor.
Concern about the MOSFET is 1st,I cant seem to find a detailed datasheet of this MOSFET.2ndly,as with MOSFETs, how can I get a MOSFET which can work fairly well in high frequency? Can anyone possibally give calculation either done or suggections on how to calculate the resistor value which comes out of the pin13 of the 18F252?If I use 640ohms as suggested by Alberto ,(which maybe appropriate for 16F877,thnx Alberto!) but when I looket at port C of the pic block diagram, there is complementary MOSFET used which I think if I use 640 value resistor,I will get high power(=I2R).and it will possibly blow the MOSFET NTE2985.Please suggest calculation for the right resistor value and again a MOSFET which can be used for a high frequency.Thanks!
 

Thread Starter

sanaamjed

Joined Nov 30, 2008
8
well thanx but I have an issue here.If say I was switching 10A @2KHz.What power will the MOSFET be dessipating considering 50percent duty cycle?this calculation may help me find the resitor value as well as the type of MOSFET.coz NTE2985 is not available at RS, and I would like to order on RS.thnx!

to sgtwookie - its RS Components,
http://uk.rs-online.com/web/
 
Top