Interrupt get triggered without reason

Hi, guys!
I am having some curious things happening with my Arduino UNO int0 pin(D2) . Let me basically explain how is my circuit :
On pin D13 I have the output of a half wave rectifier (to rectify and adequate the signal within the Arduino pin limitations) connected to it. Through this pin(D3) I detect the presence or not of a signal(from mains - 60Hz and 127 Vrms) that is connected to the half wave input rectifier .
In order to put Arduino on power down mode I connect the D2 pin to ground through a push button(I am using pull up resistor on it) . In that moment I activate the arduino interruption( on D2 pin as well - int0) and put it to enter the power down mode . After the system is sleeping, when I connect again the D2 to ground by the same push button the microcontroller wakes up. Ok, until here all of it is working fine, without any problem.

Now the problem description:

When the system is already sleeping and I suddenly connect(this is the nature of my system, there is no way to change it) the cable to the half wave input (mains cable - in fact I use a button for this purpose) rectifier the interruption is triggered without apparently reason or connection of the D2 pin to ground. Therefore the system wakes up without connect the D2 pin to ground.

The tests I made to try solve it:

1 - Disconnect cable from D2(int0) input
Result: The problem goes away. When I connect and disconnect the mains from the rectifier input the problem do not come back. The interruption is not triggered.

2 - Connect only one side of the wire jumper on D2 input leaving the other side disconnected from the push button.

Result: The same thing happens , the problem persists.

3 - Disconnect the half wave rectifier output from the D13 pin.

Result: The same thing happens. Problem persists.

Before someone can question me: I already know about the particularities when connecting gnd Arduino directly to mains electrical system.


Interrupts are normally reserved for high speed events.

Are you using internal pullup (try external 1k) ?

Try a .1 µF capacitor on pin D2 to GND. (try a 220k across the capacitor)

A N.C. switch and interrupt on HIGH might be warranted.

Pin D13 can be a problem for input. It has an LED and resister connected to it which can cause problems. I would try using a different pin for input. This may not be your problem but it would be one less possibility if you use a different input pin.

Attaching the code would be helpful.

Your photo does not show any "sudden connection". If you are "suddenly connecting" the arduino to a mains ac voltage it may well cause transients that could be picked up by the D2 cable. Hence why with that removed the interrupt does not occur.

You may need to look at your grounding arrangement and perhaps screen the d2 cable.

Show a photo of your actual circuit.
You surely get a noise to your system.
Use stronger pull-up on D2 and/or a cap between D2 and Vcc.

Hi, Larry! Yes, I am using internal pull up resistor. I will try what you suggested and see what changes.

I will Let you know about it.
Thank you.

I already disconnected the built in led present on the Arduino board. Therefore I opened the circuit without change the pin. In fact all the tests were made with that configuration suggested. Thank you the same way.

Really my photo does not show the switch on half wave rectifier Input, my bad. I think the problem has really to do with the ground. But why does not It happen without connection on D2? My question is: If the ground were the real motivation the problem would still continuing to happen with cable or not connected to D2 pin?

Hi,
Looking at this circuit that you posted.

WHAT ARE;
R1
D1
R2
C2

What is the AC source V1?
Why are you using pin D13?
Have you tried changing to another I/O pin?

Lets see a proper documented circuit.
If you have changed your project circuit, PLEASE show us your new diagram in a NEW post.
Thanks.. Tom.. :smiley: :+1: :coffee: :australia:

Why?
There is no LED connected to pin13 on an Uno, only an op-amp buffer (that drives the LED).
Leo..

Without a cable there is no aerial to pick up the EM transient.

WHAT ARE;
R1
D1
R2
C2

What is the AC source V1?

"Really my photo does not show the switch on half wave rectifier Input, my bad."
So show it on a new photo?

.. and post your code?

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