Tinee9: Arduino Controlled ESC

by Tiny9 in Circuits > Arduino

975 Views, 6 Favorites, 0 Comments

Tinee9: Arduino Controlled ESC

img_20180605_005410.jpg

4 Years ago I made my own drone for a cost of $300 back when the first commercial drone was about $1500. The Arducopter controller controlled the motor ESC, I used the DJI DIY frame, and bought a 720MHZ remote control. Here is a modified KIT of what I built 4 years ago. KIT Now that I have bit more experience in electronics aerospace engineering, I want to build my own PCBA controller to control the drone.

I will be using Arduino for my platform. For today, I will demonstrate that we can control an ESC with and arduino nano.

Difficulty: Moderate

Knowledge: Need to know soldering, Need to know basic power connections of a drone.

Reminder Tinee9.com has other Tutorials regarding Arduino and also talks about common electronics such as Drones. I talk about how they are used and how the sensors work on Drones used by companies or research and development teams.

Materials

I didn't want to choose the solder, solder Iron, PC, and USB Cable but you can get the rest of the Items from this link KIT

Materials: ESC

Motor

Battery that will run the motor

Solder

Solder Iron

Arduino Nano

Bread Board

Jumper Wire

PC

USB Cable

Arduino IDE

Basic Assembly

img_20180605_005410.jpg
img_20180605_005423.jpg

Step 1: Solder your Motor to the ESC controller.

Step 2: Attach your Arduino Nano to a bread board.

Step 3: Attach your Battery - to the ESC Black Wire.

Step 4: Attach your ESC Black to the Arduino GND Pin.

Step 5: Attach your ESC White wire to Arduino D9 Pin.

Step 6: Attach Arduino Nano to PC with USB Cable.

Code

Step 7: Program Arduino Nano with this Code in Arduino IDE.

What the code is doing is initializing ESC and then it ramps up faster every 0.25 seconds till a hardcoded set point then turns off. Then repeats. Basically this code is allowing you to see how a motor is commanded by an ESC. Also the code is the basic building block for commanding 4 ESCs at the same time when you develop the rest of the code to fly a fixed wing or quadcopter.

Code:

#include <Servo.h>;
Servo esc;

int Pin = 0;

int x = 0;

void setup() {

esc.attach(9); }

void loop() {

int throttle = analogRead(Pin);

throttle = map(throttle, 0, 1023, 0, 179);

for(x = 0; x < 175; x++){

esc.write(x); delay (250); }

esc.write(0);

delay(10000); }

Connect and Run

Arduino Controlled ESC

Step 8: Attach your ESC Red wire to Battery +.

Step 9: Enjoy your Arduino Nano commanding the ESC with PWM commands.