using ESC to control motor speed

Hi all,

I have a basic question regarding the coding to use ESC's for motor speed control in Arduino UNO.

I have done some reading up and been scouring the web and the forums trying to find something that will help me solve my problems but I can't get my head around the issue.

What I am trying to do is to control the motor speed using a potentiometer. Ive connected a motor (MEDUSA 4300kv) to an ESC (picture attached) the ESC is connected to a regular 9V battery for power supply, the other end is connected to the Arduino ground (black wire from ESC) and a PWM pin for signal output (white wire from the ESC). NOTE I didnt know what to do with the red wire and from my understanding I didnt really need to connect it to the board. I used the following code which I got from the Arduino.cc example pages (the potentiometer is connected to A0 port, Ground, Arduino 5V pin):

// Controlling a servo position using a potentiometer (variable resistor)
// by Michal Rinott <http://people.interaction-ivrea.it/m.rinott>

#include <Servo.h>
 
Servo myservo;  // create servo object to control a servo
 
int potpin = 0;  // analog pin used to connect the potentiometer
int val;    // variable to read the value from the analog pin
 
void setup()
{
  myservo.attach(9);  // attaches the servo on pin 9 to the servo object
}
 
void loop()
{
  val = analogRead(potpin);            // reads the value of the potentiometer (value between 0 and 1023)
  val = map(val, 0, 1023, 0, 179);     // scale it to use it with the servo (value between 0 and 180)
  myservo.write(val);                  // sets the servo position according to the scaled value
  delay(15);                           // waits for the servo to get there
}

The problem is that the motor doesn't go at full capacity or even close, I know this because it (motor and ESC) has been tested using a different control board that was controlled using a R/C transmitter-receiver set up with a variable power supply as source.

so basically: Help?

You are going to have to look up some data on the speed control. Most will list some sequence for ARMING the speed control like they must be set to low throttle for a short period of time and then advanced to half throttle and then back to low throttle. They will beep several times indicating that power has been applied and to signal that they are ARMED. If you don't go through the arming sequence they won't run the motor. Its for safety - Imagine attach the battery and your radio is at full throttle and you would have a real handfull...

It looks to me that what you have got is a UBEC and not an ESC.

Anyway check your battery when it is under load to see if you have the voltage you are expecting.

NOTE I didnt know what to do with the red wire[/quote]

You are right, don't use the read wire, on an ESC that is the positiv wire that deliver power to the receiver and servo's

the ESC is connected to a regular 9V battery for power supply

Ah, you don't mean the little rectangular 9V "transistor" battery, do you?

There's not nearly enough current capacity there to run a motor as large as that one looks.

-j

ESC even for a small motor like that will probably take 2 to 5A peak to spin-up - a small battery is hopeless for RC brushless
motors - they are designed for extreme power density. NiMH or lithium power pack as recommended by ESC manufacturer
is needed.

Running a brushless motor isn't really the same thing as running a servo.

Running a brushless motor isn't really the same thing as running a servo.

Yes it is. The ESC used to control and power a brushless motor expects a servo signal (a pulse between 1000 and 2000 microseconds every 20 mS).

thanks guys a lot of new info for me to work on.

some questions though:

There's not nearly enough current capacity there to run a motor as large as that one looks.

what do you mean current capacity? how do i know what a batteries current capacity is?

a brushless motor expects a servo signal (a pulse between 1000 and 2000 microseconds every 20 mS.)

does that mean that i can't program a brushless (or a servo) without using the 'servo' library? for example if I send a 'HIGH' signal every 20ms and use the potentiometer to change a variable that pauses the HIGH signal between 1000-2000 microsec's?

suramu

for example if I send a 'HIGH' signal every 20ms and use the potentiometer to change a variable that pauses the HIGH signal between 1000-2000 microsec's?

This is exactly what the servo library do, no need to invent your own.

what do you mean current capacity?

Voltage is only one component of the electrical power provided by a battery. The other is current.

how do i know what a batteries current capacity is?

The only sure way is to read the datasheet.

Some chemistries provide more current than others. In general, larger batteries of the same chemistry provide more power than smaller batteries.

If your 9V battery is like this, it's a very small size of a lower powered chemistry, so you're only going to get a few tens of milliamps of current.

-j