วันอาทิตย์ที่ 7 มิถุนายน พ.ศ. 2558

Control brushless motor By Arduino uno

Get!

1. Board Arduino Uno



2. Brushless Motor


3. ESC (Electronic Speed Control)


Start 

Step 1 set it follow this picture 


From ESC. The ESC cable signal wire (Yellow) set some signal pin in Ardiuno , I'll select pin 12 and anode (Black) cable connect to GND pin


Step 2 programming for controler to the motor 

If you select signal pin 12  !

1. Include Servo.h  for use servo mortor and blushless motor 

#include <Servo.h>

2. Create some variable for the servo motor .

Servo serv1;//mortor left  

3. In setup() method 

void setup() 
{
}

Set pin 12 for sent signal to ESC and set 0 value .
serv1.write(map(VALUE,Lower Bound,Upper Bound,0,180));

Lower bound and Upper bound = rank for control speed motor. 
VALUE is value off speed.

 serv1.attach(12);//pin 12 control
 serv1.write(map(0,0,100,0,180));

Delay 3 sec for ESC preparing.

  /////////////////////////////////delay for setup3 sec //////////////////////////
pinMode(13,OUTPUT);
digitalWrite(13,HIGH);delay(1000);digitalWrite(13,LOW);delay(1000);
digitalWrite(13,HIGH);delay(1000);digitalWrite(13,LOW);delay(1000);
digitalWrite(13,HIGH);delay(1000);digitalWrite(13,LOW);delay(1000);
////////////////////////////////////end set 3 sec///////////////////////////////

}

4. In loop() method 

brushless motor run!

void loop() 
{

serv1.write(map(30,0,100,0,180));

}

5. All program 

#include <Servo.h>
Servo serv1;
void setup() 
{
  serv1.attach(12);//pin 12 control
  serv1.write(map(0,0,100,0,180));
  /////////////////////////////////delay setup3 sec //////////////////////////
pinMode(13,OUTPUT);
digitalWrite(13,HIGH);delay(1000);digitalWrite(13,LOW);delay(1000);
digitalWrite(13,HIGH);delay(1000);digitalWrite(13,LOW);delay(1000);
digitalWrite(13,HIGH);delay(1000);digitalWrite(13,LOW);delay(1000);
////////////////////////////////////end set 3 sec///////////////////////////////
}
void loop() 
{
serv1.write(map(20,0,100,0,180));
}

..................................................................................................................................................................

And finally Upload  code to board