H-Bridge made of 4 transistors not working, please help.

Hello, I am a new arduino user. I discovered it with the arduino starter kit (including a Anrduino UNO, a integrated circuit H-bridge and of course a few transistors).

When I tried using a motorized grip withe the H-bridge, it didn’t seem to work. The grip was working, I checked at least tem times my wiring, my code was working, but the grip wasn’t oppening/closing.

So I assumed it was the H-bridge who was broken. I then decided to replicate a H-bridge with 4 transistors, and it is still not working. I checked my wiring. The grip’s motor runs on 12V max, but is perfectly working on 5V.

Below you can see my code and wiring (drawn quickly with gimp), please tell me what makes me look like an idiot.

const int buttonPin = 2;
const int ctrl1Pin = 3;
const int ctrl2Pin = 4;

int lastButtonValue = 0;
int buttonValue = 0;
int lastGripState = 0;
int gripState = 0;
//0=open, 1=closed

void setup() {
  pinMode(buttonPin, INPUT);
  pinMode(ctrl1Pin, OUTPUT);
  pinMode(ctrl2Pin, OUTPUT);
  analogWrite(ctrl1Pin, LOW);
  analogWrite(ctrl2Pin, LOW);
}

void loop() {
  buttonValue = analogRead(buttonPin);
  if (lastButtonValue==1 && buttonValue==0)
  {
    gripState = !gripState;
  }
  
  if (lastButtonValue==0 && buttonValue==1)
  {
    lastButtonValue = 1;
  }

  if (lastGripState != gripState)
  {
    //if grip was open
    if (gripState == 1)
    {
      analogWrite(ctrl1Pin, HIGH);
      delay(500);
      analogWrite(ctrl1Pin, LOW);
      lastGripState = 1;
    }
    if (gripState == 0)
    {
      analogWrite(ctrl2Pin, HIGH);
      delay(500);
      analogWrite(ctrl2Pin, LOW);
      lastGripState = 0;
    }
  }
}

EDIT: found the transistor’s datasheet. Reading it made me figure out I may have put the transistors the wrong way around. But after seeing the answers to the topic, I am afraid of trying again with the trasistors the good way around.
here is the sheet: http://www.farnell.com/datasheets/410427.pdf

Also, do anyone have a way of testing those transistors? I tried doing as in this video How to test transistors with ANY multimeter! - YouTube , but after trying with a transistor I didn’t use at all, it didn’t seem to work.

H-bridge arduino thingy.png

You have cooked the transistors.

You need a current limiting resistor before base each as shown here:

|500x332

Will try find a resource for you to read about transistor resistor selection...there are plenty of misleading ones on the net...I have found plenty of "general" rules that later contradict themselves.

Your high side drivers are emitter followers. Since the bases are connected with the bases of the low side drivers, the voltage can never exceed 0.7V. Thus the high side never turns on. Depending on how you drove the circuit, you may not have blown the transistors.

An H-bridge normally uses 2 npn transistors and 2 pnp transistors (as shown in Johnny010's schematic).

You have tried to use 4 npn transistors.

You can't connect the base of one of the 'upper' transistors to the base of one of the 'lower' transistors, as the two need to be at different voltages. In fact you can't take the bases of the upper transistors to a high enough voltage to turn the transistors on fully from the Arduino's output.

So many people design H-bridges with shoot-through - never do this, you must ensure one
switch is fully off before turning the other on in each half of the H-bridge, or you short the supply
out and cause all manner of problems.

This means you can never drive both high and low-side switches from the same signal, its always
bad news. (This is done all the time in logic gates where the switches have a few k ohms on-resistance,
but for power its never done as the current spikes can destroy the whole H-bridge).

What you can do is drive diagonally opposite devices from the same signal, and allow some dead-time
between driving one diagonal and the other. With bipolar transistors a few microseconds dead time
is likely to work, with MOSFETs it all depends on the gate drive level, could be 50us or 100ns…

Here’s my take on this (Note I’ve swapped over the top two drivers to bring each diagonal to one side).

As Aarg says, you are limited as to how high you can bring
the follower voltage up. The other post is correct about needing
a current limiter on the common emitter transistor.
Since the common emitter base is a diode, it will saturate at
about .7 volts. It will also draw more current that the output
of the arduino is intended to supply, possibly damaging the arduino.
If it wasn’t for the fact that motors draw a lot of current when
started from a stand still or reversed, the follower transistors
wouldn’t need a limiting resistor either. But since you are driving
a motor, they need some form of limit as well.
Dwight

I've used emitter-follower circuits for LEDs in the past as the current is a lot smaller and I need to drop a few volts anyway (and you can drive Charlieplexed arrays cleverly), but generally you don't use a follower for switching because the device dissipates much more heat (order of magnitude).

So, did I burn all of my transistors at the same time?

Sixela963: So, did I burn all of my transistors at the same time?

Have you read the answers to this post? It can not be said if you burned all your transistors or not, you will have to test them. What can be said is that you put them in danger.

Most multimeters have a transistor gain test thingy.

No idea what transistors you are using, but usually for 2n2222a and such, expect a value of aprox 300 hfe gain to be shown on the multimeter.

Whatever you do, don’t trust most of the H-bridge designs you find on the web.

I was curious to see just how bad the circuit example shown in reply #1 is, so I simulated half of it with the switch open, using LTSpice and assuming popular small transistors.

With the switch open, each half bridge conducts about 1.8 amperes straight into ground. The transistors would burn up immediately.

This could be a “worst prize” winner!