I am trying to pass the input from one pin to another pin as output. Effectively I want to create a blind passthrough. The end goal is to connect two Arduinos and a series of test points together like the diagram below. I want Arduino B to shuffle which test points are connected to which pins on Arduino A on startup.

+-----------+       +-----------+     +-------------+
|           |       |           |     |             |
| Arduino A <-------> Arduino B <-----> Test Points |
|           |       |           |     |             |
+-----------+       +-----------+     +-------------+

I figure one way to do this is to poll the input pins in the loop() and then change the output pins accordingly but I would prefer if the voltage changes just passed right through without it affecting timing.

Update: For some clarification:

  • All signaling is digital
  • I'm looking to "route" around 10-12 test points to Arduino A ideally but 6 at a minimum
  • How many test points are you planning to test at once? And, for a "test" do you need to measure both an input and an output? Eg. apply 3V to pin A0 and see what happens on pin D3? Something like that? How many simultaneously?
    – Nick Gammon
    Sep 18 '15 at 5:24
  • In addition to Nick's questions, are you working with digital signals or analog? If analog, do you have any particular bandwidth requirements?
    – Jake C
    Sep 18 '15 at 6:20
  • The plan is to use around 10-12 test points with up to 6-8 active at once. I would like to be able to measure input and output as well. Digital signals.
    – rev
    Sep 18 '15 at 16:42
  • If this is all digital, what is a "test point" exactly? Why can't Arduino B just generate the test signals, and just connect the pins directly?
    – Nick Gammon
    Sep 18 '15 at 21:16
  • The project is to create a puzzle for people to practice some things on. I want the person working on the puzzle to have around a dozen test points available to them to use to communicate to Arduino A. Ideally which test points are the "right" (active) ones will change dynamically each time they turn on the boards.
    – rev
    Sep 19 '15 at 21:14

You could use an analog multiplexer such as the 74HC4051 (8 channels) or the 74HC4067 (16 channels) like this:

74HC4051 multiplexer

Arduino B could alter the multiplex selector (A/B/C) pins to route the signal from the test points to a specific pin on Arduino A. If you are wanting to see the result of the signal on a different pin then a second multiplexer would be required (ie. one to send data to a pin, the second to see the result on a different pin).

I have a post about the 74HC4051 multiplexer / demultiplexer which gives more details about using it.

When I tested it I found only about a 5 ns delay in timing:

Multiplexer timing

Ignacio's answer about a crossbar switch sounds like a more elaborate form of multiplexer. Personally I haven't used one of them.

  • A multipliexer/demultiplexer is a many-to-one/one-to-many switch. A matrix switcher is a many-to-many switch, which fits the scenario OP described. You could replicate a matrix by just having an array of multiplexers, but depending on how many inputs and outputs he is dealing with there will probably be more address lines to drive than will be practical from an Arduino. I guess you could get around that with shift registers, but then it becomes a question of whether it is easier to have a complex mesh of 74xx series chips, or to just buy a matrix IC.
    – Jake C
    Sep 18 '15 at 4:30
  • Agreed, but I can't find many matrix switches in my searches. Do you have a part number that could be suitable?
    – Nick Gammon
    Sep 18 '15 at 5:23
  • You did better than me. :) Anyway, most of them seem to need SMD soldering skills - and the ones with a reasonable number of points (eg. 16 x 16) are quite expensive (eg. $70 or $180). We probably need more information from the OP as to how many s/he needs to switch. I can't see a 2x2 matrix being particularly useful here.
    – Nick Gammon
    Sep 18 '15 at 5:39
  • Analog Devices has a bunch: analog.com/en/parametricsearch/10630#/p4577=No Usually you can get them on an evaluation board to help breakout the pins for prototyping, but sometimes the price of the boards can be expensive. That is one advantage to 74 series, they are cheap and breadboard friendly.
    – Jake C
    Sep 18 '15 at 6:17

No Arduino is capable of doing this. You need to be looking at a crossbar/crosspoint/matrix switch IC instead.


You can reduce latency by using interrupts to detect input changes instead of polling in loop(), if you're dead set on using an Arduino instead of adding switching hardware (as suggested in other answers).

See attachInterrupt() for details, and beware that different Arduino models differ greatly in how many pins support interrupts.

Alternately, you can speed up the polling approach by using direct port access (e.g., PORTB and PORTD registers) instead of the simpler Arduino read and write functions. This will bypass some wrapper code and also let you manipulate multiple pins in parallel.

  • I think some of the hardware people have mentioned in the other answers is more what I need, but interrupts and direct port access will be very helpful for another part of the project. Thanks!
    – rev
    Sep 18 '15 at 16:47

Because this is digital I would like to add a third option in addition to Ignacio's and Nick's great suggestions. Use a logic device such as an FPGA or CPLD. This will require some extra knowledge and set up to get it working, but it is well suited for the functionality you are looking for.

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.