1 button power on\off + UI button - Page 1
Forum section: electronics / beginners

author: ignislion
author_rank: Contributor
timestamp: April 09, 2019, 12:48:14 pm
content: I am in the process of making a very simple beginner project in a somewhat serious manner with own PCB, plexiglass cover, lion battery with charger etc. all fancy and shining ready-to-use device, no more breadboard+modules crap. Just for fun and practice.It is basically a bunch of sensors over atmega8 and display. Because you know everyone needs to know how many moisture you have in your air sometimes =)What I am interested to do is 1 button device. 1 click to power on, then clicks to switch what to display then hold on to power off. To make this I mix some tricks I already know with parts I own.The idea is when you press the button current goes to VCC through diode and powers on the controller which then pulls up MOSFET by PCON pin. then you can use the button to interact with SW pin by clicking. And if you press the button for a couple of seconds PCON goes low and power switches off.Well, my question is "am I doing it right?". Because for me as a beginner it seems a little too easy to work fine =)Thank you for your time!

author: ignislion
author_rank: Contributor
timestamp: April 09, 2019, 12:54:38 pm
content: Sorry I had to clarify +5V is a source of power VCC is just going to the controller and other stuff.

author: ignislion
author_rank: Contributor
timestamp: April 09, 2019, 12:55:48 pm
content: I swear there was someone's comment!

author: Ian.M
author_rank: Super Contributor
timestamp: April 09, 2019, 01:01:48 pm
content: That's not going to work unless you can drive PCON to about +7V when you want the BSH105 NMOSFET to stay on. Its typ. gate threshold voltage is 0.58V, and to get it turned hard on, the gate needs to be at least double the threshold voltage above the source, which is providing the MCU Vcc.I assume SW is meant to be an output going to a MCU input pin. The 100nF filtering cap needs to go to ground not +5V_in otherwise you risk blowing the input pin when +5V is first applied, before the button is pressed and the MCU is powered.

author: ignislion
author_rank: Contributor
timestamp: April 09, 2019, 01:27:45 pm
content: Oh, I see.So maybe use p-channel MOSFET?The capacitor is a sad mistake.

author: ignislion
author_rank: Contributor
timestamp: April 09, 2019, 01:34:35 pm
content: I even can get IRLML5203 -VGS ± 20 VVGS(th) -1.0 ––– -2.5 VID @ TA = 25°C -3.0RDS(on) 98mOhm VGS = -10V, ID = -3.0AIt looks fine for this usage. Or I cant see something?

author: AndyC_772
author_rank: Super Contributor
timestamp: April 09, 2019, 01:39:27 pm
content: Usually this kind of thing is done by leaving the microcontroller permanently powered, but in a very low power sleep state. Most have a mode in which they can either run from a slow internal clock, or are stopped entirely but can wake up on an interrupt (eg. from an input being switched).The trick then is to ensure that the rest of the circuit can also sit in a state where it draws essentially zero power. Switching the supply can be one way to do this, but it's not the only one.What's the power source, and how low does the current draw need to get?

author: ignislion
author_rank: Contributor
timestamp: April 09, 2019, 02:02:45 pm
content: The power source is one cell of 18650 Li-ion and some step-up circuitry. Being honest I am not sure how low I need to go. essentially I just trying to do my best and see. The rest of the components needs to be powered off in some way because it is sensors with heaters and 0.36" LED display so there is no way to control its power consumption internally. Maybe I can use a MOSFET to cut power off the periphery and switch data pins to HIgh-Z. I think I going to try this on the breadboard.

author: Ian.M
author_rank: Super Contributor
timestamp: April 09, 2019, 03:20:00 pm
content: Show us the proposed system lineup - at least a full block diagram + schematics of interesting bits like the boost converter that provides the +5V supply, and the power switching circuit.If you get the power switching wrong, it may appear to work, but actually leave a small load on the 5V rail when off. The result would be the boost converter would slowly drain the 18650 cell, which would be disastrous if its ever stored with low charge and the cell isn't protected by a low voltage cutoff.

author: ignislion
author_rank: Contributor
timestamp: April 12, 2019, 09:09:23 am
content: Sry for a delayed answer! Here is what I have for a moment:https://easyeda.com/ignisilion/weather

author: ignislion
author_rank: Contributor
timestamp: April 22, 2019, 09:43:27 pm
content: Well I havent done yet! =)First of all, I am very curious why I ever have seen only p-MOSFET, "positive side" power on schemes? N-mosfets have better performance and it seems to me that there is not so must difference on which side of load to operate.I kinda draw some schema and going to test it on weekend. Maybe you can say to me why I am wrong before I going to waste time.Another question is it ok to just connect external 5v power directly to the controller when the battery is charging?? Like in screenshot. I need to use LDO in between but overall is it OK to connect 5v after step-up? it has diode anyway so i thought it is going to work.Here is all the schema I have at the time:https://easyeda.com/ignisilion/weather

author: ignislion
author_rank: Contributor
timestamp: June 03, 2019, 04:38:51 pm
content: As for the power switching circuit here is on what I am stopped:

author: Zero999
author_rank: Super Contributor
timestamp: June 03, 2019, 04:53:35 pm
content: In order for an N-MOSFET to switch the positive side, its gate voltage needs to be above its source voltage, which is connected to the load. If there's no higher voltage in the circuit, then it would need to be generated using some kind of boost converter, which is costly and increases complexity. It's just cheaper to use a P-MOSFET or an N-MOSFET and switch the negative side.This sounds similar to another recent thread. Refer to the link below. It might be relevant.https://www.eevblog.com/forum/beginners/push-button-power-circuit-for-arduino-trying-to-modify-it-for-12v-input/

author: ignislion
author_rank: Contributor
timestamp: June 04, 2019, 08:05:12 pm
content: Sorry, my message was badly composed. The stuff with VGS +/- is understood. My question was why i have seen so much pchannel high side switches other than nchannel low side? Because n mosfets have better rds on. It looks like i canr see something more

author: rstofer
author_rank: Super Contributor
timestamp: June 04, 2019, 11:50:47 pm
content: Probably because we don't want any voltage drop when pulling to ground.

author: ignislion
author_rank: Contributor
timestamp: June 05, 2019, 07:17:29 am
content: That's a very good reason. Thank you!