H Bridge for DC Motor with Arduino Controlled Switching

I’m using an Arduino UNO Microcontroller to switch ON and OFF the appropriate transistors in an H-Bridge circuit. I’m trying to apply 12V to the motor in either direction for bidirectional control however, my H-Bridge currently only supplies around 4.5V (and -4.5V for the opposing direction) to the motor. I’ve checked all my connections and can’t find the issue. I’m using 4 TIP41B NPN transistors for my H-Bridge and 22 ohm resistors connecting the digital Arduino output pins to the base of each transistor. Please see the attached schematic. Additionally, I did connect the ground of the Arduino to the ground of the 12V supply rail on the breadboard I am using. Any suggestions would be greatly appreciated.

Here’s the image attached to the top post so others don’t have to download it.

1424d8e4c44917796a98e643e8bd0ca224f249d6.png

How to insert uploaded images.

My first guess is there’s a problem with using NPN transistors on both the high side of the motor and the low side of the motor. Most h-bridges I see using transistors have both NPN and PNP transistors.

I’m no transistor expert but I think you only want to use the NPN transistors on the low side of the motor.

I don’t see how the Arduino can turn the high side transistors on.

I suggest disconnecting the Arduino from the setup until you learn more. Based on the little I know about this sort of stuff, I think you are likely stressing the Arduino’s I/O pins.

I think the 4.5V you’re seeing is from the Arduino and not from the motor’s power supply.

Would you mind posting your code? I am curious as to which two Transistors you are switching in for each direction

Thank you for your responses! Using a DMM, I measured the voltage on the collector of the high side NPN transistors to ground and I’m getting ~12V. When I measure the voltage from the emitter of the high side NPN transistors to ground however, I’m getting roughly 4.5V which explains why I’m getting the 4.5V voltage drop accross the motor as opposed to the 12V im expecting.

I have seen designs online using NPN and PNP transistors with the PNP transistors at the high side. If I swap the NPN transistors I’m using on the high side for PNP, will applying 5V from the Arduino digital outputs to the base of the PNP turn it on?

Also my code is as follows:

void setup() {
// Setup pins for switching transistors on (connected to BASE)
pinMode(12, OUTPUT);
pinMode(11,OUTPUT);
pinMode(10,OUTPUT);
pinMode(9,OUTPUT);
}

void loop() {
// Write set of transistors high for CW/CCW rotation

// Rotate motor one way
digitalWrite(9, HIGH);
digitalWrite(10, HIGH);
digitalWrite(11, LOW);
digitalWrite(12, LOW);
delay(5000);

// Delay 1s
digitalWrite(9, LOW);
digitalWrite(10, LOW);
digitalWrite(11, LOW);
digitalWrite(12, LOW);
delay(1000);

// Rotate motor opposite way
digitalWrite(9, LOW);
digitalWrite(10, LOW);
digitalWrite(11, HIGH);
digitalWrite(12, HIGH);
delay(5000);

// Delay 1s
digitalWrite(9, LOW);
digitalWrite(10, LOW);
digitalWrite(11, LOW);
digitalWrite(12, LOW);
delay(1000);
}

As a quick update:

I looked into the use of a PNP however, a PNP (high side connected) will not turn on when a 5V signal is applied to its base. As a result, I will require a voltage greater than 13V to be applied to the base in order to switch the transistor on. Does anyone have any suggestions as to how I can solve this issue? I've tried everything and am desperate at this point. :/

anujent: I have seen designs online using NPN and PNP transistors with the PNP transistors at the high side. If I swap the NPN transistors I'm using on the high side for PNP, will applying 5V from the Arduino digital outputs to the base of the PNP turn it on?

You will not be able to turn off the PNPs because either 5v or 0v to the base will still forward bias the b-e junctions since the emitter is always at 12 volts. You could use an additional NPN transistor with each PNP to turn on the base via the collector with suitable resistors though. and dont forget this will invert the required switching signal.

yendis: You will not be able to turn off the PNPs because either 5v or 0v to the base will still forward bias the b-e junctions since the emitter is always at 12 volts. You could use an additional NPN transistor with each PNP to turn on the base via the collector with suitable resistors though. and dont forget this will invert the required switching signal.

Chris,

Thank you for your response! I'd just like to clarify some things to make sure I understand you correctly. So I would have high side PNP transistors with the emitters tied to 12V and the collectors tied to the motors inputs. Then if I use NPN transistors with the collector at 12V and the emitter at ground, I can use a 5V signal to apply 12V to the base via a resistor and turn the resulting PNP off. Similarly, if I apply a 0V signal, I can turn the PNP on. Is this correct?

A picture is worth…

H Bridge.JPG

Hi,
This is yendis circuit
45116698ab39d60c95b22b598cb4168f9b8a8906.jpg
It needs a resistor from the base of Q2 to the Vcc supply to make sure the base-emitter goes to zero when Q1 is OFF.
You do not need to invert any output control from the arduino,
as pulling the input R1 up to 5V will turn Q3 ON.
or
pulling the input R2 up to 5V will turn Q1 and hence Q2 ON.

Tom… :slight_smile:

Do not understand why you do not use a tried and proven circuit for a h bridge.
Plenty out there…

Here’s a 6volt one that was first up on a Google search.

H_bridge.jpg

TomGeorge:
Hi,
This is yendis circuit
45116698ab39d60c95b22b598cb4168f9b8a8906.jpg
It needs a resistor from the base of Q2 to the Vcc supply to make sure the base-emitter goes to zero when Q1 is OFF.
You do not need to invert any output control from the arduino,
as pulling the input R1 up to 5V will turn Q3 ON.
or
pulling the input R2 up to 5V will turn Q1 and hence Q2 ON.

Tom… :slight_smile:

Tom and yendis,

So in addition to that circuit, I should also have a resistor going from the base of the PNP to 12V. If I tie the inputs of Q1 and Q3 to the same digital pin, a 5V signal should cause Q1 to turn ON (and hence Q2 OFF) and Q3 to turn ON. In the same way, if the signal is 0V, Q1 should turn OFF (and hence Q2 turns ON) and Q3 will also turn OFF. Correct?

No, applying 5v to Q1 then turns on Q2, in which case you must turn off Q3 or you will blow something.

This is a very basic circuit, from which, perhaps you can learn from, however, as bluejets mentioned, the circuit he found is quite clever and easier to use from a programming point of view.

Don’t try to make your own H-bridge, just buy one and save time and $$$.