Advertisement



Advertisement

Building a new R/C device is a lot of fun, but most of the equipment is also pretty fragile. Much of it is super cheap, with poor quality control and no fault protection. A common way to end up needing replacements is through an electrical fault in an electronic speed controller or its connection to the rest of your platform.

If you're new to the hobby, you may want to check out my brief introduction to ESCs.

Arduino is a great little platform for integrating with common hardware devices. They're a great combination of versatility and price, and programming them is a breeze. Among other things, they can produce the PWM signal necessary to drive your ESC, before connecting it to your expensive model. For this article, I am using an Arduino Mega 2560, which is way overkill for the job.

You should also have a multimeter for testing the basic connections before we plug it into Arduino. If for some reason you don't have one, get down to Harbor Freight and use a coupon for a free one.

I'll also be using a small breadboard, a momentary switch (normally open), a few pin headers, and a few jumper wires.

First off, you'll need to prepare some header pins and your switch. The pins have a short side and a long side, we really need two long sides. We can accomplish this by soldering two sets together by their short sides. The switch is easily soldered to a set of pins as well. Be careful as you solder them as applying heat to the pins will instantly loosen them from their plastic housing, allowing them to move around. It's a good idea to use your multimeter to test for continuity across the connections as well as making sure there is no continuity between pins when done.

Prepared jumper block and switch

Next, you'll need to program your Arduino. The sketch required is quite small.

 

#include <Servo.h>
Servo ESC;
const int escPin=2;
const int buttonPin=11;
int buttonState = 0;
 
void setup() {
pinMode(buttonPin, INPUT_PULLUP);
ESC.attach(escPin);
}
 
void loop() {
buttonState=digitalRead(buttonPin);
if (buttonState==LOW)
        ESC.write(1500);
else
        ESC.write(0);
delay(100);
}



We will be using Digital PWM11 to read the value ofthe switch, and Digital PWM2 to send the control signal to the ESC. If your ESCs include BEC function, we can also power the Adruino from that. Otherwise, plugging it into a USB power source will do just fine. 

Arduino and Breadboard ready for testing

 

Click the image for a full size view. The connections from left to right on the breadboard  are:

. (Red) PWM11 to the left pin on the switch

. (Orange) Ground to the right pin of the switch

. (Orange again) PWM2 to the left pin of our pin header

. (Green) V In to the middle pin of our pin header (if your ESC doesn't include BEC, or you otherwise don't want to power your Arduino from the BEC, skip this jumper)

. (Yellow) Ground to the right pin of our pin header

NOTE: When testing your ESCs or motors, remove your propellers first!

Next, you'll need a power source for your ESC. An easy setup is to solder your normal battery's matching power connector onto alligator clip leads. Clipping them to the red and black power leads on the ESC will do the trick. Before I wire my ESCs to a motor, I always test the BEC. There is always the chance of a manufacturing defect, not to mention there have been instances where manufacturing runs of ESCs have used the wrong component, resulting in incorrect voltage. You should get a reading of 5v when testing the red and brown pins.

Testing the BEC voltage of an ESC

 

At this stage, you're ready for your motor to be wired to your ESC. Your motor should be mounted to something, such as the arm of a quadcopter. Make sure to remove your propeller, and if the prop shaft uses a threaded cap, remove that too. Connect the ESC to the pins on the breadboard, making sure the brown wire is on the far right, then the alligator clips to the ESC's power leads, and finally the battery to the alligator clip cable. If you are powering your arduino from the BEC, it should power up and the ESC should beep.

Completed test setup

 

And this is the finished product. If everything is working as it should, pressing the momentary button should cause your motor to spin quickly.

 

What if it didn't work?

 

If your arduino didn't power on, or if it did power on but the ESC didn't initialize (beep), check the order of your jumper wires. If the arduino is running and the ESC initialized but pressing the button doesn't cause the motor to spin, verify that the button is between a ground pin and PWM11. if the motor doesn't spin or spins erratically, check the solder connections on the ESC to the motor, as these are easy to accidentally bridge.

Joomla! Debug Console