Attach interrupt misbehave due to noise

In my project, a sensor reading is fed to pin 2 of arduino uno and tried to run a function using an interrupt. (attachInterrupt(digitalPinToInterrupt(2), PulseP_Event, RISING))

I think those small pulses trigger the interrupt functions.
What should I do to avoid such small noises?
Thanks in advance.

You can prove that the small noises are causing the issue.

You can add a filtering cap or to the Vcc line.

Thanks Idahowalker for your reply.
Yes I verified that the cause happen due to the noises.

How do I calculate the size of the cap ? where do I connect that?

Can you explain how you verified that the thingy is doing the thing?

I'd start with some standard filtering caps on the Vcc pins of the externally connected devices.

First I power the sensor using the external power supply and run the command. Then it run smoothly.

Then I power the sensor and the arduino using battery power, which is used to run the other components and circuits in my whole system. Then only it leads to this error.

Then the answer is to eliminate the noise at it's source, not where you are seeing it. Eliminate the noise source one at a time until you find is, then use caps or whatever is needed to suppress the noise at it;s source.

1 Like

Please post a link to the sensor, and post a wiring diagram.

Please show a circuit diagram. Battery voltage, connected how?
Most probably you need a stronger power supply. Use one scope channel for watching the 5V line.

Using a battery like this:

If you are using a 9V battery like this.


Expect short run times and many issues involving low power.

Inductive Proximity Sensor Switch NPN DC 6V-36V LJ12A3-4-Z/BX COM33 ,R14 - Faranux Electronics

instead of the 9v battery, I use the regulated voltage from a 60v battery

Thanks. Next, please post the wiring diagram.

dear jremington, above link, has both the wiring diagram and the sensor details

Post YOUR wiring diagram, in line.

The idiotic diagram in the link, showing a 9V PP3 battery, is obviously wrong.

In your next post, be sure to include links to the buck converters and "60v battery" that you claim to be using.

The diagram on the link has a voltage divider,
so it is for a PNP sensor, not for the NPN sensor you seem to have.

An NPN sensor only needs one resistor, from pin to VCC of the Arduino.
Use a relative low value if you use the sensor in an electrically dirty environment.
Start with 1k.
Leo..

Did you got solution to your problem ?
Please explain the solution ?

you are using resistor divider circuit to connect proximity sensor with interrupt pin ?
Is it safe way to connect?
you can think of connecting sensor with interrupt pin using optocoupler?

Please share circuit diagram how u are interfacing sensor with interrupt pin and how supply are used ?

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