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.
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.
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.
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);
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!
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.