I'm doing my final year project on closed loop control of a BLDC motor. I've started off writing some code that will switch three-phase inverter circuit that will commutate the motor at a speed set by a 10k pot. (I'm trying to establish a working open loop controller before moving onto closed loop). I've attacehd my circuit diagram and code aswell as screenshots of the issue im facing.
The MOSFETs on the inverter are switching in the correct sequence, and the speed control section of the code is working, as the switching speed of the inverter is changing when I slide the pot up and down. However, only a small current seems to be going towards the motor itself. As you can see I've added ammeters in my circuit. The current reads a maximum of around 0.5A. The motor is not spinning which makes me think that this maybe isnt enough current?
I've tried upping the voltage supply and I can't figure out any other way to increase the current going into the motor, or why it won't spin.
Does anyone have any idea what I could potentially be missing? It's starting to severely stress me out.
int led1 = 2;
int led2 = 7;
int led3 = 4;
int led4 = 3;
int led5 = 6;
int led6 = 5;
int potpin = A0;
int potval;
void setup() {
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(led3, OUTPUT);
pinMode(led4, OUTPUT);
pinMode(led5, OUTPUT);
pinMode(led6, OUTPUT);
}
void loop() {
potval = analogRead(potpin);
digitalWrite(led5, LOW);
digitalWrite(led1, HIGH);
delay(potval);
digitalWrite(led6, LOW);
digitalWrite(led2, HIGH);
delay(potval);
digitalWrite(led1, LOW);
digitalWrite(led3, HIGH);
delay(potval);
digitalWrite(led2, LOW);
digitalWrite(led4, HIGH);
delay(potval);
digitalWrite(led3, LOW);
digitalWrite(led5, HIGH);
delay(potval);
digitalWrite(led4, LOW);
digitalWrite(led6, HIGH);
delay(potval);
}