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

Nick Shulhin - Sep 12 '19 - - Dev Community

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.setwarnings(False)
GPIO.setmode(GPIO.BOARD)

GPIO.setup(7, GPIO.OUT)

t1 = GPIO.PWM(7, 50)

t1.start(0)

t1.ChangeDutyCycle(7.5)
time.sleep(3)

t1.stop()

GPIO.cleanup()
quit()

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! ✈️

. . . . . . . . . .
Terabox Video Player