Short answer: to reduce switching losses and harmonics rejected into the supply (EMI issues), assuming the loads are resistive.
An optotriac is an implementation of a solid state relay, which can be other things, but I'll refer to your optotriac as an SSR in the following.
Assuming resistive loads: On AC supply, a zero cross detection circuit will allow the SSR to switch when virtually no current is flowing, which reduces the switching losses from the finite turn-on time of the contacts, and also reduces interferences rejected into the supply: if a nice sine wave is cut off abruptly at random locations, you're more or less drawing a square wave of the current for a small amount of time - this represents loads of non-50Hz (or 60Hz) harmonics drawn from the supply into all the parasitic elements of the supply, which will turn into voltage interferences. The extreme case for this are switching converters such as a buck or a boost but it's essentially the same issue. Triacs already spontaneously turn off at current zero cross, so there is only need to turn on the SSR at current zero cross. For resistive loads, this is also voltage zero cross.
Assuming inductive or capacitive loads: I'm pretty sure the "zero cross" label refers to the voltage, and not the current, which means that the above does not apply to capacitive and inductive loads since voltage and current are not in phase. I would reckon in such cases that the SSR will turn on at voltage zero cross/random current, and turn off at random voltage (after the next voltage zero cross)/current zero cross because of the triac's behaviours. Turning on would waste power and reject interferences. To be confirmed though.
To my knowledge the zero cross feature exists also in SSRs which are not based on triacs, it's just less convenient when dealing with AC controls.
Addendum: Here is an illustration of the interferences I'm talking about. The first figure shows one unswitched sinewave, and one switched, which have the same power. Strictly speaking I should be comparing several cycles where they are switched at zero cross in one case, and randomly in the other but that was quicker for one cycle. The fast fourier transform in the second figure shows that much more unwanted frequencies are drawn from the supply when the sine wave is switched, including DC.
Im a noob in electronics, but i think you can use a electromechanical relay and a transistor together
Principle of use is
1. Amplify your 5v signal using a transistor (idk maybe a enhancement mode mosfet, ask a pro. You need one that will output 12v? When your base is supplied with 5v (n-p-n maybe))
- After your signal is amplified, feed it into the relay
Again, im a noob at electronics. But this should give you an idea
*electronechanical relay isolates the main line from your signal (i think)
*you will end up having a 12v line using this though
Best Answer
If you really have to design it yourself (and not recommended), one approach you can use is relays, that would be safer and easier to get right. But relays will take a little time to switch so the output of the device when switching over will drop, now if the mains devices connected to it are things like laptops where they have power supplies with a fair amount of capacitance or batteries involved, these will tolerate a momentary loss of mains power for perhaps 100 miliseconds. If your output devices can't tolerate a momentary loss of power then don't go down this route.
You need a sensor (or two) to detect the loss of mains input power, you can do this with a 240 volt relay (coil energised by 240 volts) and the relay contacts triggering a little circuit to give a logic level input into a microcontroller. So as the mains power fails you get a change in logic level to the microcontroller which you can detect in software and trigger the relays to switch power to the other mains input.
Triacs: will give a faster switch over time and better in applications where the devices being powered can't tolerate a momentary loss of power, but triacs need more sophisticated circuitry to drive them: you have to apply pulses to the gate connection. And preferably those pulses need to be synchronised to the mains waveform when the signal crosses through zero (called zero voltage switching) so as to reduce the amount of radio frequency interference generated. It's all getting a bit messy.
SSR - think you mean SCR - silicon controlled rectifier. These devices are only unidirectional, so not suitable in your application.
If you can buy something off-the-shelf, I'd recommend that.