I've been struggling with the following circuit which includes a Raspberry Pi:

enter image description here

That's a 5V voltage regulator (with protective capacitors), and a DC motor over on the right, and an IRF510 N-channel MOSFET toward the bottom.

The 9V supply is actually a plugged in 9V supply, so battery death isn't an issue.

The problem in some way is stemming from the presence of the Raspberry Pi.

A voltmeter is clamped and measuring voltage between A (output of the voltage regulator) and B (ground of the circuit)

This voltage normally sits at about 4.94 ~ 5 volts.

Now, I touch the two wires in the dashed box. This should simply kick the MOSFET over, allowing the motor to run. And it does that. Except there's a small hiccup. The voltage reading (A to B) drops momentarily to about 1.0V, the Raspberry Pi turns off, but then the voltage (A to B) comes back up, the Pi reboots, and the motor is running. I disconnect the wire and the motor stops. Everything is fine.

Replace the raspberry Pi in the picture with a regular resistor and the hiccup doesn't happen.

Now I would say that the most likely cause is some sudden spike in current is happening, overloading the voltage regulator's 1.5A rating. But I can't see what would be causing it. Measuring the current out the regulator when the Pi is idling gives only about 0.35 A. I can't see how touching the other parallel wire there would cause some surge in current.

Furthermore, everything works fine after the hiccup!

So I'd be extremely grateful for any clue as to what might be happening! Thanks for any advice!


Measuring the voltage across the power supply (where it comes INTO my breadboard)'s positive and negative terminal during the touching of the wires ALSO shows a drop from 8.98 V all the way to around 2V and then goes back up. Now I'm even less sure of what's going on!

And just to clarify - this is a AC to 9VDC converter plugged into a wall outlet; the wires go directly into the + and - rails of my breadboard.

  • 1
    \$\begingroup\$ When you say "voltage reading", which node are you measuring the voltage on? If you're reading the 7805 output, try also reading the input (battery voltage). \$\endgroup\$
    – The Photon
    Nov 22, 2012 at 6:04
  • \$\begingroup\$ A (output pin of the regulator) to B (circuit ground). I edited to clarify. \$\endgroup\$
    – cemulate
    Nov 22, 2012 at 6:06
  • \$\begingroup\$ Also, I edited the question with results from measuring across the supply \$\endgroup\$
    – cemulate
    Nov 22, 2012 at 6:09
  • \$\begingroup\$ It ALSO shows a drop from 9V to about 2 and then back up. \$\endgroup\$
    – cemulate
    Nov 22, 2012 at 6:14

3 Answers 3


Steps to diagnose / eliminate the problem:

  • Add a 10 μF, 6.3 Volts or higher capacitor in parallel with C2 from the 7805 output leg, as close as possible, to ground.
  • Add a 100 uF, 10 Volts or higher capacitor to the 9 volt input, to act as a buffer / reservoir capacitor.
  • Add a 100 Ω resistor on the line from the regulator to the MOSFET gate, and replace the pulldown resistor on the Gate with least 1 kOhms. This will reduce the current spike due to capacitance of the MOSFET gate - I believe this should not be the problem, but it is a simple and useful preventive step nevertheless.

If the above does not resolve the issue:

  • Use a separate 9 volt supply for the motor, your existing supply is unable to cope with the starting load (stall current >> operating current, usually) of the motor.
  • \$\begingroup\$ When doing your 3rd bullet point, (s)he'll also need to increase R2 (maybe to 1 kOhm? maybe 5 kOhms) to still get the gate voltage up to where it probably needs to be. \$\endgroup\$
    – The Photon
    Nov 22, 2012 at 6:29
  • \$\begingroup\$ @ThePhoton Oh oops! Yeah, missed that the pull-down is just 100 Ω. Editing answer now, thanks! \$\endgroup\$ Nov 22, 2012 at 6:34
  • \$\begingroup\$ Thanks for these tips; the issue probably stems from the fact that my power supply was rated for only 300 mA. Since the Pi by itself is drawing 350mA, the problem is pretty much explained. I'll keep these tips in mind though! \$\endgroup\$
    – cemulate
    Nov 22, 2012 at 7:01

Motors often (always? it's not really my thing) need much larger currents to start up than they need to keep running.

9 V batteries have fairly high internal resistance. Edit I just saw you are saying you aren't using a battery. In this case I'd say your supply probably doesn't have the juice to get the motor started. It could also be an issue with long wires and flaky breadboard connections, but just not enough juice is more likely.

So the motor (not the gate of the FET, which is what I think you were thinking) is drawing a large current to get started. This is pulling the 9 V supply output so low that the regulator goes out of regulation causing all the other symptoms you mentioned.

The simple solution is a higher amperage supply.

If the supply you have is just on the edge of providing enough current, you could try adding a big capacitor, say between the 9 V positive terminal and ground. The value will depend on the motor. The value might be 10 uF, 100 uF, or more. If values in the 100 - 500 uF range don't work, then you may need to consider more drastic circuit changes.

The only thing that isn't clear is why it doesn't happen with the uC removed.You might want to try that test again --- maybe you just didn't see the glitch because with no uC, there's no way to see that the uC is rebooting.

  • \$\begingroup\$ Thanks for your advice... the issue is most likely current starvation, as I just found out my power supply is rated for 300 mA. This is probably the entirety of the issue \$\endgroup\$
    – cemulate
    Nov 22, 2012 at 7:00
  • \$\begingroup\$ Great. That also explains why removing the uC changed the behavior. \$\endgroup\$
    – The Photon
    Nov 22, 2012 at 7:04

Well, upon further inspection, I looked at my power supply to find that it was rated for 0.3A. Since the Pi draw 0.35 on it's idle time, I can see how this could be a major problem. As soon as I can get another one I'll test again, betting the issue will be resolved.


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.