What's happening in my H-bridge? (N-ch MOSFETS)
There's nothing wrong with the H-bridge itself, assuming that it is wired correctly. The H bridge will work fine when driven properly.
N-channel MOSFETs begin conducting when the voltage between the gate and the source (called Vgs) exceeds the treshold voltage.

The problem with your circuit is that you aren't driving the MOSFETs properly.

The low side MOSFETs (Q2, Q4) have their sources connected to ground trough a low-value resistor, so supplying 5 V relative to ground will turn the MOSFET on.
The high side MOSFETs (Q1, Q3) are a bit different. As their sources aren't connected to ground directly, providing 5 V relative to ground doesn't necessarily cause the gate-to-source voltage to be 5 V, as the voltage at the source isn't necessarily 0 V.

The high side MOSFETs are unintentionally being driven as common drain (AKA source follower) amplifiers: When the gate is driven to 5V and the other side of the bridge is driven to ground, the MOSFET initially conducts. As the current increases, eventually the voltage at the source will start to rise so high that the gate-source voltage falls close to the treshold voltage of the MOSFET (somewhere between 1 V and 2 V), and the MOSFET starts to restrict current flow, eventually reaching an equilibrium. Thus the circuit reaches a state where the source sits at a voltage equal to the gate voltage(5V) - threshold voltage(between 1 V and 2 V), so 3.1 V makes a lot of sense. The MOSFET also dissipates a lot of power in this state.
To properly drive MOSFETs you need to supply a gate voltage that is significantly above the source voltage. Since the high side MOSFETs will bridge the 12 V supply at their drain to their source when fully on, their source will also stay at approx. 12 V. You need to supply a voltage relative to ground significantly larger than 12 V to the gate to fully turn a high side MOSFET on.
There are other issues with your approach.

You just cannot drive a MOSFET at reasonable switching loss at 100 kHz from a microcontroller IO pin. The usual IO drivers integrated to most microcontroller outputs can source or sink a few tens of milliamps or less. As the MOSFET you are using has a total gate charge of about 48 nC, switching the MOSFET on or off will take approx. 2.5 μs at 20 mA. Your poor MOSFET will be in a high power loss swithing state 2.5 μs * 2 switchings * 100 kHz = 0.5 seconds out of every second, or 50%.
While the MOSFET does have a fairly low threshold voltage, it is still better to drive the gate at higher amplitudes, with about 15 V being optimal. The switching transition will be faster and the on-state resistance (Rds_on) will be lower. You might even get away without a heatsink entirely.


Designing a good gate driver from discrete components is relatively difficult. While gate driving can be made easier by using P-channel MOSFETs for the high side, dedicated gate driver ICs are commonly available and in many ways a better option.

There are thousands to choose from. A few datasheets, for example: IR2110, LM5109A, MIC4604
EDIT: More details on gate driving.
A coloumb (C), the SI unit of electric charge, is simply current (A) multiplied by time (s). The Ampere-hour is another commonly used unit of charge. For example, charging a battery with one ampere for one hour would supply the battery with 3600 C, or 1 Ah.
The same is applicable for the paracitic capacitance of a MOSFET gate; if we know how many coloumbs are needed (48 nC) and how many amperes we can charge with (20 mA) we can calculate how long this takes (0.000000048C / 0.02mA = 0.0000024s) by simple division. This isn't the full story however. Total gate charge is only an approximation of the effort required from the gate driver, and unlike a capacitor the gate voltage rise or fall isn't even close to linear with time:

For more details on gate drivers, this application note on gate driving is reasonably understandable and fairly short.