Software engineer dabbling in electronics. Based on previous feedback, here's a simplified discrete motor controller including part details.

This is an H-bridge with IRF9Z34N N-channel mosfets Q3 and Q4 and IRFZ44N P-channel MOSFETs Q1 and Q2.

GND, O1 and O2 come from a raspberry pi, only one of them can go high at once, with a dead time in between activations.

O1 pulls down the gate on Q3, which forms half the circuit around the motor and also pulls the gate down on Q1. So it acts both as switch and driver.

C should give about 500ms on/off smoothing, M draws 2.5A.

  • Do you spot any issues?

  • Does the design look okay?

  • 3
    \$\begingroup\$ Q1 and Q2 are always ON \$\endgroup\$
    – Tyassin
    Apr 22 at 20:31
  • \$\begingroup\$ I edited out the link that just refers right back to this page, and you edited it back in again. It still isn't right, but I'm not going to keep editing it for you if you just put it back. \$\endgroup\$ Apr 22 at 20:31
  • 1
    \$\begingroup\$ You have the lower part of the H, but the upper is always on Q1 & Q2. Odds are good Q1 or Q3 will fry when Q3 fires. Same for other side. \$\endgroup\$ Apr 22 at 21:28
  • \$\begingroup\$ @evildemonic Thanks! I think you mistook my rev3 for this page \$\endgroup\$
    – cmc
    Apr 23 at 4:57
  • \$\begingroup\$ No problem. You do, correctly, have your previous question linked here (710511). You also had a link to this one (710627) stuck in there at the end of the sentence. You can see it in the edit history, if you are interested. \$\endgroup\$ Apr 23 at 14:15

2 Answers 2


Q1 and Q2 are always on so motor will be off. And something fries when Q3 or Q4 is turned on.

If the drive signals come directly from Raspberry Pi GPIO, the 3.3V signals barely turn on the NFET.

  • \$\begingroup\$ Thanks!!! I was going to use 5V pins but other than that- thanks!!! I think I need a simulator. \$\endgroup\$
    – cmc
    Apr 23 at 4:57
  • \$\begingroup\$ @cmc Raspberry Pi devices do not have 5V GPIO. Please correct me if I am wrong. \$\endgroup\$
    – Justme
    Apr 23 at 5:50
  • \$\begingroup\$ That is correct- Raspberry has 5V power but only 3V GPIO. Will try to find small 3V MOSFETs. \$\endgroup\$
    – cmc
    Apr 23 at 9:02
  • \$\begingroup\$ @cmc I think you are trying to approach this from odd angle. If you want to drive big FETs with a MCU, why not use a FET driver? Or if you want to drive a motor, a ready made motor driver. \$\endgroup\$
    – Justme
    Apr 23 at 9:05
  • 1
    \$\begingroup\$ @Justme Thanks for your advice- that's for a future circuit- learning to build the H-bridge is just about learning to use discrete parts correctly. I'm just trying to say building the H-driver is a good way to build knowledge to both ask and build better later with the expensive circuit. I do need the H-bridge as well. \$\endgroup\$
    – cmc
    Apr 26 at 8:18

C should give about 500ms on/off smoothing

No such thing. C will just form a tank with motor's inductance and will oscillate, not smooth. You want a snubber to keep the motor turn-on and turn-off clean.

100mF is 0.1F - have you thought what happens when you hard-switch such a huge capacitor to the 12V rail? It is in parallel with the motor after all. It'd be equivalent to shorting the rails for a little bit. Bad news all around.

You misunderstood what Andy Aka meant when he said

If you are careful on how you activate and deactivate the two control lines (O1 and O2) you can use (for instance), Q3's drain to activate Q2 (when its position is remedied). Same for the other side of the H-bridge.

Well, you were not careful :) Here's a circuit that will work:


simulate this circuit – Schematic created using CircuitLab

Assumptions in the circuit model:

  • motor inductance is 15mH,
  • locked rotor current is 2.5A,
  • the rotor is locked.

To get a more accurate representation of reality, you should measure the locked rotor current and motor inductance, and modify the inductance and series resistance of L1 to match those. Locked rotor condition places the higher load on the driver than any other condition (other than possibly backdriving the motor), thus should be conservatively used in modeling to get maximum stress on the driver.

Note that when M3/M4 get turned off, there's some current flowing through the motor inductance. The diodes automatically turn on M1/M2 to neutralize motor current. If that's a problem, you'll want to control the top-side switches using a dedicated driver.

Here are the current and voltage waveforms as V1 and V2 get turned on for 10ms each:

enter image description here enter image description here

You'll have to convert the GPIO levels at least to 5V to drive the gates of M3 and M4. 3.3V GPIO from RPi is not enough.

The snubber resistor R3 should be rated 2W at least with the motor model as shown. The dissipation should be measured (using a current probe and differential voltage probe) in actual circuit, the peak power determined, and the resistor's power rating adjusted accordingly (!).

Do you spot any issues?

Your task is to control a motor. An easy task. You've turned that task into designing a motor driver. That's a hard task. I'd suggest you don't play in hard mode so early :)

Use a proper H-bridge driver chip that takes care of all those details. That's why those chips are so popular. It takes quite a bit of work to actually drive a motor in a reliable fashion (vs. the silly tutorial posts that show such discrete H-bridges with abandon, never mentioning that they didn't get them to work).

Yeah, there's a lot of online "tutorial" posts that show the discrete H-bridges not unlike what you started with. 99.9% of "authors" of those posts never put together a circuit more advanced than a light bulb, battery, and a switch in series - at least if we scrutinize the nonsense they put out.

  • \$\begingroup\$ I really appreciate your help. I totally agree that whether I'm just being unreasonable and stubborn is very much an open question. My reasoning is this: If I had more knowledge, making the driver would be easy, and I very much would like to have that knowledge. Maybe I'm doing it wrong, but I did try to source a 5A motor IC- but finding available ones in Germany isn't that easy either. But I do believe I learned I need to get that kicad simulator up and running before I post any more revisions. \$\endgroup\$
    – cmc
    Apr 23 at 4:56
  • \$\begingroup\$ :D and I made a synthesizer circuit in the middle, I always wanted to do that... \$\endgroup\$
    – cmc
    Apr 23 at 7:59
  • \$\begingroup\$ At least you can get an H-bridge controller. The controller does all the magic and protection, external mosfets do the actual switching. I’m far from discouraging you from learning and letting some smoke out of course! It’s a good way to learn. Wear glasses when playing with high power bridges. They sometimes explode with plastic shrapnel when things go wrong. Your corneas will be indebted to you for sparing them the experience. My reading glasses have a few battle scars :) \$\endgroup\$ Apr 23 at 16:20
  • \$\begingroup\$ @KubahasntforgottenMonica One issue I had, all ICs seem to be super hard to source here in Germany, or I dont know how. And if they're rated above 5A they get rather expensive and for sure have those tiny pins and also need a bunch of added components. \$\endgroup\$
    – cmc
    Apr 23 at 17:09
  • \$\begingroup\$ Thank you!!! rev 5 is up electronics.stackexchange.com/q/710996/8937 \$\endgroup\$
    – cmc
    Apr 25 at 19:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.