Interrupt Frequency Problematic?

I'm part way through writing my program and would appreciate some advice so I can plan accordingly:

My Arduino Nano sleeps and then wakes from an interrupt when another device pulls a pin high. To wake the Nano I disconnected an LED pin on another device (output) and connected it to the interrupt pin on the Nano. When the LED on the other board would normally go high, it will wake the Nano and the Nano will turn on some peripheral outputs and keep them on for 30 seconds. So far so good.

However, the other device (which I cannot program or control) that wakes the Nano blinks the LED a number of times over a few seconds. I'm worried the first LED blinking will wake the Nano in interrupt mode as expected, but the Nano will be half way through it's routine (or finish it's routine and be asleep to save power) and additional LED blinks will cause the Nano to stop everything to run the ISR again.

Is there a way to set an interrupt but limit how often it can happen such as changing the interrupt pin to a normal input at the beginning of my ISR so additional rising edges don't have any effect and then change the pin back to an interrupt function at the end of the routine or when a watchdog timer overflows?

pin from a disconnected LED on another device so that when the LED would normally go high, it will wake the Nano.

Your ISR does nothing, so it can be invoked any number of times. You can disable that interrupt if you like, of course.

1 Like

Is the LED blinking by any chance the bootloader on the source processor ?

I can think of several ways around your problem, but you need to understand it first.

Slow down, analyse the problem and operating conditions. I’m sure you’ll identify a foolproof strategy to achieve what you want to achieve.

The very fact you can ‘see’ the blinking suggests it’s at a speed far slower than the target processor’s ability to detect it… using that, worst case, you can identify single, multiple or bursts of blinking and respond to that.
I don’t think it will be too complicated once you know what kind of animal you’re chasing.

1 Like

The other board that blinking the LED is a motion detection PIR board. It blinks LEDs to visually let the user know every time motion has occurred but it's a pretty slow sequence.... ~1 second ON, ~1 second OFF, repeated three times.

If I tell my Nano to run an ISR at first and then sleep for a certain period of time it's still unclear to me if it will wake up and try to begin another ISR on the second and third blinking, or if motion is detected 15 second after the first detection, the LED sequence will blink again and potentially cause issues. Seems like disabling the interrupt might be the best option?

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