sleep arduino pit

Go To Last Post
5 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Good afternoon,
I'm here as a difficulty and I'm not seeing how to solve.

The project can put the arduino to sleep and wake up at the keypad.

Now this part of the project I have for the arduino to sleep and wake up with the PIR sensor.
My sensor when it not detects this movement has 0.06v and 4.80v when it has detected.

Except that I can not wake up. Already exprimentei was seeing some things on google but did not get anything.
I leave a test program.
Thank you for attention.

#include 
#include  // lib para RF~

void setup()
{
    pinMode(13, OUTPUT);   
pinMode(2, INPUT);
digitalWrite(2, HIGH); 
 vw_set_tx_pin(3); // porta que vamos usar
 vw_setup(2000); // bits para comunicação
}

void loop(){ 
digitalWrite(13, HIGH);  
delay(3000);
  enterSleep();
}

void pin2Interrupt(){

}

void enterSleep()
{
  digitalWrite(13, LOW);
  attachInterrupt(0, pin2Interrupt, RISING);
  delay(50);
  set_sleep_mode(SLEEP_MODE_PWR_DOWN);  
  sleep_enable();                  
  ADCSRA &= ~(1 << ADEN);
 sleep_mode();   
 detachInterrupt(0);
 sleep_disable(); 
}
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I believe the problem is that, in PowerDown sleep mode, 'edge' interrupts will not work.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Which Arduino? Which chip is it using? Is PIN2 a suitable wake up source?

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Good morning,
I am using atmega8 with arduino duemilanove.
Another part of the project used this same code but with this line changed attachInterrupt (0, pin2Interrupt, LOW);
And here comes the arduino in sleep and wake up when I click the keypad. And use the INT0 pin.

attachInterrupt (0, pin2Interrupt, RISING); by what I saw on the net was to wake up when the status of the pin changes from LOW to HIGH.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Look on the data sheet, which events can awake from power down.
The RISING edge was not named to do so :!:

You may use the ATmega88 instead, which has pin change interrupts.

Peter