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.
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...
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.
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?
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.