# Controlling electric motor

#### bertus

Joined Apr 5, 2008
19,944

#### PRS

Joined Aug 24, 2008
989
I know of 2 ways to control the speed of a dc motor. The first makes use of the fact that the speed is directly proportional to the voltage applied across its power terminals. Speed = kV Where k is more complicated than you care to puruse, I think. But notice increasing V increases the speed.

Thus you vary the DC voltage feeding the motor and you vary its speed. Furthermore, you can change the direction of rotation by changing the polarity (+/-) of the terminals providing the dc voltage.

Here's the problem with that: To vary the voltage in a straightforward manner you use voltage division. In other words you use a variable resistor or switch between discreet voltages (speeds) with pairs of resistors, but in doing so you waste energy in the form of heat just to reduce the voltage! No good! Yes, you can do it this way, but why pay more for something than its worth?

Pulse Width Modulation is done via a pulse generator which switches an H-bridge motor control on and off. MOSFETS are very popular in making both the switch and the H bridge in that they don't require current-limiting resistors.

So, you use the PWM method. Here, you send the DC voltage to the motor by way of pulses of DC voltage and to speed the motor you give it pulses that last a longer time, and to slow it you give it pulses of DC that are shorter in time. Though this method is more sophisticated (and confusing) it is more efficient as you don't waste power via voltage division resistors.

#### Tobias

Joined May 19, 2008
158
Thanks, I will go the PWM route. I have some MOSFETS on hand. The 'Source' pin will have 24v, the 'Gate' will connect to my PIC chip and the 'Drain' will go to the motor. It the duty cycle of the PWM is 50%, the voltage that operates the motor is in essence 12v? 25% duty cycle 6V? Do I need an RC circuit between the MOSFET and motor?
Thanks
Toby

#### Attachments

• 775.4 KB Views: 9

#### jpanhalt

Joined Jan 18, 2008
7,697
I don't think a PIC MCU will be able to get the gate voltage high enough to turn the P-channel mosfet off.

You might consider a logic-level, N-channel mosfet with the source to ground, the drain your motor, and the other motor terminal to your 24V.

John