IR Remote signal to interrupt sleep mode

Hi!
I was wondering how to use my IR Remote sensor as interrupt signal, to wake up arduino from sleep mode.
When I measured IR's voltage on signal pin, it has 5V normally, and then when signal comes it drops to ~4,8V. Is there any way to make it noticeable for arduino? IR sensor is connected to pin 7, and then to pin 2 (interrupt pin), so maybe I could put some electronics between it to increase voltage drop, when IR receives signal.

#include <IRremote.h>
#include <avr/sleep.h>

#define sleepPin 2
#define IR_RECEIVE_PIN 7
#define OFF_KEY 4244827904

void setup() {
  Serial.begin(9600);
  pinMode(sleepPin, INPUT);

  IrReceiver.begin(IR_RECEIVE_PIN, ENABLE_LED_FEEDBACK);

}
void GoSleep() {

  Serial.println("sleep");
  delay(1000);
  sleep_enable();
  attachInterrupt(digitalPinToInterrupt(sleepPin), wakeUp, CHANGE);
  set_sleep_mode(SLEEP_MODE_PWR_DOWN);
  sleep_cpu();

  Serial.println("wake");


}

void wakeUp() {
  sleep_disable();
  detachInterrupt(0);
}

void loop() {
  
  if (IrReceiver.decode()) {
    if (IrReceiver.decodedIRData.decodedRawData == OFF_KEY) {
      Serial.println("ir");
      delay(1000);
      GoSleep();
    }
    IrReceiver.resume();
  }
  
}

That's not correct. A signal is supposed to create a train of pulses that go near 0V. Are you just measuring with a DMM? Your receiver works with digital, not analog signals.

What happens when you try the posted code?

I don't think so. The output of most IR receivers is digital. If you try to measure it with a multimeter, you will probably get an average voltage of that digital signal, which is a meaningless voltage.

When data begins to arrive, you will probably get a falling edge in the digital signal from the receiver. That could be used to wake the Arduino. However, the IR library may not be able to read the command being sent because that first falling edge will not be detected by the library. Fortunately, many IR senders repeat the code they are sending several times, so the library would hopefully catch the repeat.

Some changes I would make:

Why use two pins?

// #define sleepPin 2
#define IR_RECEIVE_PIN 2

  pinMode(IR_RECEIVE_PIN, INPUT);

Use a LOW interrupt instead of CHANGE. I think that for waking up from sleep, only level interrupts (LOW or HIGH) work.
attachInterrupt(digitalPinToInterrupt(IR_RECEIVE_PIN), wakeUp, LOW);

detachInterrupt(digitalPinToInterrupt(IR_RECEIVE_PIN));

Most protocols have leading training pulses, the receiver can miss a few and it won't matter.

Hi John, I guess you read this in the atmega328 data sheet?

9.5 Power-down Mode
... Only ... an external level interrupt on INT0 or INT1, or a pin change interrupt can wake up the
MCU.

I think that is ambiguously worded, so I can understand why you interpreted it the way you have. But I think it was meant to say that it will wake on a pin change on any pin, including those 2, but only those 2 pins can also wake on a specific level of required.

In this case, it's a bit academic because the IR sensor's level is normally high so waking on LOW or a pin change will do the job. But I'm pretty sure it will wake on a change on those pins if required, not only on a level.

Hopefully some friendly expert can say which of our interpretations is correct!

Even if the Pin Change Interrupt for that pin is not enabled? The OP is using a External Interrupt, not a Pin Change Interrupt.

When I press OFF_KEY, arduino goes to sleep (prints "ir" and "sleep" in serial monitor ). And then when I try to to wake it up nothing happens

I am improving my project, which is already soldered. So I prefer put solder one more cable to resolder older ones.

No, it would have to be enabled. But I think that, if enabled, the chip will wake on a rising or falling edge of INT0/1, not only HIGH/LOW level.

IIRC Arduino Uno can wake up from sleep deeper than Idle only on pin change (any edge, you cannot choose which one) or LOW level (it cannot be HIGH). If level is used and it returns HIGH before Arduino wakes up (which may be long time with crystal clock) the processor wakes up but the ISR is not entered.

If you are using the Pin Change Interrupt (PCINT18 for Pin 2/PD2) you are not using the External Interrupt (INT0). PCINT18 will wake on either edge. The Arduino core does not provide support for Pin Change Interrupt so you would have to use direct register access to enable PCINT18 and you would need to provide an ISR for it.

Please look at the circuit on last page of this app note: