0
\$\begingroup\$

enter image description here

Here is my charger unit and voltage regulator for powering a MCU board that I designed. I'd like to ask, how can I add an on/off button which allow charging the batteries even we turn off the system but close the power for the other modules?

My idea was adding a button right after battery charger unit (Beginning of voltage regulator TPS7353). If my idea is true, should I directly connect the button or does it need a resistor?

I'd be so happy if you answer :)

\$\endgroup\$
  • \$\begingroup\$ A 'button' or a 'switch'? 'Button' usually means that the contact is closed only while it is pressed. A 'switch' will remain in position, on or off. \$\endgroup\$ – Transistor Jul 16 at 7:03
  • \$\begingroup\$ Regarding drawing schematics: If you flip IC3 horizontally, you can have the ground connections point downwards (as ground connections should do). \$\endgroup\$ – Huisman Jul 16 at 7:09
  • \$\begingroup\$ Thank you for your answer, I understand but do not know how exactly enable pin works. I did what you said, is that a true connection? In the link there is a screenshot of the connection. imge.to/i/LkbbO . I'm planning to use a switch push button, which let the power on/off when the user push on it. \$\endgroup\$ – Teoman Açıkgöz Jul 16 at 8:01
0
\$\begingroup\$

You can just use enable pin of IC3 to turn off the power to the MCU.

Driving the enable pin (EN) high turns on the regulator. Driving this pin low puts the regulator into shutdown mode.

The TPS735 only draws a quiescent current of 45 μA when it is not enabled.

So, add a switch between pins 4 and 6 of the TPS735 and add a 10k resistor and a 10nF or 100nF capacitor between pin 4 and ground.
The resistor will prevent pin 4 to float when the switch is open, the capacitor will prevent bouncing of the enable signal. enter image description here

\$\endgroup\$
  • \$\begingroup\$ Thank you for your answer, I understand but do not know how exactly enable pin works. I did what you said, is that a true connection? In the link there is a screenshot of the connection. imge.to/i/LkbbO \$\endgroup\$ – Teoman Açıkgöz Jul 16 at 7:42
  • \$\begingroup\$ @TeomanAçıkgöz Please find updated answer. The switch should be connected differently. \$\endgroup\$ – Huisman Jul 16 at 8:21
  • \$\begingroup\$ Do note the difference between button and switch as Transistor already pointed out. If you want a button solution, the circuit should be differently. \$\endgroup\$ – Huisman Jul 16 at 8:31
  • \$\begingroup\$ I actually want to use a button which the user press and power the system, when he/she is done with the system, he will shut it down by pressing the button again. So do I need a different circuit for this? Because I used the switch in the schematic temporarily. \$\endgroup\$ – Teoman Açıkgöz Jul 16 at 8:42
  • \$\begingroup\$ If you want a non-latching switch / momentatry switch, the circuit becomes a bit more complex. You need something to latch the enable signal. You could use a flipflop (D, T or JK, see Creating a simple toggle but you have to pay attention to the supply voltage. In your circuit this may range from 2.7V to 4.5V. So, a latching (toggle) switch would still be the easiest. \$\endgroup\$ – Huisman Jul 16 at 9:54
0
\$\begingroup\$

I had something like this come up in a job interview once. I thrashed around for a hardware-only answer (and I’m not so shabby in this area.) However, the solution they wanted to hear was have the MCU control the main power switch, and the button would ‘force’ the power on until the MCU would hold it on. They expected the user to hold the button until they got visual feedback that the device was ‘on’.

That was their shibboleth.

You see, I had become so used to (or should I say, worn down by) lazy, unimaginative and change-averse software people who would have been unwilling to deal with such a low level problem (or I would have had to push for it three levels up the food chain), that it didn’t occur to me that the host could do this.

I don’t work at that place anymore thankfully. And I didn’t get the job, either - but was able to go on a monthlong trek instead as I had enough vacation saved up. So, things worked out.

tl; dr version: button to power on, MCU GPIO to hold it on.

EDIT: A basic circuit uses 2 diodes, a FET and two GPIOs.

  • Diode D1 to switch and VREG enable (anode toward switch)
  • Diode D2 to MCU GPIO#1 and VREG enable (anode toward MCU)
  • N-FET Q1 switch to gate, drain to MCU GPIO#2, GND to source
  • pullup on FET drain to MCU power
  • pulldown on VREG enable
  • pulldown on SW

The way this works is as follows:

  • Power off, SW is open (initial power on): VREG enable pulled down
  • Power off, SW is closed: VREG enable pulled up to start up.
  • Powering up: MCU starts, takes GPIO#1 high, pulling VREG enable high through D2.
  • Powered on, SW is open: GPIO#1 keeps enable on through D1
  • Power on, SW is closed: Q1 turned on. Pulls GPIO #2 low. MCU begins shutdown, then takes GPIO #1 low to turn the power off.
  • Powering off: Power turns off when user releases SW1.

This is a very cheap way to do this. A compact way would use a Silego, powered by VBUS.

\$\endgroup\$
  • \$\begingroup\$ Thank you for your answer. So, I will place a button right before the LDO, then what should I do with GPIO pin? \$\endgroup\$ – Teoman Açıkgöz Jul 16 at 8:44
  • \$\begingroup\$ The solution I worked out was a combination of diodes and FETs to provide the feedback to and from the MCU, while blocking any leakage paths. A really compact solution would use logic powered by the input voltage. This company buys a lot Silego GPAK, which is how I’d solve this problem for a product. They even have parts with load switches in them. \$\endgroup\$ – hacktastical Jul 16 at 16:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.