User Tools

Site Tools


turning on an MCU with a momentary switch

courtesy of Andrew Kilpatrick

21:45 <@elmood> if the circuit doesn't need to be turned off by the switch, you can omit the two diodes

21:45 <@elmood> the theory of operation is this:

21:45 <@elmood> when the MCU is off, the switch powers up the system power rail

21:46 <@elmood> the MCU turns on and immediately raises the MCU_POWER_CTRL line to hold the power on

21:46 <@elmood> it can release it by itself to turn off

21:46 <@elmood> if you want to detect the switch when the MCU is on, you can monitor MCU_POWER_SW pin

21:46 <@elmood> the current draw should be pretty much zero when off

21:52 <greg81> waw thanks a lot andrew

21:53 <greg81> where is Vin of the MCU

21:53 <@elmood> SYSTEM_POWER

21:53 <@elmood> that's the switched rail

21:53 <@elmood> it would be almost the supply voltage

21:53 <@elmood> minus the drop from the fet

21:53 <greg81> Ok and +5V is the power rail

21:54 <@elmood> yeah

21:54 <@elmood> or whatever voltage you have

21:54 <@elmood> the values aren't critical

21:55 <greg81> is the P-FET some kind of OR GATE in a way, like one of the two top pins on the top has to see 5V in order to conduct? 21:55 <@elmood> no

21:55 <@elmood> it's a transistor

21:56 <@elmood> but one that is better for this use

21:56 <@elmood> image it like a voltage-controlled variable resistor

21:56 <@elmood> kinda

21:56 <greg81> i see

21:56 <@elmood> when off it's basically an open circuit

21:57 <@elmood> R1 holds the gate up so it's off

21:57 <@elmood> Q2 can turn it on

21:57 <@elmood> but when Q2 is off it's also out of the circuiot

21:58 <@elmood> so the draw is basically nothing

21:58 <greg81> what kind of P-FET can be Q1?

21:58 <greg81> do you have a ref in mind?

21:58 <@elmood> not really

21:58 <@elmood> something small

21:58 <@elmood> how much power does your circuit need?

21:59 <@elmood> look for a SOT23 P-channel MOSFET that has enough current for your curciot

21:59 <@elmood> leave some extra safety margin

21:59 <@elmood> the important spec of a MOSFET is the Rds on

21:59 <@elmood> which is the “resistance” when it's on

22:00 <@elmood> small fets are measured in ohms

22:00 <greg81>

22:00 <greg81> ?

22:00 <@elmood> that's quite expensive

22:00 <@elmood> i would get a smaller one, but that's the right idea

22:00 <greg81> 52cts?

22:01 <greg81> this one then, half the price

22:01 <@elmood> there you go

22:01 <@elmood> but this is N channel

22:01 <@elmood> you need P channel

22:02 <@elmood> wtf is this store anyway?

22:02 <@elmood>

22:02 <@elmood> here's one

22:02 <@elmood> 8 ohms at 170mA

22:03 <@elmood> not great

22:03 <@elmood> but maybe it doesn't matter to your circuit :)

22:03 <greg81> no it doesn't matter

22:03 <greg81> haha this store is based in niagara falls

22:03 <@elmood> ah

22:03 <@elmood>

22:03 <greg81> shipping is 3$

22:04 <@elmood> this one is better

turning_on_and_off_an_mcu_with_a_momentary_switch.txt · Last modified: 2018/04/05 17:17 by Gregory Perrin