R
R
Roma Kotolup2022-02-15 21:55:08
Arduino
Roma Kotolup, 2022-02-15 21:55:08

How to turn off the arduino, and then turn it on with the button?

How to turn off the arduino, and then turn it on with the button? For example, I made a robot, it works, it works, then how to turn it off completely? And then turn it on by pressing a button?

Answer the question

In order to leave comments, you need to log in

6 answer(s)
P
pfg21, 2022-02-15
@pfg21

When the button is pressed, the microprocessor goes to sleep.
From sleep, it can only be awakened by an interruption by pressing the same button.

P
Philipp, 2022-02-15
@zoonman

You need to connect the button to one of the hardware interrupt pins (usually 2 or 3) and then configure the interrupt handler.
https://playground.arduino.cc/Learning/ArduinoSlee...

B
Borys Latysh, 2022-02-15
@nava2002

Here's a well-described solution.
Everything is quite detailed.

K
kalapanga, 2022-02-16
@kalapanga

Sleep, interruptions - is it about this in the question? There's "how to completely turn it off"!
Roma Kotolup , take a toggle switch or, if you prefer, a button with a fixation and power the arduino through it. Everything, the task is solved.

O
Ocelot, 2022-02-16
@Ocelot

Sleep has already been written about. If you need a complete shutdown - put a transistor in the power gap, start its control on one of the pins of the arduino, and parallel to this pin - a button without fixing.
We press the button, the transistor opens, the controller first of all picks up power management, after releasing the button, the transistor remains open. When you need to programmatically turn off, just turn off the pin.
If you need to monitor button presses in the on state, you need to untie it from the transistor through a diode and start the signal directly from the button to another pin.
620cc840390a7254469197.png

V
veydlin, 2022-02-16
@veydlin

I use such a solution in my boards, for high and low voltage.
620ccb54e922c055375294.png
620ccb89ea362887096980.png
After the button closes the contacts, power is supplied to the entire system and the MK must send a signal to POWER_RETENTION, so while the signal is energized,
PUSH_BUTTON always goes to the MK input, after turning it on it becomes with a regular button, you can program different functions for short clicks, multi-clicks, and then make it so that when you hold it for a long time, the device prepares to turn off the power and resets the POWER_RETENTION signal, thereby turning itself off

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question