Voltage-operated switches are fairly commonplace but frequency-operated ones are still rare. The one described here is based on a 4046, a PLL (phase-locked loop) that, internally, is largely digital.
The two frequencies that are to be compared are applied to pins 3 and 14 of IC1. They must be rectangular with an amplitude equal to the supply voltage of 3-5 V. Their duty factor is not important since the IC reacts only to leading transitions (edges). If ƒ1 is lower than ƒ2, the output goes low. If ƒ1=ƒ2, a rectangular voltage whose duty factor is stable and determined by the phase difference of the two signals, is present at pin 13. This voltage is converted into a direct voltage by R1 and C1, which is then applied to switching transistor T1 via the source follower. If the voltage level is high enough, T1 will switch on and energize the relay.
In theory, the error rate of the switch is 0, but in practice, 0.1 % must be allowed. The time constant R1-C1 must be about 10 times as long as the period of the input signal. Higher ratios delay the operation unnecessarily.
When the frequencies are almost identical, it may, in the worst case, take one period of the difference frequency before the circuit is enabled.
The circuit is suitable for operation from 3-15 V supplies, but make sure that the supply and relay voltages are the same. Transistor T1 can switch up to 100 mA. The current drawn is about 0.5 mA plus the relay current.