Control T200, basic esc with python

Hi, I use t200 thruster with basic esc and I want to control thuster with raspberry pi. Howewer I couldn’t find a sample code.

I try this code:

import RPi.GPIO as GPIO
from time import sleep

GPIO.setmode(GPIO.BCM)

GPIO.setup(18,GPIO.OUT)
motor=GPIO.PWM(18,100)
motor.start(0)

# GPIO.setwarnings(False)

try:
    for i in range(100):
        print(i)
        motor.ChangeDutyCycle(i)
        sleep(0.5)
except KeyboardInterrupt:
    print("Motor kapatılıyor... (Ctrl+C ile çıkış yapıldı.)")
finally:
    GPIO.cleanup()

However I did not get a stable result. As far as I can tell, 12-20 runs in the backward direction and 60-70 in the forward direction. This made no sense to me.

Do you have a sample code for me? I’ll be happy if you can help me.

Hi,

I would recommend you to check this code with an oscilloscope to make sure that the configuration frequency is correct.

There is also some problems with your code:

  • There is no frequency configuration, I would recommend to use ChangeFrequency with 100Hz just to test.
  • You are using a PWM duty cycle from 0-100, and that is not how the ESC signal input works, check out documentation, the signal should be between 1100us and 1900us.

For more information, search for PWM RC signal.