The wiring for this project isn't particularly complicated, but it is repetitive.
It's important to strike a balance between using enough wire, but not too much wire. It starts to add up, and get in the way when you're trying to close the project.
Above is the schematic for the MCP23017 i2c 16 input/output port expander. It's the heart of this project, since two pins on an Arduino (or, in my case a Metro 328) into 48 pins.
We'll be using three of the MCP23017, so to start, we need to identify them amongst themselves on the i2c address bus.
- mcp0: A0 = ground, A1 = ground, A2 = ground
- mcp1: A0 = 5V, A1 = ground, A2 = ground
- mcp2: A0 = ground, A1 = 5V, A2 = ground
For the three chips, use their rails to:
- Connect pin 9 to 5V.
- Connect pin 10 to ground.
- Connect pin 18 to 5V, via a 10k Ohm resistor.
- Connect pin 12 to Analog 5 (of an Arduino Uno, i2c clock)
- Connect pin 13 to Analog 4 (of an Arduino Uno, i2c data)
- Connect Ground to ground rail.
- Connect Vin to 5v rail.
- Connect RX to pin 3 (of Arduino Uno or Metro 328.)
- Connect TX (not used in code) to pin 4 (of Arduino Uno or Metro 328.)
- Connect Ground to ground rail.
- Connect 5V to 5v rail.
- Connect a 1000uf 6.3V (or higher) capacitor across the + and - terminals on the Ground and 5V rails of the first protoboard, immediately next to the wires coming in from the Metro 328.
NeoPixel arrangement below:
- Connect pin 6 to free column on protoboard.
- Connect 300-500 Ohm resistor to free column.
- Connect free hole on other side of 500 Ohm resistor to Din on first NeoPixel PCB.
- Connect 5V rail to 5V on first NeoPixel PCB.
- Connect Ground rail to GND on first NeoPixel PCB.
You then connect every button to the correct GPA (or GPB) pin in sequence, with the other lead connected to ground. When the button is pressed and the GPA (or GPB) of each MCP connects to ground, that input is translated on the Arduino into a serial command.
- Connect GND to one of the outside pins on the slide switch.
- Connect EN to the inside pin on the slide switch.
- Solder the USB-B style jack into the Powerboost 1000C, and run the short USB cable to the METRO 328. (if you use an Arduino Uno with USB-A type plugs, you'll need to find one short enough to not take up unnecessary space.)
- Connect all of the I/O Ground pins to each other as a daisy chain. It's a much cleaner way to wire. You can also connect these to the arcade buttons. Then connect the final one to the Ground rail.
- Connect each of the other I/O pins to their respective GPA/GPB pins on the MCP23017. See diagram above.
- Connect the LED Ground (-) to a 150 Ohm resistor, then this resistor to the Bakelite Ground rail.
- Connect the LED Positive (+) to the Bakelite 5V rail.
To limit the amount of wiring mess in this project, I cut a length of Bakelite to secure to the top of the case by printed 6mm standoffs.
When cutting Bakelite, use scissors, and cut through holes you won't need. It's very crumbly and unpredictable to cut, but also cuts with little force, so take your time and give yourself margin.
I then drilled two holes for the 6mm screws to secure to the standoffs. Do not glue the standoffs to the top of the case until you're finished soldering.
Solder a wire from the common Ground and 5V rails on the protoboards, and then connect each individual Ground wire and 5V wire from the pushbuttons to the Bakelite rail.
Once you've soldered each in a row, bridge the joints (this is so much fun to do!)
A note about soldering to Bakelite: it isn't easy. The pads aren't very robust, so be deliberate with your iron placement, and patient if the solder doesn't immediately leach.
Now that you've finished, glue the 6mm standoffs (already screwed to the Bakelite rail) to the top of the case, inbetween the arcade buttons and pushbuttons.