EEVblog Electronics Community Forum
Electronics => Projects, Designs, and Technical Stuff => Topic started by: nullwinder on January 06, 2021, 06:05:15 pm
-
Hello everyone,
I am new here, happy to meet you all.
I am working on a soon to be open source HW project. Some sort of retrofit for an automotive head unit. Currently I am working on the power supply.
I wanted to implement some variant of soft/latched power on/off functionality and have of course looked around in the web and also searched in this board. I couldn't find something that matches exactly my scenario but here is what I came up with so far and I wanted to get some feedback. In particular there is one aspect that bothers me (see below)
The constraints are as follows:
- The device is equipped with a rotary switch (permanent) that acts as the main switch. When it is turned off, there should be no way to power on the device.
- When this main switch is on, the device's uC might still decide to fully turn off the device (including the uC itself) and the device can stay in this state for days or weeks.
- The device can be reactivated by pressing another switch, a (momentary) push button, without touching the main switch, which is still in the "on" position
- When the device is initially turned on (switching on the main/rotary switch) it should directly power on, without requiring pressing the "wake-up button".
- Both switches pull to ground, I cannot change this
- It is totally fine to let the uC do the latching and self power off
I came up with the circuit below. I haven't tested this on a breadboard yet but simulated it in Spice where it behaves as expected.
[attachimg=1]
Principle is as follows:
- When the device is fully switched off, C1 is charged.
- When it is switched on via MAIN_SW_ROT, C1 is getting discharged via R1. So Q2 (and also Q1) is switched on for a short period only.
- Within this period the uc is powerd up and can latch the power-up via the uc_port (or not, depending on other parameters).
- With this port, the uc can also switch off itself again.
- The Wake-Up does not use Q2 but directly pulls down the gate of Q1, also creating a short power pulse (for the duration of the button press)
The only thing that bothers me is the conducting path via R3 when the MAIN_SW_ROT is in "on" position and I wonder if there is some modification to get rid of this. Of course, by selecting a high resistance, it won't do any harm but nevertheless I am curious if this can be optimized somehow.
Thanks a lot!
-
I'm not sure, but see if this would work. Notice that the gate drive of the N-channel has also been rearranged to remove the diode and eliminate the voltage divider you had.
-
Hi @Peabody, thanks for your suggestion! I am not sure if I fully understand how the cap is intended to work in this variant. Are you assuming that it is discharged initially (main switch open)? Or are you assuming that the uc_port is grounded?
Regarding the diode: The reason I put it there was to not have any restrictions on the uc_port and to prevent any discharge of the cap through the port or any conducting path through it. Do you think it is not needed?
-
I don't understand either. Well, anytime the power is on, the cap is discharged because the P-channel gate is grounded. Then if you open the ground switch, the cap stays discharged because there's no longer any current flow. Then you have a discharged capacitor with its top connected to the positive rail and its bottom not connected to any rail. Now you flip the switch and connect the bottom to ground suddenly. What happens? I don't know, but it might bring the gate low until the 100K resistor lets it charge up. But I don't really know.
I guess it's not going to work if you turn off the ground switch after the processor has powered down the system - because then the cap will be fully charged, and reconnecting ground won't change anything.
Do you really need it to turn on when you flip the main switch? People go to lots of trouble to prevent that kind of thing from happening.
The diode is needed in your circuit to protect the processor from the 12V. But it's not needed in mine because there's no 12V there.
-
Do you really need it to turn on when you flip the main switch? People go to lots of trouble to prevent that kind of thing from happening.
Yeah, I am afraid so. I am trying to match the original behavior a bit. It is kind of an classic car thing. The main switch is the volume knob that comes with the rotary switch. It also includes the momentary push button by pressing on the knob. Now when you turn on the device (with the volume knob) you expect that it powers up right away. When you turn of the engine (and remove the key) the radio turns of, but you can restart it by a push on the rotary switch (just short push, no turn, the switch is still in position).
In my retrofit, the ignition key signal is already wired up with the uc, so I can easily turn the device off with the uc, but not on again of course. I would rather ditch the "wake up" feature, than the instant on one, since the former one is much less frequently used.
-
Well I don't see a bttter solution than what you have already. If it really works with the 10Meg resistor, that's not much wasted current.
-
You could do what commercial head units do and power the MCU all the time.
There are a few micros that draw less current than your 10M resistor in sleep mode.