I recently purchased a Hitec Energy Sport 50A ESC and a brushless motor 930Kv 28.9A . I am using a 12V 35AH SLA battery to power the ESC/motor. I am trying to calibrate and control the ESC with an Arduino Mega 2560. There are three wires on the ESC, brown, red, and orange. The orange wire is connected to pin 9 on the Arduino Mega. The potentiometer is a 50k linear. The following code was uploaded to the Mega. When I run the program the ESC seems to run through the programming mode and ignores changes in the pot reading (high to low).
I viewed a YouTube video that demonstrated the tones used in programming mode for the Hitec ESC. What I noticed is that time between beeps on my ESC are much longer than that on the video. In other words instead of "beep, beep....beep, beep" I hear "beep, beep.......................beep, beep".
I do know that the default setting for the battery is LiPo for this ESC, and that an SLA battery should be Nimh, but I don't know how to change that since I can't seem to make changes. When I attempt to calibrate the ESC or make changes during programming mode the ESC ignores the response from the potentiometer (high to low).
One question I have is what are other possible values of the Min and Max values for an ESC? I have tried a variety of programs that pretty much do the same thing as the program below, but they have the same result.
Any advice would be most appreciated. Thanks.
#include <Servo.h> //Using servo library to control ESC
Servo esc; //Creating a servo class with name as esc
// These constants won't change. They're used to give names to the pins used:
const int analogInPin = 2; // Analog input pin that the potentiometer is attached to
const int analogOutPin = 13; // Analog output pin that the LED is attached to
int sensorValue = 0; // value read from the pot
int outputValue = 0; // value output to the PWM (analog out)
void setup() {
esc.attach(9); //Specify the esc signal pin,Here as D9
esc.writeMicroseconds(1000); //initialize the signal to 1000
Serial.begin(9600);// initialize serial communications at 9600 bps:
}
void loop() {
// read the analog in value:
sensorValue = analogRead(analogInPin);
// map it to the range of the analog out:
outputValue = map(sensorValue, 0, 1023, 0, 255);
// change the analog out value:
analogWrite(analogOutPin, outputValue);
int val; //Creating a variable val
val= analogRead(A2); //Read input from analog pin a0 and store in val
val= map(val, 0, 1023,1000,2000); //mapping val to minimum and maximum(Change if needed)
esc.writeMicroseconds(val); //using val as the signal to esc
// print the results to the Serial Monitor:
Serial.print("sensor = ");
Serial.print(sensorValue);
Serial.print("\t output = ");
Serial.println(outputValue);
// wait 2 milliseconds before the next loop for the analog-to-digital
// converter to settle after the last reading:
delay(2);
}