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:
# 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 ![]()
