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.
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.
Don't forget any load catch diodes, if your load is inductive like a motor. They come for free if you use FETs BTW.
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.