CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

How to control speed of DC motor. ??

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
arun2
Guest







How to control speed of DC motor. ??
PostPosted: Sun Jan 23, 2005 11:05 pm     Reply with quote

Hi,

Target: CCS C PCM compiler
MCU : PIC 16F628,16F877

How can I control the speed of a DC motor using a PIC ???.

Does this use PWM ??

thanks
arun
Ttelmah
Guest







Re: How to control speed of DC motor. ??
PostPosted: Mon Jan 24, 2005 5:04 am     Reply with quote

arun2 wrote:
Hi,

Target: CCS C PCM compiler
MCU : PIC 16F628,16F877

How can I control the speed of a DC motor using a PIC ???.

Does this use PWM ??

thanks
arun

This is one of the most efficient ways.
There are a number of possibilities.
First you could drive a DAC chip, take the voltage from this, and feed it to a power amplifier, and use this to control speed.
The second would be to use the PWM as a DAC (using a resistor and capacitor to integrate the pulse width), and then have a similar amplifier and control.
However these suffer from the fact that the output amplifier needs to dissipate a lot of heat.
The third option is to directly drive the motor from the PWM output (with a power FET, to give the required drive current). The big advantage of this, is that the FET is only ever switched on, or off, and spends relatively little time in the intermediate state, and as such ends up generating less heat, also applying full voltage for a short time, gives better torque, when moving slowly.
The 'caveats', are that you must be very careful with trapping 'overshoot', flyback, and snubbing round the FET. The motor is a very inductive load, and large voltages can be induced when switching this. The internal 'diode' effect inside a normal MOSFET, may not be enough to reliably protect the transistor from the reverse voltage. Ideally using a properly designed motor driver IC (which will usually slow the rate of attack for the edges as well, to reduce RFI), and following the manufacturers design spec for this, can be a good idea.
Basically set up the PWM for a high enough frequency (remember anything under perhaps 4kHz, may lead to the motor audiably buzzing), and vary the duty cycle to vary the speed.
Have a look at some of the MicroChip application notes. There are a group for motor control, and if you look for the ones for 'brushed motors', there are about 8 sheets there. A couple are for DC servo motors, and except for the added complexity that these implement 'sensing' of the motor position to actually control the power being applied, the hardware for controlling the motor, and the way the speed is changed, directly applies. AN893 (except for implementing bidirectional movement, which you don't say if you want), really shows exactly how the hardware needs to be arranged, and gives details of how to do this.

Best Wishes
Sherpa Doug
Guest







PostPosted: Mon Jan 24, 2005 7:40 am     Reply with quote

I might add that all of the methods mentioned by Ttelmah work equally well with most any processor, not just PICs. The PWM used for driving motors is slow enough for general purpose processors to "bit-bash" the signal without dedicated PWM hardware.
Therefor you shouldn't restrict you search for information just to PIC processors. Almost any processor familly will have information on driving motors this way. It is really more of an analog problem (voltage spikes, heating, eddy currents) than a digital one.
Guest








Re: How to control speed of DC motor. ??
PostPosted: Mon Jan 24, 2005 5:29 pm     Reply with quote

arun2 wrote:
Hi,

Target: CCS C PCM compiler
MCU : PIC 16F628,16F877

How can I control the speed of a DC motor using a PIC ???.

Does this use PWM ??

thanks
arun


Complete project including code, schematics, and PCB files.

http://hans-w.com/speed_control.htm
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group