i would like to know why my code running on the ATtiny85 1Mhz not wake up after the interrupt.
I use the ATTiny Core.

#include <avr/sleep.h>    // Sleep Modes https://goo.gl/Mm7wuk
#include <avr/power.h>    // Power management https://goo.gl/g6bHHz

#define interruptPin 2
#define ledDebugPin 4

// interrupt handling
void interrupt() {
  // do samething

// sleepMode
void sleepMode() {

  // Set sleepMode to the most aggressive
  set_sleep_mode (SLEEP_MODE_PWR_DOWN);

  // Turn off ADC
  // You must use the PRR after setting ADCSRA to zero,
  // otherwise the ADC is "frozen" in an active state.
  ADCSRA = 0;

  // Power Reduction Register (PRR)
  // This lets you "turn off" various things inside the processor.

  // diable all modules availables
  power_all_disable (); // power off ADC, Timer 0 and 1, serial interface

  sleep_enable ();       // ready to sleep
  sleep_cpu ();          // sleep

  sleep_disable ();      // precaution
  power_all_enable (); // power everything back on

void setup() {

  pinMode(interruptPin, INPUT_PULLUP);
  pinMode(ledDebugPin, OUTPUT);

  digitalWrite(ledDebugPin, HIGH);
  digitalWrite(ledDebugPin, LOW);

void loop() {
  // Set the interrupt
  attachInterrupt(digitalPinToInterrupt(interruptPin), interrupt, FALLING);

  // Go to sleep baby

  // Disable external pin interrupt on wake up pin.

  digitalWrite(ledDebugPin, HIGH);
  digitalWrite(ledDebugPin, LOW);


ATtiny datasheet 9.2: "Note that recognition of falling or rising edge interrupts on INT0 requires the presence of an I/O clock" .
During the SLEEP_MODE_PWR_DOWN we have not the I/O clock enabled. So only the interrupt pin INT0 can feel the edge, but not in the SLEEP_MODE_PWR_DOWN.

To wake up correctly the tiny85, change the attachInterrupt from FALLING to LOW.

Finally the tiny85 wake-up, but it doesn't see the edge, but only the change in the pins.
How can ignore the interrupt until the input CHANGE (or falling/rising) again, or better feel the edge?

Useful things (not solve the problem):
According to the Gemmon Example he puts the wake up at D4 ( not INT0 ) using the concept of "Pin Change Interrupt".

My old Example that uses PinChangeInterrupt library.

  • Please add info about which tiny-core you are using. Also check the pin numbering so that the right interrupt pin is used. – Mikael Patel Jan 2 at 13:52
  • The interrupt pin should be D0 which then maps to INT0. See highlowtech.org/?p=1695 – Mikael Patel Jan 2 at 13:58
  • @MikaelPatel post updated with your requests. "... But it doesn't see the edge, but only the change in the D4 pin." – MarkCalaway Jan 2 at 14:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.