I have looked all over the internet on how to run a brushless motor with an esc through RPi.GPIO and have no results. I have tried simply wiring the esc as it is supposed to be and programming it through PWM. Here is what I have so far:

joystick_count = pygame.joystick.get_count()

        for i in range(joystick_count):
                joystick = pygame.joystick.Joystick(i)

                axes = joystick.get_numaxes()
                axes_list = []

                for j in range(axes):
                        axis = joystick.get_axis(j)
                        axes_list.append(round(axis, 1))

                M_out = (-axes_list[3] + 1) / 2

                print(M_out * 100)

                M_thrust.ChangeDutyCycle(M_out * 100)

Can anyone help me?

  • What do you expect to happen? Could you explain what signal you send to the ESC to make it stop and what signal you send to make it go full throttle? How have you initialised the ESC? – joan Oct 4 '15 at 4:09
  • Right now I am running the esc as though it were a DC motor. I don't think that is the correct way to use the esc but I am unsure of how our is to be used. I looked around and found that some people used or like this and others say it should be like a servo, but neither was functional for me. – DSchana Oct 4 '15 at 4:14
  • 1
    It will be controlled like a servo. Generally a 1 ms pulse for off and a 2 ms pulse for full throttle. Pulses need to be sent at 50 Hz (50 times a second) or thereabouts. ESCs generally need to be initialised with a special sequence of pulses (they are often used in quadcopters, you don't want them to start flying just by being powered up). RPi.GPIO uses software timed PWM. You will probably get erratic results but it should be capable of coarse control. – joan Oct 4 '15 at 4:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.