Skip to main content
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 #...
bandejiya's user avatar
  • 307
7 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....
bigjosh's user avatar
  • 1,553
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 ...
VE7JRO's user avatar
  • 2,566
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 ...
Nick Gammon's user avatar
  • 38.2k
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(...
Edgar Bonet's user avatar
  • 43.1k
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 ...
romkey's user avatar
  • 1,554
4 votes
Accepted

How to sleep a whole circuit?

The first and most smart solution is to use a switch between the batteries and everything else. This way, you slide the switch in the off position and the whole circuit is completely detached from the ...
frarugi87's user avatar
  • 2,721
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 ...
Majenko's user avatar
  • 105k
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 ...
gdsports's user avatar
  • 181
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 ...
Majenko's user avatar
  • 105k
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 ...
mystery's user avatar
  • 321
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, ...
jose can u c's user avatar
  • 6,974
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 ...
Serge Ageyev's user avatar
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 ...
Majenko's user avatar
  • 105k
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 ...
Edgar Bonet's user avatar
  • 43.1k
3 votes
Accepted

WDT and RadioHead with delay()

The RH_ASK library uses timer0, which is also used for millis and delay. Quick workaround is to use the standard AVR delay instead. #include <util/delay.h> ... _delay_ms(500)
Gerben's user avatar
  • 11.3k
3 votes
Accepted

How to keep accurate millis() while using ADC_sleep mode?

Rather than trying to update TCNT0, it might be better to track the number of cycles lost to ADC conversions, and in an intermediate routine – eg, omillis() – compensate for those cycles. [Edit: See ...
James Waldby - jwpat7's user avatar
3 votes

Can I set pin 13 to output 5v, then put arduino mini pro to sleep?

Given the absence of clarity on the driving state of pins during sleep, consider connecting Pin 13 to an SR Latch or the gate of a MOSFET. An SR Latch will hold it's output high or low until a high ...
jose can u c's user avatar
  • 6,974
3 votes
Accepted

Can I set pin 13 to output 5v, then put arduino mini pro to sleep?

can a voltage be maintained on a pin for all/any of the sleep modes? yes.
dannyf's user avatar
  • 2,770
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 ...
Mikael Patel's user avatar
  • 7,969
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 ...
Edgar Bonet's user avatar
  • 43.1k
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 ...
Gerben's user avatar
  • 11.3k
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 ...
Majenko's user avatar
  • 105k
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 ...
Delta_G's user avatar
  • 3,270
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 ...
Majenko's user avatar
  • 105k
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 ...
Edgar Bonet's user avatar
  • 43.1k
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:
Kevin White's user avatar
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 ...
Majenko's user avatar
  • 105k
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 (...
Edgar Bonet's user avatar
  • 43.1k
3 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 * ...
timemage's user avatar
  • 5,231

Only top scored, non community-wiki answers of a minimum length are eligible