5
\$\begingroup\$

I have a 100Hz signal with a fast rising time and slower falling time. This is the output from a zero crossing detector. The signal is connect to an Arduino input pin. Arduino can generate an interrupt on signal RISING or FALLING edge. I tested them and both works well (apparently), but I wonder if there is a reason to choose one edge over the other.

This is the signal:

enter image description here

Edit

This is based in this circuit, which I need for one particular project (controlling a HID lamp):

Zero crossing detection

In my case the lamp is a 240V 250W HID with magnetic ballast (0.88 power factor) that flicker with SSR, so I must use an electromechanical relay, but with zero crossing. With this signal Arduino will wait for a right time to close the relay, minimizing arcing. It's not terrible important, as the relay only close once per day (you bet).

Suggestions are welcome.

A different approach

User @jonk suggested a different approach to my problem. While it serve best my needs, it's not an answer to my question and cannot be posted, nor accepted.

Anyway, jonk's approach doesn't deserve to be lost in the comments, so here it is:

The idea is to use a SSR and an electromechanical relay in parallel. The Arduino will switch on both the SSR (with built-in zero cross detection) and the relay (two pins) at the same time. The SSR will switch on inmediatly, powering the load. After some delay and a few cycles, Arduino will turn off the SSR. Then the relay, already closed, will take the load while the lamp is still being heat (and it will unaffected for any voltage mishap anyway).

Why it is best? I don't have to mess with mains. I don't have to adjust timings. I don't need an interrupt capable pin (Arduino only have two).

\$\endgroup\$
20
  • \$\begingroup\$ You might also consider improving the circuit to get sharper edges... Or are you stuck with it? Also, do you have any allowable phase-delay requirements or allowable variation in same? \$\endgroup\$
    – jonk
    Commented Oct 5, 2017 at 17:29
  • \$\begingroup\$ Surely a sharper edge is more robust. \$\endgroup\$
    – Eugene Sh.
    Commented Oct 5, 2017 at 17:31
  • 2
    \$\begingroup\$ I would take the edge that aligns with the AC zero crossing. However, it is unlikely that your mechanical relay will really operate fast enough to act as a zero-crossing relay. \$\endgroup\$ Commented Oct 5, 2017 at 17:43
  • 1
    \$\begingroup\$ @LookAlterno If you are serious about this, you will probably use a hydrid mechanism. A mechanical relay, bypassed by a triac or dual-SCR system. You can actually trigger the triac system fast! Then activate your relay and wait a suitable time for it to fully engage. Then stop activating the triac (or keep it activated, your choice.) A similar process is needed when releasing the relay. It's what I used, myself. Relay contacts are fully protected this way. And the triac has only a momentary pulse of power dissipation, so no heat sink needed. \$\endgroup\$
    – jonk
    Commented Oct 5, 2017 at 19:12
  • 1
    \$\begingroup\$ @WesleyLee I think your comment was appropriate. I'd love to see this site more organized, too! Perhaps a subset where good answers can be arranged, collected, etc. It's kind of a grab bag of sorts as it is, that's all. But I think your point is made well, too. I think mine is also appropriate. There is a huge gray area to discuss and you should feel free to say what you are thinking. I will, too. It's how this site stays on some kind of sense of a wandering track, I guess. \$\endgroup\$
    – jonk
    Commented Oct 5, 2017 at 19:48

4 Answers 4

10
\$\begingroup\$

Generally trigger on sharper edges when possible. That will result in less time uncertainty and therefore jitter. It also minimizes the time the digital input is held in the in-between region. Some digital inputs don't react well to being held there. They can oscillate and/or draw higher current.

When you have unavoidably slow edges, you need to use a Schmitt trigger input. Those have hysteresis built in, and are specifically designed to tolerate being held at in-between levels indefinitely.

\$\endgroup\$
1
  • \$\begingroup\$ Depending on which chip you're using, the inputs may have Schmitt triggers available on them (perhaps just called a 'hysteresis input' - although also check where such circuitry sits - if it's behind a CMOS input, then you may still suffer the 'between states vagaries'). It's also possible to have a 'software Schmitt trigger' on an analogue input if your edges are particularly sloping. \$\endgroup\$ Commented Oct 6, 2017 at 10:07
3
\$\begingroup\$

Your pulse has both edges awfully too slow for accurate and repeatable triggering of digital circuits. It's already commented that adding a schmitt trigger helps. I suggest it, too.

Your circuit has capacitors which cause phase lead, so your pulse is out of the time. Simulate or calculate how much time delay you need to get either of the edges (after the schmitt trigger) occur at the actual zero crossing. Take that into the account in your program.

\$\endgroup\$
2
\$\begingroup\$

Just like a scope, the most reliable trigger is the one that is stable. Since the logic input is voltage sensitive, around Vdd/2, the transition that the most stable is Turn off to LED or the Q1-C rise time. this is due to LED CTR wide range of linear and saturating variations.

Since you have no LPF for noise rejection, you may expect glitches to trigger interrupts.

This big problem with this design is the >10k impedance of the caps gives too low input pulse current. Change collector R from 4.7k to 100k Increase 0.1uF value or remove one from neutral side

\$\endgroup\$
1
\$\begingroup\$

Any device trying to trigger from a voltage waveform is looking for it to pass through a certain threshold. There will always be a tolerance on this and the slower the edge the more time there is between it might trigger and it always will trigger so go for the fastest edge every time.

Some devices can take an average which may be even better but many can't.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.