0
\$\begingroup\$

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

The motor controller and motor specs are below: https://www.ebay.com/itm/114619313561

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

The motor controller user manual is here: user manual

The wiring photo is here wiring photo

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

Have I chosen wrong hardware to work with a circuit board?

Here' some code:

#include <Servo.h>

Servo ESC1;

int pos = 0; //Sets position variable

void arm(){
  setSpeed(0); //Sets speed variable
  delay(1000);
  setSpeed(90); //Sets speed variable
  delay(1000);
  setSpeed(135); //Sets speed variable
  delay(1000);
  setSpeed(0); //Sets speed variable
  delay(1000);
}

void setSpeed(int speed){
  int angle = map(speed, 0, 100, 0, 180); //Sets servo positions to different speeds
  ESC1.write(speed); //angle
}

void setup() {
  ESC1.attach(2); //Adds ESC to certain pin.  GPIO2 is pin 9
  arm();
}

void loop() {

  int speed; //Implements speed variable

  for(speed = 0; speed <= 70; speed += 5) { //Cycles speed up to 70% power for 1 second
    setSpeed(speed); //Creates variable for speed to be used in in for loop
    delay(1000);
  }

  delay(4000); //Stays on for 4 seconds
 
  for(speed = 70; speed > 0; speed -= 5) { // Cycles speed down to 0% power for 1 second
      setSpeed(speed); delay(1000);
  }

  setSpeed(0); //Sets speed variable to zero no matter what
  delay(1000); //Turns off for 1 second

}
\$\endgroup\$
8
  • \$\begingroup\$ Do you also realize the RC convention is a pulse width between 1ms and 2ms long? Not 0%-100%? \$\endgroup\$ – DKNguyen May 27 at 0:30
  • 1
    \$\begingroup\$ Please don't shout. \$\endgroup\$ – Hearth May 27 at 0:38
  • \$\begingroup\$ Thanks @DKNguyen. I am not as knowledgeable. your guidance is appreciated. \$\endgroup\$ – Tims May 27 at 2:04
  • \$\begingroup\$ Found something here ... what PWM should be done and in what series to arm the motor? randomnerdtutorials.com/esp8266-pwm-arduino-ide \$\endgroup\$ – Tims May 27 at 2:13
  • \$\begingroup\$ What's the thing on top of the motor? \$\endgroup\$ – Bruce Abbott May 27 at 4:21
2
\$\begingroup\$

The "PWM" used in equipment for radio controlled models , is not actually true PWM where pulses are sent at a fixed frequency with an on-time proportional to the off-time betweeh 0% and 100%.

The "PWM" used in RC is actually a a pulse that varies between 1-2ms in width. So for 0%-100% it would be 1-2ms. But if it's -100%-100% then it would still be 1-2ms, except that 1.5ms would be considered 0%. It's not reading the ratio between on time and off time. It is literally measuring how long each pulse is high remains.

The pulse frequency can be pretty sloppy too. It just has to be sent often enough so that analog equipment power pulses frequently enough to hold position (like an analog servo) or frequently enough so the digital equipment (like an ESC or digital servo) does not think the radio signal has been lost.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Yes to all the above, but note that there's usually an "arming" procedure involving reducing the pulse width to minimum (1ms or down to 0.5 ms) for a second or so, then increasing it to start the motor. This avoids accidental power-ons at full speed. Details should be in the datasheet... \$\endgroup\$ – user_1818839 May 27 at 12:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.