![power switch on off power switch on off](https://www.maketecheasier.com/assets/uploads/2017/04/windows10-power-plan-change-power-button-action-2.jpg)
You can use the preceding links or go directly to /tools to find all the parts for your projects at the best price! Resistors: 220K Ohm, 2x 100K Ohm, 10K Ohm, and 220 Ohm.Arduino UNO ( read best Arduino Starter Kits).ESP8266 NodeMCU ( read ESP8266 boards review).ESP32 Dev Board ( read ESP32 boards review).Microcontroller or Development Board, for example:.To follow this tutorial you need the following parts: However, there is always power consumption because your microcontroller is always being powered on (for an introduction to deep sleep with the ESP8266, you can read the following article: ESP8266 Deep Sleep with Arduino IDE). In deep sleep mode there is much less power consumption than the active mode. So, there is no power consumption when the microcontroller is not executing any task.
![power switch on off power switch on off](http://img.dxcdn.com/productimages/sku_256020_1.jpg)
The auto power off circuit cuts off the power completely. When the LATCH pin is set to LOW, the power is cut off.Set the LATCH pin to LOW, so the microcontroller auto powers off.
#POWER SWITCH ON OFF CODE#
You can modify the code to execute a useful task. In our example, it does nothing – it simply waits 10 seconds.
![power switch on off power switch on off](https://i.ebayimg.com/images/g/-I0AAOSwRq9dN6jr/s-l300.jpg)
You set the LATCH pin (set in the code) to HIGH to keep the circuit powered on.So, your ESP32, ESP8266 or Arduino turn on. When you press the circuit’s pushbutton or close the circuit using any other components, there is power driven to the microcontroller.