Let's Make Robots!

Arduino ESC and Brushless Motor Glitch? Kind of spins...

This is a follow-up on my last post. Chris, you got it to move with the arming help! Thanks!

The issue now is the motor will spin but keeps stopping and trying to reverse, and then spin again. I have tried playing around with the arming angle, but the motor always seems to stop and back up, as if trying to correct its angle. Is there a way to prevent this? I think it may be from my attachments to the motor, which make it start up slow. This is for a "tuna-can spinner" sumo and I have a piece of wood mounted horizontaly and a dowel rod verticaly, so the weight may be the issue here =). Is there a way to have it go only in one direction?

Here is my updated code:

// this uses the Arduino servo library included with version 0012

// caution, this code sweeps the motor up to maximum speed !
// make sure the motor is mounted securily before running.

#include <Servo.h>

Servo myservo;

void arm(){
  // arm the speed controller, modify as necessary for your ESC 
  delay(1000); //delay 1 second,  some speed controllers may need longer

void setSpeed(int speed){
  // speed is from 0 to 100 where 0 is off and 100 is maximum speed
  //the following maps speed values of 0-100 to angles from 0-180,
  // some speed controllers may need different values, see the ESC instructions
  int angle = map(speed, 0, 100, 0, 180);

void setup()
  delay (1000);

void loop()
  int speed;

  for(speed = 0; speed < 100; speed++) {

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

You know, I just sat down and stepped through your code, line-by-line. I take that overflow thing back...

I am sticking with the "going over the min and/or max of the ESC" thing, though.

This is most likely an overflow issue from your "map" command. I would add a serial.print in there so you can watch the numbers as they go by. This will tell you for sure if you are going over 180 (or any other limit of the ESC i.e. lower than a minimum limit) or if this is all as simple as 2 of your brushless wires needing to be swapped.

Get good data via your serial monitor and you will have your answer.

I wonder if your ESC is meant to do forward and reverse. If so, you may need to limit your range to 50 to 100 isntead of 0 to 100.

Good thought! I tried the reverse (0 to 50), as well as changing the angle to 90 and 360, but still the same issue. Could 50 to 100 work while 0 to 50 does not? I'll upload and though, thanks!