Skip to main content
added 133 characters in body
Source Link
ocrdu
  • 9.3k
  • 23
  • 32
  • 42

When I start on phase 1 by PWMing LIN & HIN of U2 and send a HIGH signal to LIN of U1, then the circuit works perfectperfectly and only one LED lights up.

When I try to switch to phase 0 (after starting on phase 1) by PWMing LIN & HIN of U1, and send a HIGH signal to LIN of U2, then the MOSFET bridge suddenly shorts and breaks both of my IR2110IR2110 ICs.

BUT if I turn my DC power supply down to 0 voltsV, reset the Arduino to start on phase 1, and turn the DC power supply back up to 13V13 V then the other LED lights up without a problem. For some reason my MOSFETs are only shorting when I try to switch phases, if I start on either phase 1 or phase 0 then it works perfectly.

AnyoneFor some reason my MOSFETs are only shorting when I try to switch phases; if I start on either phase 1 or phase 0 then it works perfectly.

Does anyone know why this would happen? I am implementing 10us10 μs of dead time between switching phases so I don't think shoot through-through would be the problem.

byte preg = 2;
byte sec = 0;
byte pres = 0;

void setup() {
  pinMode(D7, OUTPUT);
  pinMode(D6, OUTPUT);
  pinMode(D12, OUTPUT);
  pinMode(D11, OUTPUT);
  digitalWrite(D7, LOW);
  digitalWrite(D6, LOW);
  digitalWrite(D12, LOW);
  digitalWrite(D11, LOW);
  // A5 is connect to a button so I can switch phases when 
  // pressing the button
  pinMode(A5, INPUT);
  // I have an LED attached to A0 to help me keep track of 
  // button presses
  pinMode(A0, OUTPUT);
  digitalWrite(A0, LOW);
 
}

void loop() {
  // This code is to debounce a button press when for switching 
  // phases
  sec = digitalRead(A5);
  if (sec == 0) {
    // Wait 1 second to check if button is still pressed
    delay(1000);
    sec = digitalRead(A5);
    if (sec == 0) {
      pres = digitalRead(A0);
      if (pres == 1) {
        // Set phase 0
        preg = 0;
      } else if (pres == 0) {
        // Set phase 1
        preg = 1;
      }
    }
  }
  
  // Switch to the new phase when button is pressed
  switch(preg) {
    // Phase 0
    case 0:
      digitalWrite(D7, LOW);
      digitalWrite(D6, LOW);
      digitalWrite(D12, LOW);
      digitalWrite(D11, LOW);
      digitalWrite(A0, LOW);
      delayMicroseconds(10);
      analogWrite(6, 100);
      for (int i = 0; i < 10000; i++) {
        phase0();
      }
        break;
    // Phase 1
    case 1:
    digitalWrite(D7, LOW);
    digitalWrite(D6, LOW);
    digitalWrite(D12, LOW);
    digitalWrite(D11, LOW);
    digitalWrite(A0, HIGH);
    delayMicroseconds(10);
    analogWrite(11, 100);
    for (int x = 0; x < 10000; x++) {
      phase1();
    }
      break;
  }
}

// PWM U1 LIN & HIN alternatively to charge C4 & C5
void phase0() {
  digitalWrite(11, HIGH);
  digitalWrite(12, LOW);
  delayMicroseconds(10);
  digitalWrite(11, LOW);
  digitalWrite(12, LOW);
  delayMicroseconds(1);
  digitalWrite(11, LOW);
  digitalWrite(12, HIGH);
  delayMicroseconds(150);
  digitalWrite(11, LOW);
  digitalWrite(12, LOW);
  delayMicroseconds(1);
}
// PWM U2 LIN & HIN alternatively to charge C2 & C3
void phase1() {
  digitalWrite(6, HIGH);
  digitalWrite(7, LOW);
  delayMicroseconds(10);
  digitalWrite(6, LOW);
  digitalWrite(7, LOW);
  delayMicroseconds(1);
  digitalWrite(6, LOW);
  digitalWrite(7, HIGH);
  delayMicroseconds(150);
  digitalWrite(6, LOW);
  digitalWrite(7, LOW);
  delayMicroseconds(1);
}

When I start on phase 1 by PWMing LIN & HIN of U2 and send a HIGH signal to LIN of U1, then the circuit works perfect and only one LED lights up.

When I try to switch to phase 0 (after starting on phase 1) by PWMing LIN & HIN of U1, and send a HIGH signal to LIN of U2, then the MOSFET bridge suddenly shorts and breaks both of my IR2110 ICs.

BUT if I turn my DC power supply down to 0 volts, reset the Arduino to start on phase 1, and turn the DC power supply back up to 13V then the other LED lights up without a problem. For some reason my MOSFETs are only shorting when I try to switch phases, if I start on either phase 1 or phase 0 then it works perfectly.

Anyone know why this would happen? I am implementing 10us of dead time between switching phases so I don't think shoot through would be the problem.

byte preg = 2;
byte sec = 0;
byte pres = 0;

void setup() {
  pinMode(D7, OUTPUT);
  pinMode(D6, OUTPUT);
  pinMode(D12, OUTPUT);
  pinMode(D11, OUTPUT);
  digitalWrite(D7, LOW);
  digitalWrite(D6, LOW);
  digitalWrite(D12, LOW);
  digitalWrite(D11, LOW);
  // A5 is connect to a button so I can switch phases when 
  // pressing the button
  pinMode(A5, INPUT);
  // I have an LED attached to A0 to help me keep track of 
  // button presses
  pinMode(A0, OUTPUT);
  digitalWrite(A0, LOW);
 
}

void loop() {
  // This code is to debounce a button press when for switching 
  // phases
  sec = digitalRead(A5);
  if (sec == 0) {
    // Wait 1 second to check if button is still pressed
    delay(1000);
    sec = digitalRead(A5);
    if (sec == 0) {
      pres = digitalRead(A0);
      if(pres == 1) {
        // Set phase 0
        preg = 0;
      } else if (pres == 0) {
        // Set phase 1
        preg = 1;
      }
    }
  }
  
  // Switch to the new phase when button is pressed
  switch(preg) {
    // Phase 0
    case 0:
      digitalWrite(D7, LOW);
      digitalWrite(D6, LOW);
      digitalWrite(D12, LOW);
      digitalWrite(D11, LOW);
      digitalWrite(A0, LOW);
      delayMicroseconds(10);
      analogWrite(6, 100);
      for(int i = 0; i < 10000; i++){
        phase0();
      }
        break;
    // Phase 1
    case 1:
    digitalWrite(D7, LOW);
    digitalWrite(D6, LOW);
    digitalWrite(D12, LOW);
    digitalWrite(D11, LOW);
    digitalWrite(A0, HIGH);
    delayMicroseconds(10);
    analogWrite(11, 100);
    for(int x = 0; x < 10000; x++){
      phase1();
    }
      break;
  }
}

// PWM U1 LIN & HIN alternatively to charge C4 & C5
void phase0() {
  digitalWrite(11, HIGH);
  digitalWrite(12, LOW);
  delayMicroseconds(10);
  digitalWrite(11, LOW);
  digitalWrite(12, LOW);
  delayMicroseconds(1);
  digitalWrite(11, LOW);
  digitalWrite(12, HIGH);
  delayMicroseconds(150);
  digitalWrite(11, LOW);
  digitalWrite(12, LOW);
  delayMicroseconds(1);
}
// PWM U2 LIN & HIN alternatively to charge C2 & C3
void phase1() {
  digitalWrite(6, HIGH);
  digitalWrite(7, LOW);
  delayMicroseconds(10);
  digitalWrite(6, LOW);
  digitalWrite(7, LOW);
  delayMicroseconds(1);
  digitalWrite(6, LOW);
  digitalWrite(7, HIGH);
  delayMicroseconds(150);
  digitalWrite(6, LOW);
  digitalWrite(7, LOW);
  delayMicroseconds(1);
}

When I start on phase 1 by PWMing LIN & HIN of U2 and send a HIGH signal to LIN of U1, then the circuit works perfectly and only one LED lights up.

When I try to switch to phase 0 (after starting on phase 1) by PWMing LIN & HIN of U1, and send a HIGH signal to LIN of U2, then the MOSFET bridge suddenly shorts and breaks both of my IR2110 ICs.

BUT if I turn my DC power supply down to 0 V, reset the Arduino to start on phase 1, and turn the DC power supply back up to 13 V then the other LED lights up without a problem.

For some reason my MOSFETs are only shorting when I try to switch phases; if I start on either phase 1 or phase 0 then it works perfectly.

Does anyone know why this would happen? I am implementing 10 μs of dead time between switching phases so I don't think shoot-through would be the problem.

byte preg = 2;
byte sec = 0;
byte pres = 0;

void setup() {
  pinMode(D7, OUTPUT);
  pinMode(D6, OUTPUT);
  pinMode(D12, OUTPUT);
  pinMode(D11, OUTPUT);
  digitalWrite(D7, LOW);
  digitalWrite(D6, LOW);
  digitalWrite(D12, LOW);
  digitalWrite(D11, LOW);
  // A5 is connect to a button so I can switch phases when 
  // pressing the button
  pinMode(A5, INPUT);
  // I have an LED attached to A0 to help me keep track of 
  // button presses
  pinMode(A0, OUTPUT);
  digitalWrite(A0, LOW);
}

void loop() {
  // This code is to debounce a button press when for switching 
  // phases
  sec = digitalRead(A5);
  if (sec == 0) {
    // Wait 1 second to check if button is still pressed
    delay(1000);
    sec = digitalRead(A5);
    if (sec == 0) {
      pres = digitalRead(A0);
      if (pres == 1) {
        // Set phase 0
        preg = 0;
      } else if (pres == 0) {
        // Set phase 1
        preg = 1;
      }
    }
  }
  
  // Switch to the new phase when button is pressed
  switch(preg) {
    // Phase 0
    case 0:
      digitalWrite(D7, LOW);
      digitalWrite(D6, LOW);
      digitalWrite(D12, LOW);
      digitalWrite(D11, LOW);
      digitalWrite(A0, LOW);
      delayMicroseconds(10);
      analogWrite(6, 100);
      for (int i = 0; i < 10000; i++) {
        phase0();
      }
        break;
    // Phase 1
    case 1:
    digitalWrite(D7, LOW);
    digitalWrite(D6, LOW);
    digitalWrite(D12, LOW);
    digitalWrite(D11, LOW);
    digitalWrite(A0, HIGH);
    delayMicroseconds(10);
    analogWrite(11, 100);
    for (int x = 0; x < 10000; x++) {
      phase1();
    }
      break;
  }
}

// PWM U1 LIN & HIN alternatively to charge C4 & C5
void phase0() {
  digitalWrite(11, HIGH);
  digitalWrite(12, LOW);
  delayMicroseconds(10);
  digitalWrite(11, LOW);
  digitalWrite(12, LOW);
  delayMicroseconds(1);
  digitalWrite(11, LOW);
  digitalWrite(12, HIGH);
  delayMicroseconds(150);
  digitalWrite(11, LOW);
  digitalWrite(12, LOW);
  delayMicroseconds(1);
}
// PWM U2 LIN & HIN alternatively to charge C2 & C3
void phase1() {
  digitalWrite(6, HIGH);
  digitalWrite(7, LOW);
  delayMicroseconds(10);
  digitalWrite(6, LOW);
  digitalWrite(7, LOW);
  delayMicroseconds(1);
  digitalWrite(6, LOW);
  digitalWrite(7, HIGH);
  delayMicroseconds(150);
  digitalWrite(6, LOW);
  digitalWrite(7, LOW);
  delayMicroseconds(1);
}
added 674 characters in body
Source Link
Trev347
  • 1.2k
  • 5
  • 20
int value = 100;
byte preg = 2;
byte sec = 0;
byte pres = 0;

void setup() {
  DDRBpinMode(D7, =OUTPUT);
 B11111111; pinMode(D6, OUTPUT);
  DDRDpinMode(D12, =OUTPUT);
 B11111110; pinMode(D11, OUTPUT);
  digitalWrite(D7, LOW);
  digitalWrite(D6, LOW);
  digitalWrite(D12, LOW);
  digitalWrite(D11, LOW);
  // A5 is connect to a button so I can switch phases when 
  // pressing the button
  pinMode(A5, INPUT);
  // I have an LED connectedattached to pin A0 to help me determinekeep track of 
  // button presses
  pinMode(A0, OUTPUT);
  digitalWrite(A0, LOW);
  pinMode(A5, INPUT);

}

void loop() {
  // This code is to debounce a button press when for switching 
  // phases
  sec = digitalRead(A5);
  if (sec == 0) {
    // Wait 1 second to check if button is still pressed
    delay(1000);
    sec = digitalRead(A5);
    if (sec == 0) {
      pres = digitalRead(A0);
      if(pres == 1) {
        // Set phase 0
        preg = 0;
      } else if (pres == 0) {
        // Set phase 1
        preg = 1;
      }
    }
  }
  
  // Switch to the new phase when button is pressed
  switch(preg) {
    // Phase 0
    case 0:
      PORTBdigitalWrite(D7, =LOW);
 B11000000;     digitalWrite(D6, LOW);
      PORTDdigitalWrite(D12, =LOW);
 B00000000;     digitalWrite(D11, LOW);
      digitalWrite(A0, LOW);
      delayMicroseconds(10);
      analogWrite(6, value100);
      for(int i = 0; i < 10000; i++){
        phase0();
      }
        break;
    // Phase 1
    case 1:
    PORTBdigitalWrite(D7, =LOW);
 B11000000;   digitalWrite(D6, LOW);
    PORTDdigitalWrite(D12, =LOW);
 B00000000;   digitalWrite(D11, LOW);
    digitalWrite(A0, HIGH);
    delayMicroseconds(10);
    analogWrite(11, value100);
    for(int x = 0; x < 10000; x++){
      phase1();
    }
      break;
  }
}

// PWM U1 LIN & HIN alternatively to charge C4 & C5
void phase0() {
  PORTBdigitalWrite(11, =HIGH);
 B11001000; digitalWrite(12, LOW);
  delayMicroseconds(10);
  PORTBdigitalWrite(11, =LOW);
 B11000000; digitalWrite(12, LOW);
  delayMicroseconds(1);
  PORTBdigitalWrite(11, =LOW);
 B11010000; digitalWrite(12, HIGH);
  delayMicroseconds(150);
  PORTBdigitalWrite(11, =LOW);
 B11000000; digitalWrite(12, LOW);
  delayMicroseconds(1);
}
// PWM U2 LIN & HIN alternatively to charge C2 & C3
void phase1() {
  PORTDdigitalWrite(6, =HIGH);
 B01000000; digitalWrite(7, LOW);
  delayMicroseconds(10);
  PORTDdigitalWrite(6, =LOW);
 B00000000; digitalWrite(7, LOW);
  delayMicroseconds(1);
  PORTDdigitalWrite(6, =LOW);
 B10000000; digitalWrite(7, HIGH);
  delayMicroseconds(150);
  PORTDdigitalWrite(6, =LOW);
 B00000000; digitalWrite(7, LOW);
  delayMicroseconds(1);
}
int value = 100;
byte preg = 2;
byte sec = 0;
byte pres = 0;

void setup() {
  DDRB = B11111111;
  DDRD = B11111110;
  // I have an LED connected to pin A0 to help me determine 
  // button presses
  pinMode(A0, OUTPUT);
  digitalWrite(A0, LOW);
  pinMode(A5, INPUT);

}

void loop() {
  // This code is to debounce a button press when for switching 
  // phases
  sec = digitalRead(A5);
  if (sec == 0) {
    // Wait 1 second to check if button is still pressed
    delay(1000);
    sec = digitalRead(A5);
    if (sec == 0) {
      pres = digitalRead(A0);
      if(pres == 1) {
        // Set phase 0
        preg = 0;
      } else if (pres == 0) {
        // Set phase 1
        preg = 1;
      }
    }
  }
  
  // Switch to the new phase when button is pressed
  switch(preg) {
    // Phase 0
    case 0:
      PORTB = B11000000;
      PORTD = B00000000;
      digitalWrite(A0, LOW);
      delayMicroseconds(10);
      analogWrite(6, value);
      for(int i = 0; i < 10000; i++){
        phase0();
      }
        break;
    // Phase 1
    case 1:
    PORTB = B11000000;
    PORTD = B00000000;
    digitalWrite(A0, HIGH);
    delayMicroseconds(10);
    analogWrite(11, value);
    for(int x = 0; x < 10000; x++){
      phase1();
    }
      break;
  }
}

// PWM U1 LIN & HIN alternatively to charge C4 & C5
void phase0() {
  PORTB = B11001000;
  delayMicroseconds(10);
  PORTB = B11000000;
  delayMicroseconds(1);
  PORTB = B11010000;
  delayMicroseconds(150);
  PORTB = B11000000;
  delayMicroseconds(1);
}
// PWM U2 LIN & HIN alternatively to charge C2 & C3
void phase1() {
  PORTD = B01000000;
  delayMicroseconds(10);
  PORTD = B00000000;
  delayMicroseconds(1);
  PORTD = B10000000;
  delayMicroseconds(150);
  PORTD = B00000000;
  delayMicroseconds(1);
}
byte preg = 2;
byte sec = 0;
byte pres = 0;

void setup() {
  pinMode(D7, OUTPUT);
  pinMode(D6, OUTPUT);
  pinMode(D12, OUTPUT);
  pinMode(D11, OUTPUT);
  digitalWrite(D7, LOW);
  digitalWrite(D6, LOW);
  digitalWrite(D12, LOW);
  digitalWrite(D11, LOW);
  // A5 is connect to a button so I can switch phases when 
  // pressing the button
  pinMode(A5, INPUT);
  // I have an LED attached to A0 to help me keep track of 
  // button presses
  pinMode(A0, OUTPUT);
  digitalWrite(A0, LOW);

}

void loop() {
  // This code is to debounce a button press when for switching 
  // phases
  sec = digitalRead(A5);
  if (sec == 0) {
    // Wait 1 second to check if button is still pressed
    delay(1000);
    sec = digitalRead(A5);
    if (sec == 0) {
      pres = digitalRead(A0);
      if(pres == 1) {
        // Set phase 0
        preg = 0;
      } else if (pres == 0) {
        // Set phase 1
        preg = 1;
      }
    }
  }
  
  // Switch to the new phase when button is pressed
  switch(preg) {
    // Phase 0
    case 0:
      digitalWrite(D7, LOW);
      digitalWrite(D6, LOW);
      digitalWrite(D12, LOW);
      digitalWrite(D11, LOW);
      digitalWrite(A0, LOW);
      delayMicroseconds(10);
      analogWrite(6, 100);
      for(int i = 0; i < 10000; i++){
        phase0();
      }
        break;
    // Phase 1
    case 1:
    digitalWrite(D7, LOW);
    digitalWrite(D6, LOW);
    digitalWrite(D12, LOW);
    digitalWrite(D11, LOW);
    digitalWrite(A0, HIGH);
    delayMicroseconds(10);
    analogWrite(11, 100);
    for(int x = 0; x < 10000; x++){
      phase1();
    }
      break;
  }
}

// PWM U1 LIN & HIN alternatively to charge C4 & C5
void phase0() {
  digitalWrite(11, HIGH);
  digitalWrite(12, LOW);
  delayMicroseconds(10);
  digitalWrite(11, LOW);
  digitalWrite(12, LOW);
  delayMicroseconds(1);
  digitalWrite(11, LOW);
  digitalWrite(12, HIGH);
  delayMicroseconds(150);
  digitalWrite(11, LOW);
  digitalWrite(12, LOW);
  delayMicroseconds(1);
}
// PWM U2 LIN & HIN alternatively to charge C2 & C3
void phase1() {
  digitalWrite(6, HIGH);
  digitalWrite(7, LOW);
  delayMicroseconds(10);
  digitalWrite(6, LOW);
  digitalWrite(7, LOW);
  delayMicroseconds(1);
  digitalWrite(6, LOW);
  digitalWrite(7, HIGH);
  delayMicroseconds(150);
  digitalWrite(6, LOW);
  digitalWrite(7, LOW);
  delayMicroseconds(1);
}
Source Link
Trev347
  • 1.2k
  • 5
  • 20

IR2110PBF only shorts when switching phases

Here is my circuit:

enter image description here

When I start on phase 1 by PWMing LIN & HIN of U2 and send a HIGH signal to LIN of U1, then the circuit works perfect and only one LED lights up.

When I try to switch to phase 0 (after starting on phase 1) by PWMing LIN & HIN of U1, and send a HIGH signal to LIN of U2, then the MOSFET bridge suddenly shorts and breaks both of my IR2110 ICs.

BUT if I turn my DC power supply down to 0 volts, reset the Arduino to start on phase 1, and turn the DC power supply back up to 13V then the other LED lights up without a problem. For some reason my MOSFETs are only shorting when I try to switch phases, if I start on either phase 1 or phase 0 then it works perfectly.

Anyone know why this would happen? I am implementing 10us of dead time between switching phases so I don't think shoot through would be the problem.

Here is the code I am running:

int value = 100;
byte preg = 2;
byte sec = 0;
byte pres = 0;

void setup() {
  DDRB = B11111111;
  DDRD = B11111110;
  // I have an LED connected to pin A0 to help me determine 
  // button presses
  pinMode(A0, OUTPUT);
  digitalWrite(A0, LOW);
  pinMode(A5, INPUT);

}

void loop() {
  // This code is to debounce a button press when for switching 
  // phases
  sec = digitalRead(A5);
  if (sec == 0) {
    // Wait 1 second to check if button is still pressed
    delay(1000);
    sec = digitalRead(A5);
    if (sec == 0) {
      pres = digitalRead(A0);
      if(pres == 1) {
        // Set phase 0
        preg = 0;
      } else if (pres == 0) {
        // Set phase 1
        preg = 1;
      }
    }
  }
  
  // Switch to the new phase when button is pressed
  switch(preg) {
    // Phase 0
    case 0:
      PORTB = B11000000;
      PORTD = B00000000;
      digitalWrite(A0, LOW);
      delayMicroseconds(10);
      analogWrite(6, value);
      for(int i = 0; i < 10000; i++){
        phase0();
      }
        break;
    // Phase 1
    case 1:
    PORTB = B11000000;
    PORTD = B00000000;
    digitalWrite(A0, HIGH);
    delayMicroseconds(10);
    analogWrite(11, value);
    for(int x = 0; x < 10000; x++){
      phase1();
    }
      break;
  }
}

// PWM U1 LIN & HIN alternatively to charge C4 & C5
void phase0() {
  PORTB = B11001000;
  delayMicroseconds(10);
  PORTB = B11000000;
  delayMicroseconds(1);
  PORTB = B11010000;
  delayMicroseconds(150);
  PORTB = B11000000;
  delayMicroseconds(1);
}
// PWM U2 LIN & HIN alternatively to charge C2 & C3
void phase1() {
  PORTD = B01000000;
  delayMicroseconds(10);
  PORTD = B00000000;
  delayMicroseconds(1);
  PORTD = B10000000;
  delayMicroseconds(150);
  PORTD = B00000000;
  delayMicroseconds(1);
}