# Controlling ESC with Jetson Xavier (python)

Hello,

Is there is a python library to control the ESC to send PWM signals?

*I am using Nvidia Xavier NX Dev Kit.

Our ESCs are controlled by PWM signals like those commonly used in servos (ON times of 1100-1900 microseconds).

# Suggested Approach (Use a Servo library)

I haven’t used your dev kit before but I’d suggest looking for libraries that support controlling servo motors, as then you’ll be able to just specify the min and max ON times, and the proportion you want to set the ESC to (e.g. 0% → full negative, 50% → off, 100% → full positive).

# Fallback Option (manual PWM control)

If you’re not able to find a servo library then you’ll likely have to control your PWM signals with the more standard duty-cycle and frequency parameters, in which case you should note that our technical details specify a maximum update frequency of 400Hz. Note also that lower frequencies will generally have a lower duty-cycle resolution in the operating range (e.g. a 10Hz signal has 1100-1900us ON times as 1.1% to 1.9% duty-cycle, whereas for 50Hz it’s 5.5% to 9.5%, and at 400Hz it’s 44% to 76%)

An appropriate duty-cycle proportion for a selected frequency can be calculated by duty=\frac{1100 + ratio \times 800}{1000000 \times frequency}, where ratio is a number between 0 and 1 (e.g. 0 → 1100us → fully negative, 0.5 → 1500us → stopped, 1 → 1900us → fully positive), and frequency is your PWM frequency in Hz.

1 Like