NOTE the green wave in your 2nd scope picture.
In each tower it is switching on and off at half the tower height.
Not having your schematic, this leads me to think you are not at true GND with ref. to zero crossing or there is a wrong scope setting.
NOTE the spikes on both the leading and trailing edges of the pulses.
This looks like your load has both Capacitive and Inductive features to it.
OttoES suggestion of an external Schmitt trigger is probably a good idea however if your Zero Crossing is not true this may not work by itself.
A simple software work around is easy;
-
In the ISR
- 1 Detach the ISR
2 Take a time snapshot ISR_var = millis();
3 Store ISR_FIRED = true;
4 Process the rest of the isr
In main loop, an if(ISR_FIRED) checks when proper time has passed to re attach ISR and sets ISR_FIRED = false;
Code: Select all
if( ISR_FIRED )
{
if( ( millis() - ISR_var) >= SomePreSerTimeVar )
{
re-attach irq
ISR_FIRED = false;
}
}
This simple way stops the ISR from bouncing and waits a safe time to re-attach.
You only need to decide the time length to detach the ISR.
You probably need a time just wider than a normal pulse.
For the time shots; Remember Arduino can read milli seconds as well as micro seconds according to your circuit needs.
== Hope it Helps ==