# Control T200, basic esc with python

**URL:** <https://discuss.bluerobotics.com/t/control-t200-basic-esc-with-python/7745>\
**Category:** Speed Controllers (ESCs)\
**Tags:** basic-esc\
**Created:** [July 10, 2020, 4:14pm UTC](https://discuss.bluerobotics.com/t/control-t200-basic-esc-with-python/7745 "2020-07-10T16:14:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![muhammedyilmaz](https://avatars.discourse-cdn.com/v4/letter/m/13edae/32.png) [@muhammedyilmaz](https://discuss.bluerobotics.com/u/muhammedyilmaz)\
**Post date:** [July 10, 2020, 4:14pm UTC](https://discuss.bluerobotics.com/t/control-t200-basic-esc-with-python/7745/1 "2020-07-10T16:14:28Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![patrickelectric](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/patrickelectric/32/2162_2.png) [@patrickelectric](https://discuss.bluerobotics.com/u/patrickelectric)\
**Post date:** [July 20, 2020, 3:14pm UTC](https://discuss.bluerobotics.com/t/control-t200-basic-esc-with-python/7745/2 "2020-07-20T15:14:53Z")

</div>

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](https://bluerobotics.com/store/thrusters/speed-controllers/besc30-r3/), the signal should be between 1100us and 1900us.

For more information, search for PWM RC signal.
