0

I am new to Raspberry Pis. I am using a Raspberry Pi 4.

I am trying to control a BLDC motor from the BLHeli_32 ESC, using PWM signals output from GPIO pin 18.

For this project, I need the motor to go at only ONE speed, which i will find out later, and I need to make two Python functions to turn the motor on or off.

I am wondering if I should use set_PWM_dutycycle or set_servo_pulsewidth for this purpose.

For example, for set_PWM_dutycycle I was thinking some functions like this to run it at 50% dutycycle (does this mean 50% speed of motor?)

def start_motor():
        pi = pigpio.pi()
        pi.set_PWM_range(18, 100)
        pi.set_PWM_dutycycle(18, 50)

def stop_motor():
        pi = pigpio.pi()
        pi.set_PWM_dutycycle(18, 0)

and then for set_servo_pulsewidth I would just have similar code to this link pigpio ESC (Electronic speed control) problem

I'm wondering if theres anything to consider about the difference to these two approaches? Because I'm not using a servo motor. and the dutycycle is the % of the pulse width over the pulse period so could i get the same effect with these two functions?

Do I have to care about the frequency as well? It seems that my GPIO pin 18 is operating at frequency 800 HZ. The BL Heli 32 manual states: "Input signal rates up to at least 32kHz are supported. But please note that higher input signal rates put a heavier load on the MCU, and will reduce the maximum erpm that the ESC can handle. "

I know this seems like a very basic question, but I am asking this because I set one of these on fire yesterday with the pigs library so i want to make sure i understand exactly what i am doing.

Thank you!

1
  • the ESC accepts the same control signal as a hobby servo ... find a tutorial about servos
    – jsotola
    Apr 3 at 3:18

1 Answer 1

0

To answer one of the questions you asked it makes no difference which you use. They are just different ways to specify the same thing. Use whichever is the most convenient.

It is far from clear what you have or how it is connected. Unless you have a servo using an ESC seems inappropriate. Just use a transistor or MOSFET.

The relationship between voltage (however it is derived) and motor speed is non linear.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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