interrupt input triggering unexpectedly (ARDUINO UNO)

hello,

so i’m working on dimming lighting project using arduino uno and had a weird behavior on the input interrupt of my push button.

so the dimming light is a classic one. i used an arduino output to drive the optocoplor/triac and i connected the zero crossing signal to the interrupt input pin2 . i also add a push button for manual operation in the interrupt input pin3.

see the attached file for the schema.

the project work well except some weird behavior on the input interrupt that’s triggering unexpectedly when i turn off or on the Electrical power strip which feed the triac circuit and lamp. when i turn it on or off it trigger the button interruption without touching the push button which is connectd to my arduino,

i even removed all the connection between the arduino and the triac circuit and let only the push button connected to the arduino and when i turn on the Electrical power strip of the triac circuit the push button interruption is triggered,

here’s a video demonstration of my problem that i made here : Arduino input interrupt triggering unexpectedly - YouTube

the only way to minimize this Phenomenon is to add a 100nF capacitor in parallel with the switch.
the switch input interrupt is configured with the internal pull-up resistor.

can anybody have a glue why this happen since i removed all physical connection between the TRIAC and the arduino ?
i saw a similar problem that was discussed in this forum but using arduino 2560 and i didn’t see any response to explain why http://forum.arduino.cc/index.php?topic=252430.0

thanks,

As you have high voltages around, and switching that, you may have a problem of electrical interference messing up your switch signal.

Try a stronger pull-up: 10k, 4.7k, maybe even 1k. The internal pull-up is pretty weak.

That said, you do not need an interrupt to read a button. Just poll for the button state. As all your Arduino has to do is operate a TRIAC it’s got plenty of time for it.

wvmarle:
As you have high voltages around, and switching that, you may have a problem of electrical interference messing up your switch signal.

Try a stronger pull-up: 10k, 4.7k, maybe even 1k. The internal pull-up is pretty weak.

That said, you do not need an interrupt to read a button. Just poll for the button state. As all your Arduino has to do is operate a TRIAC it's got plenty of time for it.

I just tried to separate the arduino from the TRIAC board about 2 meters away and the weird behavior persist.

i'll try with with the external 10k resistor and i'll see if it fixes the problem.

Two other things to try that have worked for me with similar problems.

  1. Try using a laptop running off battery. USB power from a computer plugged into mains power is noisy.

  2. Try swapping polarity on the switch. Use a pull-down and interrupt on rising or change.

hi,

so i add a 10k pull up resistor and the problem is reduced, before it was happening like 90% of the time now it happen 15% of the time.
i add the 100nF capacitor and the problem was resolved. it didn't happen again.

i replace the 10k by 1k and removed the capacitor and it seems to work perfectly even without the capacitor.

can you please tell me why the MCU internal pull up is weak and why its better to put the smallest pull up resistor ?

so i'm designing my board, should i put the pull up resistor + capacitor the closest possible to the ARDUINO MCU or to the push button ?

i want to mention something that we have an LED TV in the house that is too sensitive. when we open a fan or teleroptor the sound shut down and sometimes the image too. and it happen too when i open and close the TRIAC circuit. does this mean something ?

thanks,

It sounds like there's quite some electrical noise in your home.

All wires act as little antennas, and this noise tries to put a charge on the wire. The smaller the pull-up resistor, the easier that charge can flow away.

The 100 nF capacitor works in a different way: a capacitor resists the change in voltage, and that way prevents your pin voltage from dropping too low and triggering the interrupt.

This capacitor can also help in debouncing a button (though not with the 1k resistor): it basically filters the very short pulses from a bouncing button thanks to the RC delay from the combined 100 nF capacitor and the pull-up resistor.

Why your TV reacts so strongly to the other devices I don't know - maybe it's simply very sensitive by itself, maybe your power supply is weak. Switching devices will always cause short peaks or dips on the power lines.

All wires act as little antennas, and this noise tries to put a charge on the wire.

This is RF noise, or Radio Frequency noise. When you turn on something that uses a lot of current, it creates a spike, which creates a radio wave. The way to minimize this is to use shorter wires, or thicker wires, or twist them together. Or shield them.

There is also line noise. Based on your LED TV comment, I suspect this. Power supplies in computers are supposed to have circuitry that isolates the output power from the input power, but a lot of them suck at this. If you use sensitive sensors, you can often pick up the 50/60 Hz signal noise. Spikes might get through.

The solution to this is to use a better isolated power supply. I recommend battery power. That wouldn't be as easy for you since you're also using the computer as an output device. That's why I suggested using a laptop. I was serious. I know you blew it off, but there's a very good chance it would solve the problem.

The other possibility would be to disconnect the computer altogether and use battery power. And another form of output. You could simply blink the LED as a test.