9
votes
Accepted
How to deep sleep ATtiny/ATmega (to run for years with batteries) but still detect a button press?
ATTINY's are designed to easily do this since they can wake from power down sleep mode by a pin change...
Basically you want to...
Connect a normally-open push button between an IO pin and ground.
...
8
votes
How to generate hardware interrupt in mpu6050 to wakeup arduino from SLEEP_MODE_PWR_DOWN mode?
Well, this code worked. In this code, MPU's INT PIN is Active Low so generates Ground on motion which is than connected to INT0 or arduino UNO pin 2 which generates interrupt and wakes UP the MCU
#...
6
votes
Accepted
Converting a standard setup/loop sketch to a low power application?
This sketch is almost identical to the powerDownWakeExternalInterrupt.ino sketch that comes with the LowPower Library. I'm using INPUT_PULLUP and a N.O. push button switch to trigger it to wake up and ...
5
votes
Accepted
Attiny85 appears to be drawing 0.2mA current but battery running down more quickly
2.9V doesn't sound too bad. See a datasheet for the CR2032 I found:
It looks like slightly more than 2.9V would be the expected voltage for up to 600 hours.
3.2V looks like it is fully charged, and ...
5
votes
Accepted
Arduino Nano Atmega328P not sleeping with either <LowPower> or <avt/sleep.h>
I don't know about the LowPower library. However, four your
avr-libc-based test, you forgot to actually put the device in sleep
mode with sleep_mode():
void loop() {
set_sleep_mode(...
5
votes
ESP8266 RTC memory (for bootcount)
The ESP8266 RTC has 512 bytes of RAM that persist across restarts but not during power outages. While this RAM isn't persistent across power outages it also doesn't have the write limitations that ...
5
votes
Accepted
ESP32 can not deep sleep longer than 35 minutes
So, formalizing this into an answer:
long DEEP_SLEEP_TIME_SEC = 43200;
// ...
esp_sleep_enable_timer_wakeup(1000000L * DEEP_SLEEP_TIME_SEC);
This is attempting to calculate the result of 1000000L * ...
4
votes
Accepted
Waking Arduino from sleep by holding button for more than 3 seconds
You won't manage it without external circuitry.
The problem is the Arduino has to be awake to know you held the button for 3 seconds. You can only wake immediately you press the button. However you ...
4
votes
Accepted
Use lowpower-libary and still use serial connection and other things
Yes, activating low power does disable the UART - but only while it's sleeping.
To use serial you just need to ensure that you only use it while it's not sleeping - and due to the interrupt and ...
4
votes
Accepted
ESP.deepSleep() - over and over?
Use a resistor between GPIO16 and RST. I usually use a 470 Ohm resistor. Shorting the pins with a wire does not work.
https://www.esp8266.com/viewtopic.php?t=14350#p64510
Maximum deep sleep is about ...
4
votes
Accepted
Is SRAM erased when putting Arduino into sleep_mode_pwr_down?
Generally, Atmega sleep modes do not erase RAM. Their memory is static and as long as voltage (above 2.7V I believe) is applied, data is held.
However, this also depends on how you plan to wake up ...
4
votes
Why does using ESP8266 in deep sleep mode still drain the battery quickly?
The example shows a Sparkfun Thing, which the article notes doesn't have extra peripherals. What you show is something different, like a NodeMCU dev board, which typically has a linear regulator, ...
4
votes
Store value in EEPROM to perform different actions on reset?
While it looks interesting as idea, IHMO you have keep in mind:
Include some code for button denouncing logic. Actually you will receive couple of “resets” during ~20ms during button press. Without ...
4
votes
How to deep sleep ATtiny/ATmega (to run for years with batteries) but still detect a button press?
First I was unable to make the intterupt work for multiple pins, but finally here is a working code:
#include <avr/interrupt.h>
#include <avr/sleep.h>
ISR(PCINT0_vect) {
if (digitalRead(...
4
votes
Accepted
Can Arduino go in and out of Sleep or Deep Sleep Automatically?
The Arduino goes into deep sleep when you tell it to. It wakes up when it gets an interrupt. What that interrupt is is (pretty much) up to you.
If you are using an RTC most will have an alarm function ...
4
votes
Accepted
Arduino Leonardo/Pro Micro sleep and USB
The Arduino has several sleep modes. They differ mainly by the clocks
that are kept running, the peripherals that are enabled, and the
possible wake-up sources. All these modes are described in the
...
3
votes
Accepted
Sleep power down mode with change interrupt
You actually don't need to to worry about interrupts at all for this
project. The IRremote library is itself based on a timer interrupt. As
soon as you irrecv.enableIRIn(), you start receiving a ...
3
votes
Accepted
Pin change interrupt does not work properly to wake up arduino from sleep mode
Start by checking your calculation of time limits. I see you are mixing signed and unsigned arithmetics - not a very good idea. Check the blink-without-delay example for how to do that.
The ...
3
votes
Accepted
Why can I wake Arduino only once with this code?
All your music playing code is inside a interrupt. While an interrupt is running all other interrupts are disabled. It's advised to keeps interrupt routines as short as possible.
You could have the ...
3
votes
Accepted
How ro re-enable 32u4 USB controller after sleep mode?
You're making it too hard on yourself.
There is a method to re-start the USB, but it only works if the USB has been properly stopped - and the method that is supposed to do that is empty.
This is a ...
3
votes
Waking Arduino from sleep with an ultrasonic sensor
In order to make the ultrasonic sensor work, the Arduino has to run some code to control it. So it won't do anything while the Arduino is asleep.
What you can do is have the Arduino sleep for some ...
3
votes
Accepted
Can't create a RTC_DATA_ATTR var inside a class
You can't put an RTC_DATA_ATTR qualified variable inside a class because the class is stored in normal RAM. The RTC_DATA_ATTR qualified variable is, by definition, stored in RTC RAM.
The definition ...
3
votes
How to keep track of millis during sleep mode
The only way to keep millis() running is sleep mode is to sleep in
SLEEP_MODE_IDLE. Switching to Timer 2 would make no difference, as
all timers but the watchdog are stopped in other sleep modes. The
...
3
votes
Accepted
WeMos D1 ESP-Wroom-02 Mother Board ESP8266 - where is reset pin for deep-sleep
This support page has the instructions for enabling deep sleep:
Support for WeMos D1 ESP-Wroom-02 Nodemcu
edit by Guy: in short, solder/connect pins as shown circled in red:
3
votes
Accepted
Knowing if ESP32 wakes up itself or manually
I think you're getting confused between the ESP32 and the ESP8266. There is no need to connect GPIO16 to reset on the ESP32.
Instead the ESP32 has the "ULP" - Ultra Low-power Processor in it ...
3
votes
Accepted
ATtiny85 won't wake from sleep
I believe your problem lies here:
PCMSK |= _BV(INT0); // Use INT0 (PB2) as interrupt pin
You seem to have mixed up two sorts of interrupts:
INT0 (External Interrupt), which only works on pin INT0 (...
2
votes
Is it possible to recover an Arduino if it does not wake up after putting it to sleep
Not sure what you mean by "using the watchdog to put it to sleep". You can sleep with or without the watchdog enabled, and you can even use the watchdog to both wake you with an interrupt and also ...
2
votes
Accepted
Send events to Azure IoT Hub combined with deep sleep mode
You need to call IoTHubClient_LL_DoWork until all messages are processed and only after that you can go to sleep.
Check the following code:
void IoTHubFullSendReceive()
{
IOTHUB_CLIENT_STATUS ...
2
votes
Pin change interrupt does not work properly to wake up arduino from sleep mode
Please help me to identify the problem.
it is always very easy to solve this type of problems, if you just follow some common sense.
1) decompose your functionality into manageable blocks. for ...
2
votes
PIR sensor and sleep (interrupt) on Mega2560
This is a problem with the Arduino Mega board. On the Mega, D2 is not INT0 as it is on the Uno. It's INT4. There's a footnote in the spec sheet that says only level interrupt is supported. That means ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
sleep × 169interrupt × 38
power × 33
esp8266 × 30
arduino-uno × 21
attiny × 18
esp32 × 15
atmega328 × 12
arduino-pro-mini × 12
serial × 7
arduino-nano × 7
nodemcu × 7
timers × 7
attiny85 × 7
arduino-mega × 6
battery × 6
rtc × 5
reset × 5
deep × 5
arduino-ide × 4
avr × 4
atmega32u4 × 4
sensors × 3
c++ × 3
usb × 3