Arduino controlling a h-bridge with PWM at about 4kHz. Two digital outputs and one PWM output are used. The h-bridge is using NAND gates to prevent high-side and low-side to short circuit the power supply. The NAND gates also mix in the PWM-signal to the high-side FETs.
The h-bridge is running of 12V from an old PC-supply, and I use an extra 9V battery to drive the high-side FETs. I'm using one small FET for driving the high side FETs on each side.
On the oscilloscope you can se the voltage for the motor is switching from negative to positive, and how the pulse width is affecting the speed of the motor.
I designed the h-bridge using LTspice. The circuit consist of 10 resistors, 4 power MOSFETs, 2 small MOSFETs, 6 diodes, 8 NAND gates (Two 4011). For the 5V power to the 4011 I use a 7805 and two capasitors. The reason for the design is to not use P-Channel MOSFETs.
On the Arduino i used a 100kOhm pot connected to +5V, an analog input and GND. For schematics ,code and more info please visit http://www.lamja.com/