0

I'm driving a 24V motor like this using this motor driver connected to a RPi B+. I'm controlling it with Python and PWM with the following snippet:

import RPi.GPIO as GPIO
from time import sleep

GPIO.setmode(GPIO.BCM)
GPIO.setup(17, GPIO.OUT)
GPIO.setup(27, GPIO.OUT)

p = GPIO.PWM(17, 50)
GPIO.output(27, GPIO.HIGH)
# Forward
p.start(10)
sleep(3)
p.ChangeDutyCycle(30)
sleep(3)
p.ChangeDutyCycle(100)

# Backward
GPIO.output(27,GPIO.LOW)
sleep(3)
p.ChangeDutyCycle(30)

input('Press return to stop:')
p.stop()
GPIO.cleanup()

The motor spins but produces a lot of vibrations so I'm not sure I'm doing it the right way. I tried to increase PWM frequency until 10 KHz and vibrations seems to reduce but I'm afraid this can damage the motor. Can you suggest me the right values to use for the given motor?

closed as off-topic by joan, techraf, Milliways, Steve Robillard, Jacobm001 Feb 26 '18 at 3:08

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question does not appear to be specific to the Raspberry Pi within the scope defined in the help center." – joan, techraf, Milliways, Steve Robillard, Jacobm001
If this question can be reworded to fit the rules in the help center, please edit the question.

  • No we can't. I doubt anyone can. You need to ask on an electrical engineering site and give details of your motor and motor driver board and possibly the type of PWM you are using. – joan Feb 8 '18 at 10:19
  • Hmmm... Vibrations, you say? Are those vibrations that would not be expected by running a motor? The motor is rotating some mass isn't it? How is it mounted? – jogco Feb 8 '18 at 12:23
  • 1
    The motor is spinning without load and if I connect it directly to the battery there are not such vibrations – Alessandro Dionisi Feb 8 '18 at 13:24
  • 1
    Usually you want your PWM frequency to be outside of the human hearing frequency range (16kHz or more), unless you want to squeeze every last bit of efficiency out of your H-bridge. 10 kHz shouldn't damage anything. – Dmitry Grigoryev Feb 20 '18 at 9:24
2

increasing the frequency is not going to damage the motor. The frequency is how often the motor is being turned on and off, and the PWM value is the amount of one time period the motor is either on or off. Because the motor is being turned on and off, if it is not mounted properly there will be more vibration then when it is fully on (connected directly to the battery) Obviously how much vibration is "normal" is not something that can be asked or answered unless you have a way of measuring that, and specs of the motor that reflect how much vibration there should be.

Here is some info on selecting the right frequency

Not the answer you're looking for? Browse other questions tagged or ask your own question.