0
\$\begingroup\$

I'm quite new to Electronics and I have this assignment I have to do - I need to "reroute" the input according to his type.

I have these two inputs, which can be both analog (1 channel, same value on both inputs) or digital (2 channels, different value in every input). I also have this Control input which is given to me, and I can detect whether the input is Analog or Digital (5v - analog. 0v - digital).

I added two schemes that shows how it should reroute the inputs:

  • if the input is Analog, it should reroute it to the Analog input A0 (of the Arduino in my case).
  • If the input is Digital, it should reroute it to Digital Input D0 and D1 (of the Arduino in my case).

Case Analog: Analog

Case Digital: Digital

I know I can do it using an Arduino, but I'm looking for something cheaper and smaller to do this, and I don't want my main Arduino to handle this. Is there any IC that does this kind of jobs? If not - how can I do it using transistors?

\$\endgroup\$
  • 1
    \$\begingroup\$ Why not let the Arduino handle it? The A0/A1 pins can also be read as digital signals. It's no more effort to read the same pins in different ways, as it is to read different pins. \$\endgroup\$ – Neil_UK Mar 11 '16 at 14:29
  • \$\begingroup\$ I should point out that the analog pins on the Arduino can also handle digital input, so it seems unnecessarily complicated to reroute the signal to a different input pin. Still, if that is what the assignment says ... \$\endgroup\$ – Nick Gammon Mar 11 '16 at 23:30
  • \$\begingroup\$ Also D0 and D1 are generally used for serial communications, so this program may not succesfully do Serial.print while you have wires running to other devices. \$\endgroup\$ – Nick Gammon Mar 11 '16 at 23:31
1
\$\begingroup\$

You would need some kind of arrangement with an analog switch (cd4066).

The 4066 consists of 4 switches that each have two inputs, one output, and a control input. The control input selects which input is connected to the output.

The switches are also bidirectional - you can use them to switch one of two inputs to the output or one input to one of two outputs.

Don't let the name bother you. It will switch digital signals just as well.

There are other analog switch ICs as well. Some with more switches er chip, some with less. There are switches with more inputs more control signals as well.

Analog switches may also be called multiplexers.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.