DEV Community

Cover image for 🔥🔥🔥How to connect a powerful brushless motor from drone to Raspberry PI using Electronic Speed Controller (ESC)🔥🔥🔥
Nick Shulhin
Nick Shulhin

Posted on

🔥🔥🔥How to connect a powerful brushless motor from drone to Raspberry PI using Electronic Speed Controller (ESC)🔥🔥🔥

Hi everyone!

In this short article I will show how I managed to integrate brushless motor with ESC(Electronic Speed Controller) from drone to Raspberry PI.

Some time ago I was given a broken Cheerson Drone with one ESC burned (fabulous swimming pool snorkeling). My first idea was to connect brushless motor to Raspberry PI and potentially build a plane/drone.

My drone had XGW_ESC VER2.4B controller with motor soldered in:

Brushless motor has three wires: red for power, black for ground and yellow for signal transmission.

As a power supply for brushless motor I used 11.1V 2200mAh 25C LiPo battery with pins and terminal output:

Looking at ESC, it has three main wires we should care about: red for external supply power, black for ground and white marked with PPM (in my case).

I soldered pin wires to power supply input and connections in ESC

This is a brief diagram of connection:

We are going to use GPIO4 for signal and ground pin.

Once everything is ready, we can start coding!

import time
import RPi.GPIO as GPIO

GPIO.setup(7, GPIO.OUT)

t1 = GPIO.PWM(7, 50)





This code uses PMW(Pulse-width modulation) to initialise ESC pin with 50Hz frequency, and change duty cycle to 7.5%, sleep for 3 seconds and stop. It will be enough to spin your motor real quick fast and then completely stop.

Congratulations! We have done it! 🎉

Now, technically, you can try to build your own drone or plane! ✈️

Discussion (4)

farahanjum profile image
Farah Anjum

Finally something non web on dev!! Great article Nick.

nickitax profile image
Nick Shulhin Author

Happy you liked it, Farah! 😁

vinay182 profile image

i used the about code the output is attribute error changeDutycycle as no attribute rpio gpio says stuff like this