Just about all power switches in DIY electronic projects, such as Arduino, simply cut off the power source immediately when you turn it off. However, there are devices like 3D printers that when you push the power button to turn off, it does a few last tasks before the power actually cuts off. These tasks include running the motors to specific positions and writing a goodbye message on the display. How do these type of power down buttons/systems works? I don't know the exact name for these types of power buttons as well. If someone could explain what they are and how they work, that'd be greatly appreciated!
-
3\$\begingroup\$ The power button in such a cases does not cut off the power, but is sending a signal to the microprocessor to initiate shutdown sequence. \$\endgroup\$– Eugene Sh.Commented Mar 11, 2021 at 17:15
-
\$\begingroup\$ Is this shutdown sequence specific to certain models of microprocessors? Or can it be done with most ATMega uC models found in Arduino with external circuitry? \$\endgroup\$– AgriculexCommented Mar 11, 2021 at 17:19
-
\$\begingroup\$ Extending @EugeneSh. , think of it as your computer that is shutdown, still connected to electricity but not consuming power, most microprocessors can sleep consuming almost no power after finishing their job which in your case is homing the stepper motors \$\endgroup\$– asimCommented Mar 11, 2021 at 17:19
-
1\$\begingroup\$ It is not always necessary to consume idle power. The shutdown process can very well cut the power off completely in the end. \$\endgroup\$– Eugene Sh.Commented Mar 11, 2021 at 17:23
-
1\$\begingroup\$ @Agriculex I imagine that if you have Arduino project, then that is you who is writing the firmware. You might also need some hardware to support it though (such as firmware controlled power switch) \$\endgroup\$– Eugene Sh.Commented Mar 11, 2021 at 17:28
3 Answers
As others said, such a button that does not shut down a system (like a 3D printer), it is not a button that is connected to the main power of the system. It is connected to an microcontroller that senses the push of the button. Like this:
simulate this circuit – Schematic created using CircuitLab
SW1 switch is what you press. This is seen by an MCU (microcontroller) and the MCU turns the M1 mosfet off (by outputing 0V to the Q1 transistor) and the "System to be powered" turns off.
A "disadvantage" of this system is that your MCU needs always power to sense when you will press the SW1 to turn off the system, so a little bit of energy is wasted on that MCU.
-
\$\begingroup\$ The system i designed above is a rough schematic of how it all works. It is not accurate (for example M1 mosfet is a P-Mosfet, which means it has higher resistance, which means that if your system draws many amps (like a 3D printer) the FET will get really hot \$\endgroup\$ Commented Mar 11, 2021 at 20:35
-
1\$\begingroup\$ Okay. It makes a lot more sense now! Thank you! I figured that the use of sleep mode and interrupt pins during "off" mode can also help reduce the power consumption of the uC. \$\endgroup\$ Commented Mar 11, 2021 at 21:01
A power button as you described is not a power button. It is a button that triggers a set of code like any other normal button. It uses the same logic as any other button you include in a project. The microcontroller either polls or has an interrupt that checks for a change in the button and then follows the code you have programmed into your project.
For the most part the code tells things to stop doing anything or send specific commands then puts itself to sleep and the only other thing it should do is wait for another button press to start doing things again. Nothing special about a soft power button.
The power switch probably is marked with the On-Standby symbol, as opposed to the On-Off symbol. To the uC (micro-controller), it is just another input; there is nothing special that separates it from any other digital input. To the uC it is either a polled input or an interrupt. Either way, when the uC sees it change state, it jumps to a designated section of its programming and executes that routine or sub-routine.
I tried to keep the wording of that description as generic as possible, to reinforce that to the uC this is just another thing to do. In this case, the thing to do is turn off the power supply, or place it in a standby mode, or disable a power transistor between the power supply output and the rest of the system.
The reason the switch has a different symbol is because it does not completely turn off everything. Specifically, there still is some kind of connection between the power system and the control system, even if it is only microwatts. Something has to be awake enough to detect when the switch is pressed again, so it can power up the system. The switch marking is a warning to service persons that things still are alive inside.
This small amount of power is actually a big deal. With billions of such devices running across the country, those microwatts (or entire watts in many cases) add up to megawatts of wasted energy while stuff sits in the Standby mode.
-
1\$\begingroup\$ or because people thought that symbol looked better? I wouldn't read too much into the difference between on-off and on-standby symbols. I, for one, never knew such a distinction existed. \$\endgroup\$ Commented Mar 11, 2021 at 17:38
-
\$\begingroup\$ What - ? No. It is a VERY real thing. Correct labeling is mandatory for safety certification (UL, CSA, CE VDE, TUV, etc.) ( and maybe one MIL spec I can remember) everywhere in the world that has certs. No exceptions. Galvanic isolation is important to people who worry about things like death. The US has 5% of the world population and over 50% of the liability lawyers. \$\endgroup\$ Commented Mar 11, 2021 at 20:35