Hello everyone,
I'm trying to control a DC motor using a raspberry pi 4 and the MD20A driver in python language. I'm familar with arduino programming but I'm new in python world.
I manage to start the motor but when I reduce the PWM it starts to make some noise and vibrations. I tried to increase the frequency to fix it and it's better but there are still this noise and vibrations at low PWM.
Here is my code :
I need the motor to run for several hours with a load. I suspect that this sound at low speed is synonym of problems which will affect the lifetime of my motor.
Does anyone has ideas ?![Laughing :lol:]()
I'm trying to control a DC motor using a raspberry pi 4 and the MD20A driver in python language. I'm familar with arduino programming but I'm new in python world.
I manage to start the motor but when I reduce the PWM it starts to make some noise and vibrations. I tried to increase the frequency to fix it and it's better but there are still this noise and vibrations at low PWM.
Here is my code :
Code:
import RPi.GPIO as GPIOimport timeGPIO.setmode(GPIO.BCM)PWM_PIN = 17 DIR_PIN = 27 GPIO.setup(PWM_PIN, GPIO.OUT)GPIO.setup(DIR_PIN, GPIO.OUT)pwm = GPIO.PWM(PWM_PIN,3000) try: while True: # Sens avant print("Move") GPIO.output(DIR_PIN, GPIO.LOW) pwm.start(100) time.sleep(10) print("Slow down") GPIO.output(DIR_PIN, GPIO.LOW) pwm.ChangeDutyCycle(50) time.sleep(10) print("Break") GPIO.output(DIR_PIN, GPIO.HIGH) pwm.ChangeDutyCycle(0) time.sleep(10)except KeyboardInterrupt: pass finally: pwm.stop() GPIO.cleanup() Does anyone has ideas ?
Statistics: Posted by Vector2000 — Wed Oct 30, 2024 9:30 am — Replies 0 — Views 10