20A motor ESC stops working when connected to arduino

Hi, I have a model airplane I made myself, it has an arduino nano, an nrf24l01 antenna, 2 9g micro servos, a brushed 30000rpm dc motor, a 20A BLDC ESC and a 1000mah 2S lipo battery.

When I connect the esc to the arduino (using the 3 wires that usually go to the receiver), the led on it stops blinking and turns off, and the motor makes fast 3 low-pitched beeps.

I tried to see if its a battery problem, but the voltage is 8.2v (as it is fully charged), the motor is also fine (with around 28ohms of resistance) and the arduino is brand new and works with the servos, so I don't think there is a problem with it.

Probably the ESC is faulty?

Any clue why this happens? Thanks in advance.

How is the ESC connected to the Nano ?
How is the Nano powered ?
Have you calibrated the ESC ?
Please post your sketch, using code tags when you do

In my experience the easiest way to tidy up the code and add the code tags is as follows

Start by tidying up your code by using Tools/Auto Format in the IDE to make it easier to read. Then use Edit/Copy for Forum and paste what was copied in a new reply. Code tags will have been added to the code to make it easy to read in the forum thus making it easier to provide help.

1 Like

Strip all things and make a test code operating the ESC only.

The esc is connected to the nano via the 3 wires (2 of them power the nano: 5v and gnd) and the third one is a pwn input connected to the digital pin 5.

// code for a simple 3-channel nrf24l01 receiver

//include the necessary libraries
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
#include <Servo.h>

//define the channels
int ch_width_1 = 0;
int ch_width_2 = 0;
int ch_width_3 = 0;
int ch_width_4 = 0;
Servo ch1;
Servo ch2;
Servo ch3;
struct Signal {
byte throttle;      
byte pitch;
byte roll;
};
Signal data;

//configuration of the antenna module
const uint64_t pipeIn = 0xE9E8F0F0E1LL;
RF24 radio(7, 8); 

void resetdata()
{
// initial input mode
data.throttle = 127; // 0% throttle
data.pitch = 127;  // center position
data.roll = 127;   // center position
}

void setup()
{
  //define the pins for the outputs
  ch1.attach(5);
  ch2.attach(4);
  ch3.attach(3);

  //configure the antenna module and wait for the signal from the transmitter
  resetdata();
  radio.begin();
  radio.openReadingPipe(1,pipeIn);
  radio.startListening();
}

unsigned long lastRecvTime = 0;

//receive the inputs from the transmitter
void receivedata()
{
while ( radio.available() ) {
radio.read(&data, sizeof(Signal));
lastRecvTime = millis(); 
}
}

void loop()
//reset the antenna module if the connexion is lost
{
receivedata();
unsigned long now = millis();
if ( now - lastRecvTime > 1000 ) {
resetdata();
}

//define the range of motion
ch_width_1 = map(data.throttle, 0, 255, 1000, 2000);  
ch_width_2 = map(data.pitch,    0, 255, 1000, 2000);    
ch_width_3 = map(data.roll,     0, 255, 1000, 2000);     

//send the pwm signal to the outputs
ch1.writeMicroseconds(ch_width_1);
ch2.writeMicroseconds(ch_width_2);
ch3.writeMicroseconds(ch_width_3);
ch4.writeMicroseconds(ch_width_4);
}

Do as @Railroader suggests and get the ESC/motor working as the only thing connected to the Nano as a first step

The Servo library Sweep example would be a good place to start. Whatever you do, do not test the motor with the propeller attached

1 Like

Ok, I am going to try it and keep you updated

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.