Step 3: Build the Circuit
We'll be using 12 output pins total on the Arduino but there are 18 LEDs to power. The trick is that only a single level can be lit at a time. When a level is connected to ground, each of the LEDs on that level can be powered individually through one of the nine other Arduino pins. If we light the levels fast enough it will appear as if all three levels are lit at the same time.
Let's build the circuit.
The first step is to prepare the nine current limiting resistors. I'm using 220 ohms per pin which will draw around 22mA. The value may vary depending on the LEDs that are being used but stay between about 135 and 470 ohms. Each pin is capable of sourcing up to 40mA.
In order to save room we want to solder the resistors in a vertical position. Bend one lead down so that both leads are parallel to each other. Do this for all nine of the resistors.
Once the resistors are ready we'll solder them one by one. To make it easy we're going to solder the resistor leads directly to the other components instead of using a separate wire for each. One end of the resistor will connect to a column and the other will connect to a header. Start with the first row of LEDs which is closest to the resistors and work your way back.
Once each row is finished you can use a small piece of tape to isolate the overlapping leads in order to prevent a short. Refer to the photos and diagram to see what this will look like once it's finished.
Now that the columns are out of the way, the next step is to solder the components which control the levels. The base of a NPN transistor will be activated by an Arduino pin through a current limiting resistor of 10k (or thereabouts). This will connect the corresponding level to ground which will allow current to flow through the LEDs. Refer to the photos and diagram.
Once complete the LEDs should connect to pins 2-10 on the Arduino and the levels should connect to pins 11-13, bottom to top. The pins are also configurable in the software if you need a different setup.
The circuit is now complete, time to move on to the software!