reverse direction brushless motor with raspberry pi

Viewed 21

I have a Raspberry PI 4. I am trying to connect my raspberry pi with two brushless motors using ESC blheli 30a. They start spinning when I run the code. Is there a way to make it spin in the reverse direction with a python script?

import time
import RPi.GPIO as GPIO
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BOARD)

GPIO.setup(7, GPIO.OUT)
GPIO.setup(11, GPIO.OUT)
t1 = GPIO.PWM(7, 50)
t2 = GPIO.PWM(11, 50)
t1.start(0)
t2.start(0)

def forward():
    print('forward')
    t1.ChangeDutyCycle(5.5)
    t2.ChangeDutyCycle(5.5)
forward()
x = input('enter: ')

if x == 's':
    t2.stop()
    t1.stop()

GPIO.cleanup()
quit()
1 Answers

This is a question of how your ESC (electronic speed control) firmware is setup, not only of what signal you send to it from your raspy.

As you see in the screen shot (source is the youtube link below) there is a tool called BLHeliSuite that is used to flash your ESC firmware. In this tool you can adjust the motor direction from normal or reversed to bidirectional.

It might be possible that you need a certain firmware for this to work. You'll probably find this information in the documentation of your ESC

enter image description here

https://www.youtube.com/watch?v=JfaEjlpLpkY

this might be your tool, but the page is in german.

https://betaflight.de/docs/knowledge-base/software/blheli32_suite-blheli-suite-jesc/

good luck :)

Related