Let's Make Robots!

H_Bridge Motor Driver or how to control my DC motors

Dear, Mates ! 

For less than ten days i suffer for second time trying to construct my own HBridge so probably i really need somebody helps me, please.

The last time i bought the set i thought everything whould be fine :

- 4 Transistors (2xIRF640 and 2xIRF9540n) and two resistors(8K,0.25) this should be the most basic things to build an HBridge ?  

I am not really sure as i've been 30 minutes ago, but the most important parameters i had to suppose was

 -For IRF640       VDSS 100 V  ID 22 A

 -For IRF9540N  VDSS -100 V  ID -22 A

( I chose them because i am expecting to turn a motor with 30V and 4A consumption. )

and VGS(th) for both transistors 2 to 4 Volts - perfect for my parallel port.

If you haven't corrected me yet please don't be ashame, but isn't VGS(th) the trigger and the Only requirement on Gate to turn transistors working ?



I don't know where do i make mistake so, please look at the diagram above.

As i see when in initial position OUT A and OUT B are 0V so PChannels are passing, but NChannels do not and as result noting happens.

If i set OUT A to 5V left PChannel stops passing, right P is passing and left N is passing so motor is working.

If i set OUT B, motors spins opossite.


If all this is fine with you i would like to ask if the problem is wrong pin mapping? Both P and N Channel Mosfets are Gate,Drain,Source oriented when look at in front (they have an equal mapping) 


Any help for how HBridge works would be highly appreciated ! 

The reason i need to know it is becouse i want to call myself one day a robot builder as you do !

Thank you again !

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.


Your Pch FET's will always be on because even when your out puts are high (5V) that is still 7 volts lower than the 12V supply. Your circuit will only work at 5V unless you add voltage translation circuitry.

So look at this device :


Can i use it to amplify the signal of 5 Volts to 12 ?

What if i apply 24 on Gate when Source is 12 ? Is this better ? 

But problem with resistance still exist.

I have to go for parts again i guess.

That Darlington IC won't ampify your voltage, but you can use it between the parallel port outputs and the gates to shift the voltage levels.

• Connect OUT A to one of the Darlington IC's inputs.
• Connect the COM of the Darlington IC to the supply voltage (12V, 24V, etc).
• Connect the matching Darlington IC output to the transistor's gates on one side of the H-bridge.
• Add a pull-up resistor between the gate and the supply.
• Repeat for the other side of the H-bridge.

When OUT A is off, the Darlington transistor is also off, so the pull-up resistor will raise the gate voltage to the supply. This will turn off Q1 and turn on Q2.
If OUT A gets switched on, the Darlington transistor will turn on, and pull the gate voltage down towards ground. This has the opposite effect, turning Q1 on and Q2 off.

You are The Best, Man ! 

I thank you ! I will try tomorrow. I hope to find the IC in the local market ! 

Cheers ! 

If you can't find that IC there are several other that are very similar, like the ULN2803 which is pretty popular.

You could also use 2 more N-Channel or NPN transistors, but I think you will find using something like the Darlington array ICs easier.

I found !

It is the same one.I stopped working because after seeing the motor spinning, stopping, changing velocity using the PCh my hands and all my body started shaking so i think to continue tomorrow.

I think i've got your idea. With pull ups. I don't know why do i need the IC cos not the IC itself amplify the voltage. The level stays the same as the input level. As you said.

Pull up is those who carry on to produce 12V to Gate. As OddBot said before i need at least 12 for 12 to Source.

There are not 8Ks anymore and 20K is in addition(The pull up). If you please tell me how to calculate this. I just add them and it was working.

BTW my mosfet started burning the tape i stuck before(just to remind me whats G,D,S) . I dont know is this normal. 12V 40W motor for 2 minutes of working.  


So happy i am ! 

Congrats pyros, good to hear you are making progress!

You need the Darlington IC to provide the voltage level switching - Darlington pulls the gates low, pull-up resistor pulls the gates high.

The important thing is that when the Darlington is off, it has no effect on the pull-up resistor, so the gate voltage can rise again. If you just connect the parallel port to the gate, then when the parallel port output is high (4.45V) it will 'fight' the pull-up resistor, and the actual gate voltage will be somewhere in between 4.45V and 12V, depending on the resistors you use.

You can calculate the pull-up resistance using the gate capacitance of the transistor, required gate voltage rise rate, etc. Normally for applications like this you can just take a guess though =)

Sounds like your transistors are getting a bit too hot, you should check what current is running through them when driving the motor, and make sure your gate voltages are working out.

Just to inform you !

For so long the bridge is working ! Both directions !

Just my motor doesn't care the polarity. 

I will update the diagram and i think to make my first video cos i get closer to my first robot ! ;). 


LetsMakeRobots.com rules with friends like you.


Nice work, I look forward to seeing the video =)