Wake from low power mode with data as external interrupt

Hi everyone.
I’ve been working on a project that will go in the car and activate some relays using a 433 MHz remote transmitter. I can get everything working exactly how I want it to except when I try to implement low power modes to cut down on the battery drain when idle. I can get it in to low power mode just fine but I want it to wake again when it detects a button press from the transmitter. I’m using a Leonardo (Atmega32u4) D7/PE6 connected to the data out pin of a LR680R based receiver.
I’ve tried various low power modes but cannot get it to wake up again. If I add a push button as an external interrupt everything works as its supposed to but that defeats the purpose of having the remote.

I’ve included a test program I’ve written to try and get this working.

#include <LowPower.h>
#include <EnableInterrupt.h>
#include <RCSwitch.h>

#define RF_data 7
#define relay 1

RCSwitch receiver = RCSwitch();

unsigned long value;
unsigned long flashTimer;
unsigned long sleepTimer;
unsigned long sleepDelay = 10000;

void setup() {
  
  Serial.begin(9600);

  receiver.enableReceive(RF_data);
  pinMode(relay, OUTPUT);
}

void loop() {

  flashLED();

  if (millis() - sleepTimer > sleepDelay) {
    Serial.println("Entering Idle Mode");
    enableInterrupt(RF_data, wakeup, CHANGE);
    LowPower.powerDown(SLEEP_FOREVER, ADC_OFF, BOD_OFF);
    disableInterrupt(RF_data);
    sleepTimer = millis();
  }
}


void wakeup() {
}

void flashLED() {
  if (millis() - flashTimer > 200) {
    if (digitalRead(relay) == LOW) {
      digitalWrite(relay, HIGH);
    } else {
      digitalWrite(relay, LOW);
    }
    flashTimer = millis();
  }
}

What am i missing?

Thanks

spleen:
What am i missing?

From my experience, if the interrupt wakeup pulse was less than 2ms, my arduino would not wake up.
hope that helps...

Thanks Sherzaad. I had wondered if it was too fast. Do you have any suggestions for what I'm trying to achieve?

spleen:
Thanks Sherzaad. I had wondered if it was too fast. Do you have any suggestions for what I'm trying to achieve?

I have neither used RF transmitter/receiver modules nor the libraries so I am not sure how the receiving signals look like for a 'zero' or 'one'.

However a quick googling on this module and it looks like if you set the Tx data pin 'low'/'high' for 2ms for example, the rx arduino would see a 2ms pulse on its Rx data pin.

I guess if you can do that period PRIOR to actually sending the data you want to transmit, you might just be able to wakeup your arduino in time for it to receive the data.

hope that helps....

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.