Getting r/c ESC motors to run from servo shield

I’ve been thrown onto this project that someone else has started (no I can’t contact them yet), and someone threw the wrong code onto the arduino I’m supposed to be using (we can’t find the original). All the parts are soldered in place and I know that it worked beforehand.

Basically, the arduino has this 16 channel PWM shield soldered on top, that is then supposed work as the throttle (as is my understanding) for the ESC. The shield comes with a library but I can’t get the ESC throttle to respond to the simplest of outputs (it has it’s own power supply).

I’ve done enough research on the ESC to know that it is stuck at the point where it expects a throttle signal to be able to calibrate it. However, it emits these beeps which mean it is getting an ‘abnormal throttle signal’. I can’t tell whether it is even getting a signal at all.

The project hasn’t changed at all accept for the arduino code we lost. Any ideas?

Thanks.

#include <Wire.h>
#include <Adafruit_PWMServoDriver.h>
Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver();
#define SERVOMIN  1000
#define SERVOMAX  2000

void setup() {
  Serial.begin(9600);
  pwm.begin();
  pwm.setPWMFreq(60);
}

void loop() {
  uint16_t p = SERVOMAX;
  Serial.println(p);
  pwm.setPWM(0,p,0);
  pwm.setPWM(1,p,0);
  pwm.setPWM(2,p,0);
  pwm.setPWM(3,p,0);

}

the 16 channel PWM shield:

the ESC

Can you get a normal servo to respond with the shield?

To check an ESC I use the “Knob” example in Servo examples.

Turn the pot to either extreme then turn on the ESC power.

Be careful with turning the pot if the ESC gets armed.

justone: Can you get a normal servo to respond with the shield?

To check an ESC I use the "Knob" example in Servo examples.

Turn the pot to either extreme then turn on the ESC power.

Be careful with turning the pot if the ESC gets armed.

Hey thanks for getting back to me.

I thought about trying that, I actually don't have a regular servo motor with me. Lot's of things are soldered in directly so I don't have too much room to test stuff like that anyways.

Like @justone suggested, I would want to put in a normal servo in place of the ESC to confirm that you can make the servo move.

And I would want to connect the ESC to a standalone UNO running the knob tutorial to see what steps are needed to arm your particular ESC.

Do you have any specs on the ESC?

vinceherman: Like @justone suggested, I would want to put in a normal servo in place of the ESC to confirm that you can make the servo move.

And I would want to connect the ESC to a standalone UNO running the knob tutorial to see what steps are needed to arm your particular ESC.

Do you have any specs on the ESC?

I'm not 100% on what 'arming' means. I've watched videos on how to startup the ESC. I think the startup is interrupted by the fact that something wonky is happening with the throttle signal. I can't find a ton of stuff on this ETC but I've been using this manual I found:

https://hobbyking.com/media/file/226412314X1012982X58.pdf

The ESC should use beeps to say it's ready to calibrate the throttle, it just doesn't get that far.

I should be able to get a servo kit in here tomorrow.

Thanks guys.

'Arming' is a process that is used to tell the ESC that it is receiving an intentional signal to move out of startup mode (where the motor is not powered) and in to armed mode (where the motor is powered). The intent is to prevent personal injury if the rc device is powered up with the throttle stick inadvertently in the high position. Without the arming sequence, the ESC would instantly go to full throttle and whatever is attached to the motor would spin at full speed. This is often a propeller which resembles a buzz saw when human bodies are close, as they are during power up.

You posted a link to a manual for a QBrain quadcopter ESC. Is that the model of ESC that you have? If so, have you run through the throttle range calibration as detailed on the bottom of page 1? Have you run through the normal startup procedure as detailed at the top of page 2?

vinceherman: You posted a link to a manual for a QBrain quadcopter ESC. Is that the model of ESC that you have? If so, have you run through the throttle range calibration as detailed on the bottom of page 1? Have you run through the normal startup procedure as detailed at the top of page 2?

Yes, that's the model. I've been trying to calibrate the throttle range this whole time but the only thing happening the beeps with a 2 second interval. As it says in the trouble shooting section in the manual, this means an 'abnormal throttle signal'. All I've been trying to do is get some sort of throttle signal by sending a variety of signals through the arduino code but I've only gotten those beeps.

I brought a servo in today and I cannot get it to even move through that 16 channel shield thing on top of the arduino...

robofresh: I brought a servo in today and I cannot get it to even move through that 16 channel shield thing on top of the arduino...

Can you post the code that you tried?

vinceherman:
Can you post the code that you tried?

I used the example code from the library that goes with the 16 channel adafruit. Exactly as it says in the doc page 20 here:

The green LED lit up and I put the servo in exactly how it shows on page 15. Everything is already soldered in from before so that shouldn’t be a problem.

Don't make us go hunting for the source code. You have it in your IDE. Post it here. Use the code tags.

Which pin is your servo connected to? Can you take a few pics of the unit and post them here? You can see how in this handy image guide.

vinceherman:
Don’t make us go hunting for the source code.
You have it in your IDE.
Post it here. Use the code tags.

Oops I forgot sorry.

/*************************************************** 
  This is an example for our Adafruit 16-channel PWM & Servo driver
  Servo test - this will drive 8 servos, one after the other on the
  first 8 pins of the PCA9685

  Pick one up today in the adafruit shop!
  ------> http://www.adafruit.com/products/815
  
  These drivers use I2C to communicate, 2 pins are required to  
  interface.

  Adafruit invests time and resources providing this open source code, 
  please support Adafruit and open-source hardware by purchasing 
  products from Adafruit!

  Written by Limor Fried/Ladyada for Adafruit Industries.  
  BSD license, all text above must be included in any redistribution
 ****************************************************/

#include <Wire.h>
#include <Adafruit_PWMServoDriver.h>

// called this way, it uses the default address 0x40
Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver();
// you can also call it with a different address you want
//Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver(0x41);
// you can also call it with a different address and I2C interface
//Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver(&Wire, 0x40);

// Depending on your servo make, the pulse width min and max may vary, you 
// want these to be as small/large as possible without hitting the hard stop
// for max range. You'll have to tweak them as necessary to match the servos you
// have!
#define SERVOMIN  150 // this is the 'minimum' pulse length count (out of 4096)
#define SERVOMAX  600 // this is the 'maximum' pulse length count (out of 4096)

// our servo # counter
uint8_t servonum = 0;

void setup() {
  Serial.begin(9600);
  Serial.println("8 channel Servo test!");

  pwm.begin();
  
  pwm.setPWMFreq(60);  // Analog servos run at ~60 Hz updates

  delay(10);
}

// you can use this function if you'd like to set the pulse length in seconds
// e.g. setServoPulse(0, 0.001) is a ~1 millisecond pulse width. its not precise!
void setServoPulse(uint8_t n, double pulse) {
  double pulselength;
  
  pulselength = 1000000;   // 1,000,000 us per second
  pulselength /= 60;   // 60 Hz
  Serial.print(pulselength); Serial.println(" us per period"); 
  pulselength /= 4096;  // 12 bits of resolution
  Serial.print(pulselength); Serial.println(" us per bit"); 
  pulse *= 1000000;  // convert to us
  pulse /= pulselength;
  Serial.println(pulse);
  pwm.setPWM(n, 0, pulse);
}

void loop() {
  // Drive each servo one at a time
  Serial.println(servonum);
  for (uint16_t pulselen = SERVOMIN; pulselen < SERVOMAX; pulselen++) {
    pwm.setPWM(servonum, 0, pulselen);
  }

  delay(500);
  for (uint16_t pulselen = SERVOMAX; pulselen > SERVOMIN; pulselen--) {
    pwm.setPWM(servonum, 0, pulselen);
  }

  delay(500);

  servonum ++;
  if (servonum > 7) servonum = 0;
}

It’s hooked up exactly as shown on page 15 of the doc.

It turns out I’ll be in contact with the guy who originally built it today so he’ll know what to do.

Thanks!