I am trying to make an H-bridge with two NPN and two PNP transistors to drive a motor which works fine on the 5 V Arduino. I have a schematic in the picture. When I use a simple code to have pin 9 HIGH and pin 8 LOW, the motor doesn't do anything. The transistor which I circled green is getting very hot. Is there something wrong with the schematic or code? Or is it my wiring?

I know people use diodes as well, but in my case the motor doesn't work, so the diodes aren't the problem.


This is my code:

     void setup() 

    pinMode(8, OUTPUT);
    pinMode(9, OUTPUT); 

    digitalWrite(9, HIGH);
    digitalWrite(8, LOW);
  • 1
    Could you give the transistors a number please? Do you use the Arduino 5v pin to power a motor? I hope not! You could use 4 pins and carefully write the code to avoid a shortcut. You could add two extra transistors to invert the signal. To turn on the motor you need to turn on the upper-left and the lower-right transistor. Or the upper-right and the lower-left.
    – Jot
    Aug 26, 2018 at 9:43
  • I used the 5V to power the circuit. I tried to turn on the motor by connecting the upper-right and lower-left transistor to the same pin on the arduino, it didn't work. I used 4 different pins now and it also didn't work.
    – jan
    Aug 26, 2018 at 10:04
  • 1
    Unlike an NPN, a PNP turn on when you pull it's base LOW. Aug 26, 2018 at 10:20
  • Thanks Edgar, I just found that out 10 minutes ago. So the bottum left en upper-left have to be connected to the same pins. Same for the right transistors.
    – jan
    Aug 26, 2018 at 10:25
  • I was wrong, the 4 pins are not needed and inverting the signal is not needed because you use 5v to power it. @smajli gave the right answer. Connect both on the left to a pin and connect both on the right to a pin, as his first picture shows. The arduino 5v pin can not supply a lot of current, you might run into troubles with that.
    – Jot
    Aug 26, 2018 at 15:56

1 Answer 1


There is a few possible scenarios to create a H-bridge:

  • with NPN transistors only or PNP
  • mix of PNP and NPN

You have to be careful to not mix the types and inputs. See pictures below: Mixed PNP and NPN

NPN only

  • 3
    Note that, while the Arduino boots, all its I/O pins but TX are configured as inputs, i.e. high impedance. In this situation, with the first schematic, all transistor will be on. Aug 26, 2018 at 16:38

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