PWM for DC motors

Discussion in 'General Electronics Chat' started by Dritech, Jan 3, 2014.

  1. Dritech

    Thread Starter Well-Known Member

    Sep 21, 2011
    756
    5
    Hi all,

    I want to control 2 DC motors (not at the same time) using the PIC18f PWM module. The two motors are:

    http://www.gimsonrobotics.co.uk/GLA-S_linear_actuator.html

    http://www.ebay.com/itm/GW31ZY-12V-...aterpillar-drive-Stepping-Motor-/400569511394

    I decided to use a PWM frequency of 20KHz. This way I will eliminating any jerks and at the same time eliminating any humming noise.

    Is this a good choice? Also, I read that the higher the frequency gets, the lower the torque will be. Is this true?

    Any help will be appreciated.

    Thanks in advance.
     
  2. MaxHeadRoom

    Expert

    Jul 18, 2013
    10,507
    2,367
    The second motor appears to be a stepper motor?
    IMO, you don't need to go as high as 20khz to avoid any switching noise?
    Max.
     
  3. KMoffett

    AAC Fanatic!

    Dec 19, 2007
    2,574
    230
    Though it's labeled as a "stepping" motor, its listed spec's look like a DC motor and only shows two wires from the motor. I'd guess it was mis-labled.

    Ken
     
  4. tshuck

    Well-Known Member

    Oct 18, 2012
    3,531
    675
    The listing does say that, but the picture only shows 2 wires...I've learned that most people on Ebay don't know what they are talking about when they write their item descriptions. Dritech, how many wires have we got on the back?
    Most people can't hear anywhere near that high frequency, but it is a safe bet that no one can hear above it.

    More important are the characteristics of your motor drivers.
     
  5. Dritech

    Thread Starter Well-Known Member

    Sep 21, 2011
    756
    5
    Hi,

    Thanks for the replies. No the second motor is a normal brushed DC motor. I don't know why it is labeled as stepping motor.

    So is there any drawback in increasing the PWM at 20KHz? Will I see a decrease in torque?

    As an H-bridge drive I am going to use 2pcs BTN7970. The datasheet of this driver states that the maximum PWM capability is up to 25KHz, so that is suppose to work fine with a 20KHz PWM.
     
    Last edited: Jan 3, 2014
  6. Dritech

    Thread Starter Well-Known Member

    Sep 21, 2011
    756
    5
    Also, what is the Prescaler in PWM? Apparently with the PIC18f one can set the Prescaler to either 1, 4 or 16, but I am not sure what is its function.
     
  7. w2aew

    Member

    Jan 3, 2012
    219
    64
    The biggest downside of using higher frequencies for PWM control is that the switching looses will be higher, thus wasting power that would normally be used to drive the motor. It's probably best to experiment with the actual motors in the application. Choose a frequency that is high enough to minimize audible noise. There's generally no benefit going any higher in frequency than that.
     
  8. MaxHeadRoom

    Expert

    Jul 18, 2013
    10,507
    2,367
    The prescaler works as it does with any of the timers, and scales the PWM period of the clock used.
    The 18F manual for your Pic will detail it.
    Max.
     
  9. Dritech

    Thread Starter Well-Known Member

    Sep 21, 2011
    756
    5

    Hi,

    I did read the PIC18f datasheet but still I cannot fully understand the use for a prescaler. Lets assume that I use a prescaler of 1 and then change it to 16. What difference will I see?
     
  10. MaxHeadRoom

    Expert

    Jul 18, 2013
    10,507
    2,367
    A prescaler of 1 uses the actual freq of the osc or timer used to produce the PWM freq, a post scaler of 16 will divide that frequency by 16.
    If you look up the PWM section of the manual, it should show the exact formula to calculate the PWM period, the formula includes the prescale value.
    Max.
     
  11. Dritech

    Thread Starter Well-Known Member

    Sep 21, 2011
    756
    5
    Thanks MaxHeadRoom.

    I managed to configure all settings, except bits CCP1M3:CCP1M0 of register CCP1CON. I am using the PWM in a single output configuration so I cannot really understand how to set the pins as active-low or active-high. What difference does this make?

     
  12. MaxHeadRoom

    Expert

    Jul 18, 2013
    10,507
    2,367
    I have never had to configure those registers, but the way I interpret it is that the four configurable PWM outputs can be active high or low, low when signal content=0 or high when signal content=0.
    IOW the ability to simply invert the normal PWM signal.
    This is the way I read it.
    Max.
     
    Dritech likes this.
Loading...