Basic ESC not initializing with battery powered Arduino

Well, I’m stumped. My Basic ESC works fine when the Arduino is connected to a PC via USB. But when the Arduino is powered by batteries, the ESC gives the first four beeps but not the fifth, and it will not run the motor.

To be clear, here are the two setups:

Setup 1: Basic ESC and M200 motor, Arduino Nano 33 IOT, Bar30 pressure sensor, 2 Blue Robotics LEDS, RTC unit, MicroSD card reader, flow meter with a reed switch (set up as an interrupt). The motor is powered by a battery pack with 14 C cells. The Arduino is powered via its usb port connected to a laptop.

This works great. I power up the motor, then the Arduino and get the five beeps. Every component works.

Setup 2: Same as Setup 1, except I disconnected the laptop and now power the Arduino with 4 AA cells via the Arduino usb port after giving the ESC power.

With this setup I hear the fourth ESC beep, but not the fifth, and the motor doesn’t spin. All of the other components work as instructed (LEDs, Bar30, RTC, MicroSD). Oddly, if I shut down power to the Arduino, the ESC then gives the fifth beep.

I also tried this with a stripped-down sketch with only the ESC and none of the other components in it. But this yielded the same results.

So, apparently the ESC is not getting the 1500 microsecond signal, but I don’t understand why putting the Arduino on battery power is an issue. Would that affect the pwm signal? Any ideas or suggestions would be appreciated.

Hi @mstephens -
Welcome to the forums!
It sounds like the ground of your Arduino is not connected to the ground of the Basic ESC. Without this connection, the Servo PWM signal to it is not referenced, and so the ESC cannot read it!
If that change doesn’t get things working for you, please share a diagram or pictures of your wiring setup.

Thank you for the quick reply. I think the ESC is grounded because the thin black wire is connected to Arduino Gnd pin, and it works flawlessly when powered via laptop USB.

To isolate the problem, I set up a breadboard with just an Arduino Nano 33 IOT, a Basic ESC, an M200 motor, and power supplies (14 C cells in series for the motor, and now 8 AA cells in series for the Arduino).

The connections are as follows:

  • 12V (8 AA cells), positive to Arduino VIN, negative to Gnd
  • ESC thin white wire to pin 2 (D2)
  • ESC thin black wire to Gnd
  • ESC thick red cable to 14 C cells positive
  • ESC thick black cable to 14 C cells negative
  • The three ESC outputs to the motor

The sketch (adapted from BlueRobotics):

#include <Servo.h>
byte servoPin = 2;
Servo servo;
int ledpin=13;  // the built-in LED

void setup() {
  pinMode(ledpin,OUTPUT);
  digitalWrite(ledpin,HIGH);
  servo.attach(servoPin);
  servo.writeMicroseconds(1500); // send "stop" signal to ESC.
  delay(7000); // delay to allow the ESC to recognize the stopped signal
  int signal = 1500; // Set signal value, which should be between 1100 and 1900
  int signal2 = 1550;
  servo.writeMicroseconds(signal); // Send signal to ESC.
  delay(3000);
  servo.writeMicroseconds(signal2);
  delay(7000);
  servo.writeMicroseconds(signal); // Send signal to ESC.
  digitalWrite(ledpin,LOW);
}

void loop() {
	}

I added the LED lines to confirm if the code was running.

When I connect the battery power to the Arduino, I still only get the fourth beep from the ESC and the motor does not run. The LED lights up for the 7 seconds as programmed. I also tried connecting the ESC to different pwm pins (e.g. A3, A5).

But, if I disconnect the battery power from the Arduino and connect it to a laptop via the USB port, the ESC beeps five times and the motor runs for 7 seconds as programmed.

Hi @mstephens -
You may need to connect a wire between the ground of the two battery packs. I’m unsure why this isn’t an issue when running when powered from USB though!

What voltage do the “14 C” cells provide? I’ve not seen disposable alkaline batteries used with the an ESC like this before!

It could do, for example if the batteries don’t supply as steady power the signal switching on may take slightly longer, and the switching off may drain slightly faster, resulting in shorter pulses being sent than intended. You could try measuring this with an oscilloscope if you have access to one, or see if the effective voltage is lower with a multimeter, or just try increasing the microseconds of the stop signal to see if/when it starts working again.

It wouldn’t hurt to ensure the batteries share a common ground (as @tony-white suggested), and to make sure they both have sufficient charge.

This and the energy and current capacities are quite important to the viability of using these for powering an M200 - what’s the intended use-case here? A single string of C cells could potentially be used for some very slow motor rotation in its peak efficiency region, but any appreciable speed would require at least some additional cell strings in parallel to increase the current capacity.

Thanks a lot for the suggestions, Tony and Eliot!

We located an oscilloscope and figured out how to use it. Below are photos when the Arduino is feeding a 1500 microsecond pwm signal under a) USB power and b) powered by a 12V DC regulated power supply to VIN. I forgot to run it from the battery pack, but on the 12V supply the ESC responded the same way (no fifth beep, motor doesn’t run).

To me it looks like the Arduino is delivering 1500 microseconds in both cases. But when powered by the 12V supply there appears to be more noise. Could that be the problem? And if so, do you have any suggestions on how to clean it up?

Also, I did connect all the grounds, as suggested. I included a drawing of the circuit below.

The device that I am working on will be used on research vessels, which have regulations for using lithium batteries. And it can be a hassle to ship those batteries overseas. That is why I am using regular alkaline and Ni-MH cells. It’s basically a seawater pump, and I found that it delivers the desired flowrate drawing less than 1 Amp, and after a 90 minute runtime the battery pack voltage only drops by around 2 V (starting at 20 or 17 V, depending on the battery type). There are 14 batteries because that gives a good starting voltage and 7 C cells can be easily fit in a 4-inch tube standing up. D cells are a little too tight, but I’ll probably move up to a 5 inch tube to allow more room for wiring. I’ll share all the details when it progresses a little further.



How confident are you that each of the cases you’ve shown above (12V and USB) output a 1500 usec pulse? To my eye the USB case looks like a shorter pulse, maybe 30-40 usec shorter. If you don’t have a frequency counter to take an exact measurement, you could redo this test with the 'scope set for 200usec/div, and very carefully align the left (rising) edge of the signal with one of the grid lines.

If the USB pulse is indeed shorter, but it succesfully initializes the ESC, you could try seeing if the battery test case will work properly if you set the pulse length to, say, 1470 usec rather than 1500. Basically, play with the trim of the servo output until you get it to initialize.

As to why the timing would be different with different power supplies, that’s an interesting question. Remember most Arduinos are clocked using a resonator rather than a crystal, and perhaps the resonator on this board is somehow susceptible to changes in the power supply of the board.

Or, maybe you’ll find that the two pulses are indeed the exact same length. Who knows. Keep us posted on what you find, this is an interesting problem.

-W

2 Likes

That’s a good point, thanks. I’m going to try varying the idle microseconds.

I also just dug up an Arduino Uno R3, and it’s able to run the ESC while under battery power through the VIN pin (I tried it with a 9V as well as 8 AAs). I haven’t hooked it up to the oscilloscope yet, but I suspect it has better power regulation onboard. At the very least it has some larger capacitors that wouldn’t fit on a Nano. Either that, or there is something different in the timing.

I think the next steps are to vary the pwm idle signal and try to find a way to clean up the signal from the Nano. As a last resort I could switch to a larger board, but I’m trying to avoid that because of the space needed.

The problem seems to be solved. When I sent 1465 or 1470 microseconds to the Basic ESC from the battery powered Nano 33 IOT, it gave the fifth beep and started running when the microseconds were increased. That was with 9 or 12V on the VIN pin. So, the timing is a little different if you power it via USB or VIN. Thanks a lot for all the comments and suggestions.

2 Likes