Power circuit redesigned!

When I integrated the TrinketPro into the bag movement alarm prototype project, the power circuit did not work.  So I needed to redesign the power circuit.

I had posted a question about this in the Arduino.cc forum, where forum user dlloyd had helpfully pointed me to an excellent explanation of using MOSFETs as power switches.  I found a very useful circuit diagram:

MOSFET based power switch

MOSFET based power switch

It uses two MOSFETs:  a P-channel MOSFET up top, and then an N-channel MOSFET at the bottom.  The EN is the pin by which you control the bottom MOSFET:  when it is high, you allow the N-channel MOSFET to open and pull the gate pin on the P-channel MOSFET to ground (it is normally pulled high to the VIN+ through resister R1), opening the P-channel MOSFET to connect the Load to the VIN+.

I set this up on another small breadboard, without a button, to test it out.  It worked, and was super stable (unlike before, where I had to adjust the pot periodically).  I used a 10k resistor for R1.

The new power circuit in all its glory:

New MOSFET power circuit

New MOSFET power circuit

New MOSFET power circuit close up

New MOSFET power circuit close up


6 thoughts on “Power circuit redesigned!

  1. This is pretty sweet. If you were going to reincorporate the push button, where would it fit into this? I’m trying to accomplish a scenario similar to the one you described in the Arduino forum, with a push button turning on the Uno, and shutting it down programmatically.

    • Daniel,

      Glad this is useful! When I reincorporated the push button, I put the push button connected between the +9V from the battery and the Vin pin of the Uno. This way, the push button essentially shorts out the transistor circuit.

      You can see that in the fritzing diagram I made here (the left transistor pairs): https://static.hackaday.io/images/5855561420316928695.jpg

      Which is part of a whole documentation of the project here on Hackaday.io:

      Hope that helps!

      • Micah, my mosfets finally came in today and I’ve had a chance to test this out. I guess I’m not crystal clear on what should happen. When I put them in, the LED comes on for several seconds and then goes off, repeat. With a momentary push button in place, it only powers up while the button is pressed down (let off, and everything shuts off).

        I started off with a set of P and N channel mosfests (very much like the N you started with in the arduino forum) and with those, the circuit does power up and stay on with the press of the momentary button. In either case though, the LED continues to light up and then go out in sequence. Please correct me if I’m wrong, but shouldn’t the LED light up for several seconds, go off and stay off? Any idea what I might be missing? As far as I can tell, everything is wired up exactly as you have yours. Sorry to pester you with newbie questions. Just starting out with this stuff, and naturally something tough like this lands in my lap. :/

      • Daniel,

        Are you referring to the LED on the Arduino? Or is this a different LED placed in the circuit?
        Have you attached a pin from the Arduino to the gate of the N-channel MOSFET? If so, have you included in your sketch that it puts that pin high as soon as it is powered up?

        My assumption is that you would have the LED light up and then stay on, until you decided to turn it off in the sketch. Perhaps we are trying to do different things tho – are you trying to have this as a power supply, where you press the button and the Arduino turns on, but pressing the button doesn’t turn it off (only the program can turn itself off)? Can you describe what you are trying to do?

      • Yes, I’m referring to the LED on the Arduino. Pin #7 is attached to the gate of the N-channel mosfet (at least, I think it is. I believe it’s wired exactly as shown above). I’m just trying to duplicate what you accomplished here, then I’ll expand on it from there. Currently, I’m using the code you listed on the Arduino forum, and I wired it up exactly as I see it above. The goal is to turn the Arduino on with a push button and then back off programmatically. As you know, putting it to sleep doesn’t solve the battery problem on the Uno, so I’m wanting to power the whole circuit down (I’ll work out the trigger event later). Thanks for the help. I’m sure you have better things to do. 🙂

      • Hmmm… are you are able to post a picture of the circuit?

        1) What transistors did you get? It may be helpful to check the pin layout for the transistors. If it only turns on when you press the button (i.e. the transistor can’t keep the Uno on) then it is likely that the transistors are the issue.

        2) Are you powering this from a battery, or do you have the USB (also) plugged in? If you have the USB plugged in, you will get the flashing LED behavior: your transistors don’t actually turn the circuit off, so the entire sketch runs instead of putting the OnOffPin to low turning things off.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s