Go Down

Topic: Controlling a brushless motor with an ESC (Read 1 time) previous topic - next topic

shayelk

Hi everyone!
I'm pretty sure I got this figured out, but I want to make sure I'm not going to do anything stupid and fry my ESC\arduino\PC's USB port\motors:

I'm using an UNO with this ESC, and this motor.

the specs I got from HK are:
0% throttle: 1100us
100% throttle: 1900us
signal amplitude: 5V
frequency: 100-300 Hz
ESC will arm on 0% throttle

So the connections I'm going to use are:
ESC->UNO:
GND->GND
DATA->1
the 5V pin is left unattached, the ESC is connected to a LiPo battery and to the motor.

the code is:
Code: [Select]

# include <servo.h>
# define minThrottle 1100 //us
# define maxThrottle 1900 //us
# define armingThrottle 0 //%

servo motor1;

int throttle;
int output;

void setup()
{
   motor1.attach(1);
   output = map(armingThrottle,0,100,minThrottle,maxThrottle);
   motor1.writeMicroseconds(output); //arming the ESC
   wait(500); //I guess the ESC needs a moment with the arming command. I know 500ms is longer then I need but I don't actually have an idea what would be an appropriate value here
}

void loop()
{
   throttle = getInputFromUser(); //i.e using a pot
   output = map(throttle,0,100,minThrottle,maxThrottle);
   motor1.writeMicroseconds(output);
   wait(10); //in order to work in 100Hz
}



Does everything seems to be alright? any comments?

a few more questions:
- I saw some posts suggesting running the tests with no prop on for safety's sake; other posts said never to run a motor without a load (i.e a prop)- I guess it's in order to limit the current (if I understand currectly, running a motor with no load is like running an electric circuit with no resistance)- what do you say? is it safe to run the motor with no load? if not, is a reverse prop (i.e CW prop for a CCW motor, so the motor won't generate lift, but will have a bit of drag on it) enough load?

- Just making sure I got this right: if I want to, I can use the ESC's 5V pin to power the arduino by connecting it to the arduino's 5V pin, given that no other power source (i.e battery,usb) is connected to the arduino. that would be the regular 5V pin (which I ordinarily use as output), and not the Vin pin, right?

- Is there a straight-forward way of figuring out what throttle value I need for a certain RPM? if not- is there any way to get the RPM as input, so that I could use a PID to control RPM?

Any help would be tremendously appreciated :)

MarkT

Quote
ESC->UNO:
GND->GND
DATA->1
Doesn't make sense apart from GND->GND.

The 3pin connector has ground, 5V and data.

Connect ground to Arduino ground and data to the relevant Arduino pin.

You might want to connect the 5V to Arduino 5V if you are powering the Arduino this way,
but for now run the Arduino off USB and don't connect the 5V from the ESC.

Once everything is working, double check the ESC is outputing clean 5V and then, yes
you could power this way.

I certainly don't recommend it though, the amount of noise may be excessive, and I've seen
ESCs fail spectacularly.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

zoomkat

You should basically wire your ESC to the arduino like it is a servo like the attached pix.
Google forum search: Use Google Search box in upper right side of this page.
Why I like my 2005 Rio Yellow Honda S2000  https://www.youtube.com/watch?v=pWjMvrkUqX0

Chagrin

Running a brushless motor without a load (propeller) is not a problem, although the wind generated by the propeller does help cool the motor. If you want to err on the safe side then just feel the motor; if it's too hot to touch then you need to back off.

You can buy "sensored" motors and ESCs for RPM control but I don't think any of them have a way of sending that speed back to the controller (the Arduino). I don't think there's anything in the RC world that provides that type of "closed loop" control.

shayelk

Thank you all for your comments!

You should basically wire your ESC to the arduino like it is a servo like the attached pix.
What is the "common ground" I need to connect everything to? isn't that accomplished by connecting the ESC's ground pin to the Arduino's?

zoomkat

Thank you all for your comments!

What is the "common ground" I need to connect everything to? isn't that accomplished by connecting the ESC's ground pin to the Arduino's?
The grounds of the arduino, ESC, and ESC power supply should be connected together.
Google forum search: Use Google Search box in upper right side of this page.
Why I like my 2005 Rio Yellow Honda S2000  https://www.youtube.com/watch?v=pWjMvrkUqX0

TomGeorge

Hi,

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Tom..... :)
Everything runs on smoke, let the smoke out, it stops running....

Go Up