Arming a brushless motor through ESC

I am trying to control a brushless motor with WeMOS D1 ESP8266

The motor controller and motor specs are below:

A 11.1v LiPo battery powers both the controller and ESP8266 (VIN, GND, D9-GPIO2)

Turning on the controller spins its fan. but the motor does not spin nor does it beep.
What is the arming procedure to get the beeps to get the motor started?

Also, the ESC has a built-in switch. Should this be turned on at the time Setup() is run? If the switch is turned on, ESC fan immediately starts spinning.

Coded as per this:

Lessons on Arming ESC with Arduino - Using Arduino / Motors, Mechanics, Power and CNC - Arduino Forum

UPDATE

I was able to arm it ! Well partially. Need to arm and use it without resetting Arduino in-between.

Uploaded above code to Arduino
Turned on the ESC switch. Fan started spinning.
Reset Arduino
Around i=76 in setup() heard 3 beeps and then nothing happened
Reset Arduino again
Around i=76 heard 1 beep in setup()
loop() got executed and motor started spinning wildly that battery got disconnected.

Questions:

How do I make sure 3 beeps and then the 1 beep happen without Arduino reset in between?

What does variable i mean in the code above? Speed or angle or throttle or frequency or PWM ?

How do I gradually accelerate the motor?

Where can I get something to clamp down the motor? Home depot?

Tested code:

#include <Servo.h>

Servo motor;

void setup ()
{
motor.attach(2);
Serial.begin(9600);
int i = 0;

//Give some time before you start anything like switching on your ESC / Motor

Serial.print("Arming Test Starts in ");
for(i =10; i > 0; i--)
{
Serial.print(i);
Serial.print(".. ");
}
// delay(1000);
Serial.println();

// Watch for the tone when the ESC gets armed

for(i = 60; i < 80; i++)
{
motor.write(i);
Serial.println(i);
delay(500);
}
}

void loop()
{
motor.write(80); delay(1000);
motor.write(91); delay(2000);

}

@helitus

Usual procedure with a radio is, turn on transmitter with throttle set to low, then turn on receiver.
Move throttle up to maximum and then back down to low setting.
I have had some where the idle trim was set too high and the motor would never arm.

Thanks @bluejets
How do I correlate this with my setup which doesn't have a transmitter, receiver and stick? Or may be some of these exist in the ESC that I am not aware of.

Relate your progress in new posts.

There is nothing in any loop you’ve published here or pointed to, so please copy your entire current program into your next post!

You may need to calibrate the ESC, google is your friend and there may be a particular magic sequence for your exact ESC.

Also a quick pencil diagram of how you are hooking everything up would help.

a7

It does not matter. You merely have to produce the same sequence of "movements" of the PWM signal as the control stick would - from "off" (which is presumably centre if the motor is reversible) to full "forward" and back. This would be part of "setup()" But you should know that sequence from the instructions for the motor.

This is an example that should work, depends on the esc and the required levels of signal.

#include<Servo.h>

Servo esc; // create servo class with the name as "esc"

void setup() {
  esc.attach(9); // Specify the esc signal pin, here as 9

  esc.writeMicroseconds(1000); // initialise the esc signal to low level
  delay(1000);                 // wait for 1 second
  esc.writeMicroseconds(2000); // then set it to high level
  delay(1000);                 // then wait again for 1 second
  esc.writeMicroseconds(1000); // then set it back again to low level

  Serial.begin(9600);// comment out after testing********
}

void loop() {
  int potValue = analogRead(A0); // read the input from the pot and store in potValue
  Serial.print("pot value =  "); // serial monitor the read value ............(comment out after testing)
  Serial.println(potValue);      //(comment out after testing)

  potValue = map(potValue, 0, 1023, 1000, 2000); // map the pot value to minimum and maximum values

  Serial.print("mapped value =  "); // serial monitor the mapped value.........(comment out after testing)

  Serial.println(potValue);  //.............(comment out after testing)
  delay (2000);             //..............(comment out after testing)

  esc.write(potValue);
}

Thanks @Paul_B and @bluejets.

I added an "update" to my post above. I was able to arm with @ helitus code.
But after first reset I get 3 beeps, after second reset I get 1 beep and then motor rotates. How can I avoid 2 resets? And then in the loop() what goes into write() ? 0 to 180 or 0 to 1023 or something else?

Hi,

Please do not go back to previous posts and "update" them
Place any updates in a NEW post, that way the thread will read as a continuous flow of information.
By updating a previous post you have added info that was asked for later on in the thread, this makes the thread very hard to follow for anyone trying to use it as a solution to their own bugs.

Tom... :grinning: :+1: :coffee: :australia:

Yup...I'm totally lost now....best of luck.

Thanks @bluejets. This post is continued here: Arming a brushless motor through ESC - 2 - Using Arduino / Project Guidance - Arduino Forum

What do you hope to accomplish by creating a new thread?