# Arduino Control Box: a Step by Step Guide – Part 4 – Wiring Diagram II

I have decided to split the chapter about the Wiring Diagram to ease the reading of the guide.

## Wiring Diagram

IMPORTANT NOTE: there’s an almost infinite amount of ways to wire a button matrix, mine is just one of them. I usually start from the top pin then proceed vertically. If you prefer any other order, go for it!
less important note: the order of the buttons might be a bit wonky, unless amended via code. I personally don’t care at all about it: we will assign controls in DCS by pressing a button, not by selecting it from a combo box or something like that.

Too messy? Let’s clean the diagram and analyse it step by step.
I usually separate the wires into vertical and horizontal. The fact that I start from the vertical wires is clearly reflected on the wiring diagram.

The task of the horizontal wires – I usually refer to them as buses; whereas I call the vertical as lines – is to link the vertical wires and intuitively you can understand why their path is much more complex. In other words, each bus has to “touch” every line, one per colour and only once, with just one noticeable exception.

## A 3-way Conundrum

A 3-way switch has three pins. How come? If you google 3-way switch diagram (←sorry) you find plenty of explanations from the electrical point of view. From the button matrix PoV instead, a 3-way switch is a combination of two buttons. The common pin is normally the middle one and it should be wired to a bus, whereas the top and bottom pins should be wired to two different lines.
When the bus is wired to the middle pin it is de facto connecting two different lines in one go: the switch basically counts as two; that’s why the red, blue and yellow buses connect a total of four physical switches, whereas the grey and the green connect five buttons.

Still having issue? Take a look at this pic:

In this application, there is no difference between a single 3-way momentary switch and the two pushbuttons. This image also makes even more clear how a single bus manages to connect two lines.
We can, therefore, replace the 3×3-way switches with 6x pushbuttons:

## Encoders: the Easy Part

Encoders are the easiest part. They come with 3 pins (as we have already seen, the two separated pins are the pushbutton): mid is the GND, the others two go in the order you prefer, straight to the the Arduino board.

Any GND pin can be used, so pick the one that makes your life easier 🙂

If everything is clear – drop a message here or ED’s forum otherwise – we can move on and start the dirty, manual part: drilling and soldering.