Interference on an input

Hello I'm using a Leonardo clone and have digital inputs connected to pins 6,7,10,11 and 12.

Pin 7 is configured as an Interrupt. All inputs are setup as INPUT_PULLUP.

The inputs are wired to an alarm system with a 6v NiMh battery backup and an 12v ACDC 250 maH power supply.

The Problem

If the mains supply to the alarm is lost ( power failure, or turning off the switch on the wall socket), then this causes the interrupt to be triggered.

I have tried foil capacitors between +5v and GND - this does reduce noise however there are instances where the interrupt is still triggered.

Also, sometimes if it's not interference on the interrupt pin, then its on another input.

How can I resolve this ?

Thanks

Is the alarm output active-high or active-low? Is it open-collector or push-pull?

Is your ISR set to trigger on RISING, FALLING or CHANGE?

Alarm output is active high.

ISR is set to FALLING.

Apologies, how do I determine whether it's Open Collector or push pull?

   pinMode(7, INPUT_PULLUP);
   attachInterrupt(digitalPinToInterrupt(7), IRQcounter, FALLING);

Thank you.

If the ISR is FALLING, it cannot fail to trigger on power down. If the unit is active high, FALLING is
clearly the wrong mode to use isn't it?

Under normal circumstances, the Interrupt will react to Falling and interprets the number of falls..

On a power down of the mains, the alarm battery automatically takes over, so the interrupt should not be triggered at all. So I'm looking for a solution to prevent this from happening.

Please see the O-Scope reading.


| | | |
|| ||

allym:
Under normal circumstances, the Interrupt will react to Falling and interprets the number of falls..

On a power down of the mains, the alarm battery automatically takes over, so the interrupt should not be triggered at all. So I'm looking for a solution to prevent this from happening.

Please see the O-Scope reading.


| | | |
|| ||

The question to answer is "on power failure, how long does it take for the battery to take over?". Even a microsecond is too long and the Arduino interrupt will detect it.

Paul

Thanks Paul. The answer is I don’t know :frowning:

By observation, the alarm doesn’t lose power.

Is there anyway to resolve this?

allym:
Thanks Paul. The answer is I don’t know :frowning:

By observation, the alarm doesn’t lose power.

Is there anyway to resolve this?

Sure. Don't use interrupts. Monitor the pin in "loop()" and if you see it go low, save the millis() time and set a boolean to true to indicate the pin change happened. Then in your code, if the boolean is true see if the number of milliseconds that have elapsed is now greater than perhaps 500 and the pin is still low, then you know the power is really off and do something.

Probably other ways, but the solution is to test for something over a short period of time.

Paul

Hi,

What device does the interrupt monitor?
How long are the wires from the device to the Leonardo?

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?
Can you post a diagram of your project please, so we can see your component layout?

Thanks.. Tom... :slight_smile: