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.
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.
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.
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.
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.
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?
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.