Last call to make your voice heard! Our 2022 Developer Survey closes in less than a week. Take survey.

Hot answers tagged

12 votes
Accepted

Put ATmega328 in very deep sleep and listen to serial?

A board we make does this. The RX pin is wired to INT0 INT0 pin set to input or input pullup depending on how the RX line is driven On sleep, INT0 low level interrupt is enabled //Clear software ...
user avatar
  • 2,886
10 votes
Accepted

How best to power down an Arduino for ~5 minutes at a time?

Yes, if you want to wake an ATMEGA (the chip in the Arduino) spontaneously (no outside trigger) from Power Down mode at periodic intervals, the you will need to rely on an interrupt generated by the ...
user avatar
  • 1,450
8 votes

Put ATmega328 in very deep sleep and listen to serial?

The code below achieves what you are asking: #include <avr/sleep.h> #include <avr/power.h> const byte AWAKE_LED = 8; const byte GREEN_LED = 9; const unsigned long WAIT_TIME = 5000; ISR (...
user avatar
  • 35.1k
7 votes

IR Receiver interrupt and arduino sleep mode

This is what I have managed to achieve ... Library IRLib - GitHub Version 1.51 March 2015 Copyright 2013-2015 by Chris Young http://tech.cyborg5.com/irlib/ This library is a major rewrite ...
user avatar
  • 35.1k
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....
user avatar
  • 1,450
6 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 #...
user avatar
  • 179
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 ...
user avatar
  • 2,471
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 ...
user avatar
  • 35.1k
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(...
user avatar
  • 35.5k
4 votes
Accepted

Power consumption issue. I made project using atmel-328p

You need to first check the individual current consumption of all elements: pH sensor, temp sensor, water flow sensor xbee. Since many of these just have an output pin in addition to +V & ...
user avatar
  • 8,809
4 votes
Accepted

error: ‘sleep’ was not declared in this scope

"sleep()" is not a function on arduino. The sleep.h file contains functions for the hardware sleep functionality used to reduce power consumption when processing isn't necessary. "delay()" is the ...
user avatar
  • 4,309
4 votes
Accepted

Sleep mode and months of operation on small battery

Have a read through the Jeelabs blog which documents the author's very successful attempt at making a very low power wireless sensor node that can run for months off coin cells. http://jeelabs.org ...
user avatar
  • 2,886
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 ...
user avatar
  • 2,658
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 ...
user avatar
  • 101k
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 ...
user avatar
  • 181
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 ...
user avatar
  • 320
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, ...
user avatar
  • 6,922
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 ...
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 ...
user avatar
  • 101k
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 ...
user avatar
  • 35.5k
3 votes
Accepted

Why does my Arduino keep waking up?

Yes. Arduino's buffered serial output is interrupt-based, in that it uses interrupts to refill the UART transmit register when it runs empty, until the software-managed transmit buffer has been ...
user avatar
3 votes

How to put arduino in sleep mode?

avr/sleep.h is part of the compiler. You don't need to download it. There are other libraries that act as a wrapper to it to make life easier: https://github.com/lowpowerlab/lowpower https://github....
user avatar
  • 101k
3 votes
Accepted

High power consumption during power down mode

I tried your first sketch on my "bare-bones" board. With the sketch exactly as written, it used 197 µA. I wondered why it was that high, so I commented out this line: Serial.begin(9600); That ...
user avatar
  • 35.1k
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 ...
user avatar
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)
user avatar
  • 11.1k
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 ...
user avatar
  • 6,922
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.
user avatar
  • 2,680
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 ...
user avatar
  • 7,811
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 ...
user avatar
  • 35.5k
3 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 ...
user avatar
  • 101k

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