Electronic – Allow an analogue signal through unless a digital signal is present


Does a component exist that allows an analogue signal through until it receives a digital 1, then allows that digital 1 through? As an example:

  1. Analogue sine wave going 0V to +5V is only input, output is the exact same sine wave
  2. +5V DC input turned on
  3. Output now becomes only +5V DC, ignoring the sine wave.
  4. +5V DC input turned off
  5. Output returns to sine wave

The digital signal won't be on all the time. When it is, I want it to override the analogue signal. My specific case is using four button/fader pairs.

I haven't found an accurate way to word it that might return actual components in Google. An Analogue OR Gate, perhaps?

Best Answer

there's various ways of doing this, but the simplest would probably be using an analog switch IC that you control with the digital input, which has two inputs, one of which you connect to your analog signal, the other which you simply tie to 5V.

In the more general case, "maximum of two inputs" is not hard; all you need would be two diodes:


simulate this circuit – Schematic created using CircuitLab

If your inputs are driven well enough and output is weakly, but pulled towards ground, a) is sufficient. I'd recommend you make sure that you neither put any large load on the diodes (as that will lead to an inequal voltage drop!), and make sure the output converges back to 0 V when the output becomes low, so go with something like b).

Now, you say:

I've got four button/fader pairs, and I want each one to be combined into one wire, with the digital signal overriding the analogue one.

well, that's even more trivial.

Your fader is probably a resistor, i.e. your analog signal has a relatively high source impedance.

That makes this really trivial:


simulate this circuit

The button pulls the output high, done!