Program for Speed control of brushless motor using Arduino

Can someone please help me on how to reduce the speed of the brushless motor? Iam using 2 pairs of A2212/10T/13T 1000KV Brushless Motor along with SimonK 30A ESC.I am using this motor to drive the boat which is made of foam boat.But the 1000KV motor is very fast to drive the boat.So I want to reduce the speed of the motor so that I can move the boat at a slow speed.can anyone help me with this? The following code I'm using:
/*

  • This Code is Only for personal Purpose only
  • This Is a self written code by Founder of beginnertopro.in Mr.Sai Tat Sat Mishra
  • www.beginnertopro.in
    */

char data = 0; //Variable for storing received data
const int lm1=7;
const int lm2=6;
const int rm1=5;
const int rm2=4;
void setup()
{
Serial.begin(9600); //Sets the baud for serial data transmission
pinMode(lm1,OUTPUT);
pinMode(lm2,OUTPUT);
pinMode(rm1,OUTPUT);
pinMode(rm2,OUTPUT);
}
void loop()
{
if(Serial.available() > 0) // Send data only when you receive data:
{
data = Serial.read(); //Read the incoming data & store into data
Serial.print(data); //Print Value inside data in Serial monitor
Serial.print("\n");
if(data=='F'){
front();
}else if(data=='B'){
back();
}else if(data=='L'){
left();
}else if(data=='R'){
right();
}else if(data=='S'){
Break();
}

}
}
void front(){
Serial.println("Forward Move");
digitalWrite(lm2,HIGH);
digitalWrite(rm2,HIGH);
digitalWrite(lm1,LOW);
digitalWrite(rm1,LOW);

}
void back(){
Serial.println("Back Move");
digitalWrite(lm1,HIGH);
digitalWrite(rm1,HIGH);
digitalWrite(lm2,LOW);
digitalWrite(rm2,LOW);
}
void left(){
Serial.println("Left Move");
digitalWrite(rm2,HIGH);
digitalWrite(rm1,LOW);
digitalWrite(lm1,HIGH);
digitalWrite(lm2,LOW);
}
void right(){
Serial.println("Right Move");
digitalWrite(lm2,HIGH);
digitalWrite(lm1,LOW);
digitalWrite(rm1,HIGH);
digitalWrite(rm2,LOW);
}
void Break(){

Serial.println("Break");
digitalWrite(lm2,LOW);
digitalWrite(lm1,LOW);
digitalWrite(rm1,LOW);
digitalWrite(rm2,LOW);
}

One controls the speed of motors by connecting them to PWM pins, and using analogWrite() to write different values. The names of the pins that you have assigned give no useful information about what each pin does, so I can't tell you which ones to analogWrite() to instead.

That code looks nothing like the code usually used to drive brushless motors via ESCs. They normally use the Servo library to drive the ESC via servo PWM and that is how you control the speed of the motors.

If your ESCs really work simply by writing a HIGH to them then they definitely don't have the usual SimonK firmware and possibly no ability to control the speed. Please provide details of the specific ESCs and their firmware.

Steve

One controls the speed of motors by connecting them to PWM pins, and using analogWrite() to write different values.

The OP is using a brushless motor interfaced to the Arduino using an electronic speed controller so analogWrite() will not work, but the Servo library almost certainly will.

UKHeliBob:
The OP is using a brushless motor interfaced to the Arduino using an electronic speed controller so analogWrite() will not work, but the Servo library almost certainly will.

OP mentioned brushless motors, NOT ESCs. My answer would have been quite different if ESCs had been mentioned.

Most RC motors these days are brushless.

-jim lee

PaulS:
OP mentioned brushless motors, NOT ESCs. My answer would have been quite different if ESCs had been mentioned.

1100RPM:
Can someone please help me on how to reduce the speed of the brushless motor? Iam using 2 pairs of A2212/10T/13T 1000KV Brushless Motor along with SimonK 30A ESC.

Hi,
Welcome to the forum.

Please read the first post in any forum entitled how to use this forum.
http://forum.arduino.cc/index.php/topic,148850.0.html then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

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

Thanks.. Tom... :slight_smile: