Hey everyone!
I am making an ESC of my own we have been using Mosfets,created our power supply and driver circuits using opto couplers, and using H-brigde for switching the mosfets in perfect order to run the motor
everything is going fine except the programming part. I have been doing it for quite long. I have tried many combinations but the motor is not rotating. It gives a beep. once it moved for 7 turns. but it didnt completed the whole 12 turns.
We are using a BLDC motor of rating
Model: A2212/6T
RPM/V: 2200 kV
Current: 12 A/60 s
The arduino code is as follows please guide me what am I doing wrong
int a=1000;
int pin1=3;
int pin2=5;
int pin3=6;
int pin4=9;
int pin5=10;
int pin6=11;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(pin1,OUTPUT);
pinMode(pin2,OUTPUT);
pinMode(pin3,OUTPUT);
pinMode(pin4,OUTPUT);
pinMode(pin5,OUTPUT);
pinMode(pin6,OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
///////////////////////////a-1-6///////////
Serial.println("1-6");
analogWrite(pin1, 127);
digitalWrite(pin2,LOW);
digitalWrite(pin3,LOW);
digitalWrite(pin4,LOW);
digitalWrite(pin5,LOW);
analogWrite(pin6, 127);
delay(a);
//////////// b- 1-4/////////////
Serial.println("1-4");
analogWrite(pin1, 127);
digitalWrite(pin2,LOW);
digitalWrite(pin3,LOW);
analogWrite(pin4, 127);
digitalWrite(pin5,LOW);
digitalWrite(pin6,LOW);
delay(a);
///////////e- 5-2//////////////////////////
Serial.println("5-2");
digitalWrite(pin1,LOW);
analogWrite(pin2, 127);
digitalWrite(pin3,LOW);
digitalWrite(pin4,LOW);
analogWrite(pin5, 127);
digitalWrite(pin6,LOW);
//Serial.println("5-2");
delay(a);
////////////////d- 3-6////////////////////
Serial.println("3-6");
digitalWrite(pin1,LOW);
digitalWrite(pin2,LOW);
analogWrite(pin3, 127);
digitalWrite(pin4,LOW);
digitalWrite(pin5,LOW);
analogWrite(pin6, 127);
delay(a);
//////////////////f- 5-4////////////////////
Serial.println("5-4");
digitalWrite(pin1,LOW);
digitalWrite(pin2,LOW);
digitalWrite(pin3,LOW);
analogWrite(pin4, 127);
analogWrite(pin5,127);
digitalWrite(pin6,LOW);
delay(a);
// Serial.println("3-6");
/////////////////////c- 3-2/////////////////////
Serial.println("3-2");
digitalWrite(pin1,LOW);
analogWrite(pin2, 127);
analogWrite(pin3, 127);
digitalWrite(pin4,LOW);
digitalWrite(pin5,LOW);
digitalWrite(pin6,LOW);
//Serial.println("3-2");
delay(a);
}
I am making an ESC of my own we have been using Mosfets,created our power supply and driver circuits using opto couplers, and using H-brigde for switching the mosfets in perfect order to run the motor
everything is going fine except the programming part. I have been doing it for quite long. I have tried many combinations but the motor is not rotating. It gives a beep. once it moved for 7 turns. but it didnt completed the whole 12 turns.
We are using a BLDC motor of rating
Model: A2212/6T
RPM/V: 2200 kV
Current: 12 A/60 s
The arduino code is as follows please guide me what am I doing wrong
int a=1000;
int pin1=3;
int pin2=5;
int pin3=6;
int pin4=9;
int pin5=10;
int pin6=11;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(pin1,OUTPUT);
pinMode(pin2,OUTPUT);
pinMode(pin3,OUTPUT);
pinMode(pin4,OUTPUT);
pinMode(pin5,OUTPUT);
pinMode(pin6,OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
///////////////////////////a-1-6///////////
Serial.println("1-6");
analogWrite(pin1, 127);
digitalWrite(pin2,LOW);
digitalWrite(pin3,LOW);
digitalWrite(pin4,LOW);
digitalWrite(pin5,LOW);
analogWrite(pin6, 127);
delay(a);
//////////// b- 1-4/////////////
Serial.println("1-4");
analogWrite(pin1, 127);
digitalWrite(pin2,LOW);
digitalWrite(pin3,LOW);
analogWrite(pin4, 127);
digitalWrite(pin5,LOW);
digitalWrite(pin6,LOW);
delay(a);
///////////e- 5-2//////////////////////////
Serial.println("5-2");
digitalWrite(pin1,LOW);
analogWrite(pin2, 127);
digitalWrite(pin3,LOW);
digitalWrite(pin4,LOW);
analogWrite(pin5, 127);
digitalWrite(pin6,LOW);
//Serial.println("5-2");
delay(a);
////////////////d- 3-6////////////////////
Serial.println("3-6");
digitalWrite(pin1,LOW);
digitalWrite(pin2,LOW);
analogWrite(pin3, 127);
digitalWrite(pin4,LOW);
digitalWrite(pin5,LOW);
analogWrite(pin6, 127);
delay(a);
//////////////////f- 5-4////////////////////
Serial.println("5-4");
digitalWrite(pin1,LOW);
digitalWrite(pin2,LOW);
digitalWrite(pin3,LOW);
analogWrite(pin4, 127);
analogWrite(pin5,127);
digitalWrite(pin6,LOW);
delay(a);
// Serial.println("3-6");
/////////////////////c- 3-2/////////////////////
Serial.println("3-2");
digitalWrite(pin1,LOW);
analogWrite(pin2, 127);
analogWrite(pin3, 127);
digitalWrite(pin4,LOW);
digitalWrite(pin5,LOW);
digitalWrite(pin6,LOW);
//Serial.println("3-2");
delay(a);
}