0
\$\begingroup\$

I am trying to build an ESC from scratch and am currently facing issues, as the motor won't activate. I am using an Arduino Uno and a 30V-5A supply voltage.

When plugging the supply voltage, it automatically switches to c.c. (Constant Current I guess ?). I've deducted that this happens when there is a short-circuit. I tried to replace the BLDC with diodes, in order to debug which step was failing, but behavior is quite messy to understand. I can't get to understand why there is a short-circuit

Here's the schema I've made, and built on a breadboard. Did I do something wrong in it?

enter image description here

Here's the code I've used. Did I do something wrong in it?

int pot = A0;
int SensorA = 8;
int SensorB = 9;
int SensorC = 10;
bool hallAstate;
bool hallBstate;
bool hallCstate;


int fase = 1;
int Delay=4000;
unsigned long previousMillis = 0; 
unsigned long currentMillis = 0;

void setup() {
  Serial.begin(9600);
  Serial.println("ESC Homemade");
  pinMode(pot,INPUT);
  pinMode(SensorA,INPUT);
  pinMode(SensorB,INPUT);
  pinMode(SensorC,INPUT);
   
  DDRD  |= B11111100;       // Sets D2, D3, D4, D5, D6 and D7 as OUTPUT 
  PORTD &= B00000011;       // D2-D7 LOW
  PCICR |= (1 << PCIE0);    // enable PCMSK0 scan
  PCMSK0 |= (1 << PCINT0);  // Set pin D8 trigger an interrupt on state change.   A
  PCMSK0 |= (1 << PCINT1);  // Set pin D9 trigger an interrupt on state change.   B
  PCMSK0 |= (1 << PCINT2);   // Set pin D10 trigger an interrupt on state change.  C     
  
  currentMillis = micros();

  hallAstate = digitalRead(SensorA);
  hallBstate = digitalRead(SensorB);
  hallCstate = digitalRead(SensorC);
}


void loop() {
  currentMillis = micros();
  if(currentMillis - previousMillis >= Delay){
  
    previousMillis += Delay;   
    
    switch(fase){
      //Phase1 A-B
      case 1:
      PORTD = B01110000;  //  Pin 4,5,6 to HIGH
      break;       
    
      //Phase2 C-B
      case 2:
        PORTD = B00110100;  //  Pin 2,4,5 to HIGH
      break;
  
      //Phase3 C-A
      case 3:
        PORTD = B00011100;  //  Pin 2,3,4 to HIGH
      break;
    
      //Phase4 B-A
      case 4:
        PORTD = B01001100;  //  Pin 2,3,6 to HIGH
      break;
  
      //Phase5 B-C
      case 5:
        PORTD = B11000100; //  Pin 2,6,7 to HIGH
      break;
  
      //Phase6 A-C
      case 6:
        PORTD = B11010000;  //  Pin 4,6,7 to HIGH
      break;
    }//end of switch       
  }//Case of if millis  
  
  Delay=map(analogRead(pot),0,1024,1,4000); //we obtain the delay speed using the potentiometer 
}


ISR(PCINT0_vect){
  hallAstate = digitalRead(SensorA);
  hallBstate = digitalRead(SensorB);
  hallCstate = digitalRead(SensorC);
  if ((hallAstate == 1) && (hallBstate == 0) && (hallCstate == 1)) {
    fase = 1;
  }
  if ((hallAstate == 0) && (hallBstate == 0) && (hallCstate == 1)) {
    fase = 2;
  }
  if ((hallAstate == 0) && (hallBstate == 1) && (hallCstate == 1)) {
    fase = 3;
  }
  if ((hallAstate == 0) && (hallBstate == 1) && (hallCstate == 0)) {
    fase = 4;
  }
  if ((hallAstate == 1) && (hallBstate == 1) && (hallCstate == 0)) {
    fase = 5;
  }
  if ((hallAstate == 1) && (hallBstate == 0) && (hallCstate == 0)) {
    fase = 6;
  }
  Serial.print("Step: ");
  Serial.println(fase);
}
\$\endgroup\$
4
  • \$\begingroup\$ A BLDC motor controller is a hard thing to troubleshoot. The first thing would be to unplug the motor and test the individual switching sections with a load and and DMM to see if they are functional. The next would be to test PWM. Once you have that working then start testing the motor. It would be good to have a scope attached to all phases of the motor to see if the commutation is correct. \$\endgroup\$
    – Voltage Spike
    Commented May 20 at 17:54
  • \$\begingroup\$ Since VCC is 30 V you have probably destroyed all three TC4427 because their absolute limit is 22 V. \$\endgroup\$
    – Jens
    Commented May 20 at 18:16
  • \$\begingroup\$ examine the Q2 symbol closely ... what do you see? \$\endgroup\$
    – jsotola
    Commented May 20 at 19:08
  • \$\begingroup\$ Thanks for you answers. - Q2 was indeed wrong on the schema, but I think I did it right on the breadboard. - I use VCC at 12V to prevent from over-voltage issues - I've tried to debug with replacing the motor with leds, but behaviour is not easy to debug. When using an oscilloscope, I feel like it changes some voltage and the mesurement are false... Any idea? \$\endgroup\$ Commented May 20 at 19:21

1 Answer 1

0
\$\begingroup\$

Your IRF5305 p-channel MOSFETs are backwards so they always conduct through the body diode.

So whenever any of the three n-channel MOSFETs turns on, the power supply is shorted.

\$\endgroup\$
2
  • \$\begingroup\$ Thanks for your answer! Indeed the schema was incorrect, but I did "fixed" it on breadboard. The VCC as Source for IRF5305, and GND as Source for IRFZ44N. Any idea of other potential issues? \$\endgroup\$ Commented May 20 at 19:19
  • \$\begingroup\$ At 30V Vcc you are exceeding the absolute maximum rating of the gate driver chips and both types of MOSFETs (all 9 parts). I didn't look at your code at all, but if you've not verified the output signals on an oscilloscope there's a good chance it's got issues too. \$\endgroup\$ Commented May 20 at 21:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.