- #1
- 2,138
- 2,713
Here is my circuit for detecting zero crossing with Arduino (same circuit as this thread, but with the correction for the interrupt pin):
Once again, I am using
The interrupts are detected fine, and my Interrupt Service Routine (ISR) is also being called. Here is the graph plotted by the Arduino serial plotter:
On the left of the graph, you can see that most of the spikes are coming down to 0 from around 1023, which is very good and what I want. But to the right, you can see some spikes that do not come all the way down. These are marked with red arrows. There is a chance that these will not be considered as interrupt by the Arduino. Any idea why these spikes do not come down to 0?
Also, there are some green arrows in the graph. These arrows point to spikes that occur very close to another spike. These are unexpected. Fortunately these do not come all the way down, so most probably the Arduino won't consider these as interrupts. But why are these occurring, and how to avoid them?
Note that these anomalous spikes are not occurring all the time, but only sometimes.
Edit: Removed unnecessary images.
analogRead(A0)
as an oscilloscope.The interrupts are detected fine, and my Interrupt Service Routine (ISR) is also being called. Here is the graph plotted by the Arduino serial plotter:
On the left of the graph, you can see that most of the spikes are coming down to 0 from around 1023, which is very good and what I want. But to the right, you can see some spikes that do not come all the way down. These are marked with red arrows. There is a chance that these will not be considered as interrupt by the Arduino. Any idea why these spikes do not come down to 0?
Also, there are some green arrows in the graph. These arrows point to spikes that occur very close to another spike. These are unexpected. Fortunately these do not come all the way down, so most probably the Arduino won't consider these as interrupts. But why are these occurring, and how to avoid them?
Note that these anomalous spikes are not occurring all the time, but only sometimes.
Edit: Removed unnecessary images.
Last edited: