# Building a voltage switcher for an h-bridge using bipolar transistors

I'm trying to build an h-bridge with bipolar transistors and I'm having a real hard time figuring out how to put together the input logic. I'm using an intel galileo to handle pwm control. The circuit is working with fixed inputs, but the real trouble here is switching between two voltages (27V and 0V) based on the digital output from the galileo (5V/0V). Here's the sketch: The right side of the bridge is fixed at 27V and I'm trying to set 0V as the voltage on the other side with that transistor. I've tried a lot of different ways to wire this and had no luck so far.

• I use four controller pins to drive a bridge, controlling all four quadrants independently. – jonk Sep 16 '16 at 8:35

You have multiple problems.

Q21 is the wrong way round to control Q1, assuming 5v control from the Gallileo
Q21 should not be controlling Q2, you need another transistor or
Q21/R34 is the wrong configuration to turn Q2 off, R34 will get 'overcome' by R28.

What you're trying to do is harder than it looks, which is why there are so many pre-packaged H bridge solutions out there.

Are you ...
a) trying to learn how to build H bridges or
b) trying to get something working to drive a load from your Gallileo

If (b), then I would strongly recommend you buy an H bridge driver, or a pair of half bridge drivers. Your attempt so far shows a deep misunderstanding of what's required.

If (a), then there are multiple ways to do it.

You can use BJTs, but FETs are somewhat easier to drive.

Consider the following for the left hand side of your circuit. Please note that this is a sketch for which at least the logic works, and the levels are plausible. The resistor values could use some adjustment, especially once the load and the transistor types have been defined. It would be suitable for static control of bidirectional power to a load. I've not looked at timing, shoot-through will almost certainly be a problem.

As you intend to PWM, then any excess shoot through will cause large losses, and should be fixed. The main switching transistors operate in saturation, and will need to be turned off hard to control timing. You may need to add speedup capacitors and diodes as well as adjusting resistor values to get a good result. If you don't know what I'm talking about here, and/or you don't have an oscilloscope to see what happens, then this really means you should buy rather than build, at least for something this complicated. Perhaps a better way to control shoot through is to duplicate Q21 as I mentioned in the 'things wrong with it', and control each output device independently. Then you can implement timing at the logic drive level to under-lap the power device conduction.

simulate this circuit – Schematic created using CircuitLab

I've used the same reference designators where applicable, and written them as 1xx where there are related to xx.

Resistors R128 and R129 now decrease the base drive to the output transistors, meaning they can turn off fully.

Q121 beefs up the +ve current output of R34, meaning it can turn Q2 off fully, even when loaded by R28. D1 is necessary to allow R34 to turn Q121 on. This is a fairly standard arrangement to get a low impedance drive in both directions.

• You asked, "If you intend to PWM?" And the OP is definitely planning to do that. He wrote, "I'm using an intel galileo to handle pwm control." – jonk Sep 16 '16 at 8:23
• @jonk well spotted, fixed. – Neil_UK Sep 16 '16 at 8:40
• One more detail that may be interesting. The Intel Galileo's I/O pins are HORRIBLY SLOW! See: drdobbs.com/embedded-systems/… where he talks about a 400MHz processor only managing about 250Hz I/O rates doing nothing else but toggling pins. Given that, you may not need to worry so much about speed ups. ;) – jonk Sep 16 '16 at 8:43
• @jonk I'll bet their pins are fast, if you program them at the bare metal. If you push an Arduino emulation through a non-realtime OS before it gets to the pins, then I'll have no troubling believing 250Hz at all. – Neil_UK Sep 16 '16 at 8:51
• No. I forget the exact reason, but it's actually a HARDWARE limitation. I believe they used a serial data path that was clocked slow between the 400MHz processor and the IO pins. Something like that, as I recall. I do remember that nothing could be done about it. It's not operating system stuff, as I recall the problem. A really stupid thing to do. – jonk Sep 16 '16 at 8:56