PWM motor control ... please correct my design.

Status
Not open for further replies.

orangerobot

New Member
Hi all,

I'm trying to control a 12v variable speed motor using the PWM from a PIC (please see attached sketch). I want the voltage to the motor to vary from 0 to 12v based on the duty of my PWM. Also, I need the voltage to the motor to be constant which is why I included the RC filter. Am I doing this correctly?

Thanks!

-OR
 

Attachments

  • PWMmotorcontrol.jpg
    6.8 KB · Views: 198

No you're not, you're feeding the motor through a 4k7 so it can't possibly work. PWM normally feeds the motor directly, that's the main point of it - why don't you want that?.
 
Normally I would run the motor directly with the PWM but the PIC is only rated for 5v. My end objective is to be able to vary the speed of a 12v motor using the PIC.

I could acheive this without the RC filter using only the MOSFET but I want the voltage to the motor to be constant (not square wave).

Thanks.
 
What type of motor is this? Why not just feed the PWM directly? Its done all the time.
 
orangerobot said:
Normally I would run the motor directly with the PWM but the PIC is only rated for 5v. My end objective is to be able to vary the speed of a 12v motor using the PIC.

You couldn't feed a motor directly from a PIC, 5V or not, it can't provide enough current.

I could acheive this without the RC filter using only the MOSFET but I want the voltage to the motor to be constant (not square wave).

But WHY?, it seems a strange idea - what difference do you think it will make?.

In any case the 'filter' was useless, and not even in the correct place!.
 
Nigel Goodwin said:
You couldn't feed a motor directly from a PIC, 5V or not, it can't provide enough current.
Huh, what are you talking about? You can certainly run a motor using a 5v PWM.


Nigel Goodwin said:
But WHY?, it seems a strange idea - what difference do you think it will make?. In any case the 'filter' was useless, and not even in the correct place!.
Really, there's no need for insults. I am new which you can tell by the 'Electronics Newbie' tag next to my name. Please either offer suggestions to help or refrain from posting here.

-OR
 

What he means is that there isn't enough current from the PIC to drive the motor.

Don't take it personally, I think he meant to help. Either way, you can't put a resistor in series like that. I'd still like to understand why you don't run the PWM directly to the motor sans filter.
 
There is a difference from being able to provide 5V at a very low current and being able to provide 5V at a large amount of current. If you try to draw too much current from something, the output voltage will drop in order to try and provide that much current.

The 5V is sufficient to control the gate of a transistor (which requires very little current that the PIC is able to supply) to switch a larger current on and off (ie. to control a motor). But the a PIC CANNOT supply enough current to run a 5V motor directly.

Your circuit seems to say that you understand this since you do use a MOSFET transistor to control the current to the motor with the PIC driving the gate.

I could acheive this without the RC filter using only the MOSFET but I want the voltage to the motor to be constant (not square wave).
However, the RC filter is useless- the PWM will cause the main motor current to switch on and off BUT (and this is a big thing, the inductance from the motor will smooth out the current waveform and effectively cause the motor to "see" a voltage that is the [PWM % duty cycle x supply voltage]. With the RC filter's resistor you are not doing anything except totally, completely limiting the current that flows through the motor. I can see what you are trying to do- smooth out the PWM'd voltage travelling through the motor, but hopefully this will tell you why you can't and why you don't need it. It is not needed, and is makes your circuit basically useless. The motor's inductance will take care of everything without limiting the current. RC filters are not used for power applications, they are used for signal applications which require much lower current.

orangerobot said:
Normally I would run the motor directly with the PWM but the PIC is only rated for 5v. My end objective is to be able to vary the speed of a 12v motor using the PIC.
Even if both motor and PIC are 5V you still must use a transistor or something to indirectly drive the motor with the PIC. The PIC cannot supply enough current through it's pins.

analog said:
What type of motor is this? Why not just feed the PWM directly? Its done all the time.
Feed the PWM directly? To what? The motor? Won't work, PIC can't supply enough current to drive the motor. (I know you know this, but the words are a bit misleading to someone new). You have to feed it to the transistor gate, which I the opening poster is doing.
 
Last edited:
I'm working on something like this as well (it works). What you have to do is
connect the PWM signal from the pic to the base of a NPN transistor (type depence on your current) connect one side of the motor to the 12 V power line the other side of the motor is connected to the Collector of the transistor.
The Emmitor of the transistor is connected to the ground

Maby you can add some resitors to limit some currents
 
Get rid of the 4k7 resistor and capacitor, read up on ohm's law, then it'll become obvious why your circuit isn't working.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…