Matrix Computer Side Panel

by Will Donaldson in Circuits > Microcontrollers

28781 Views, 212 Favorites, 0 Comments

Matrix Computer Side Panel

Screen Shot 2021-12-13 at 11.21.40 AM.png
Screen Shot 2021-12-13 at 11.15.17 AM.png
Screen Shot 2021-12-13 at 11.15.01 AM.png
Screen Shot 2021-12-13 at 11.15.10 AM.png
I connected my PC to The Matrix

This project uses a PCB board with a NodeMCU ESP8266, coded to control 216 NeoPixels, to animate the side of a computer tower with the famous "raining code" animation from the Matrix franchise.

The NeoPixel control board is a modular, customizable PCB breakout board for controlling multiple strips of NeoPixels with user input options to control the speed and brightness of the display with potentiometers and control the animation mode with a push button.

This project does use tools like laser cutters that are not accessible to everyone, so alternative options and suggestions throughout this project such as creating a spray paint stencil with a traditional printer and also building a breadboard circuit instead of having the PCB boards fabricated via online services.

The GitHub repo for this project, including the PCB Gerber files and code, is available here: https://github.com/WillDonaldson/NeoPixel_Control...

Supplies

Materials

  • 1x PCB (see comments in next section)
  • 1x NodeMCU ESP8266
  • 1x 74AHCT125 chip
  • 2x 10K Ohm resistors
  • 4x 470 Ohm resistors
  • 2x 1N4001 diodes
  • 1x 1000uF electrolytic capacitor
  • 12x M3 20mm bolts
  • 1x DC barrel jack female and male connector (recommend 5A rating over the more common 2.5A rating)
  • 1x ON/OFF switch (optional)
  • 1x Momentary push button (optional)
  • 2x 10K Ohm potentiometers (optional)
  • 2x 2-pin JST-VH female and male connectors (optional)
  • 4x 3-pin JST-VH female and male connectors (optional)
  • Zipties for cable management (optional)
  • 5m strip of WS2812B NeoPixels (60 LEDs/meter)
  • 2x 40cm by 40cm sheet of black acrylic 3mm (dimensions will vary depending on you PC)
  • 1x 40cm by 40cm sheet of white diffusing acrylic 3mm (dimensions will vary depending on you PC)\
  • Acrylic glue or super glue
  • Assorted electrical accessories: wire, solder, heat shrink tube
  • Computer with a power supply that has one 5V and GND pin available. Alternatively can bypass the inbuilt power supply and power the circuit by a traditional 5V 5Amp power supply

Tools

  • Laser cutter (optional but recommended)
  • Soldering iron
  • Allen key for M3 bolt
  • Miscellaneous tools: Wire strippers, snips

Fabricate PCB (Optional But Recommended)

Neopixel_Control_PCB_Board v1-1-0 topside.png
Screen Shot 2021-12-13 at 11.20.03 AM.png
Screen Shot 2021-12-13 at 11.20.09 AM.png

I designed this PCB in Fusion 360 electrical, in the next section you can see the electronic schematic. To fabricate this you can use an online PCB fabrication service that will generally cost about $25 (my price, including shipping from China to North America). The turnaround on these services is pretty fast and I got my boards in 1.5 weeks.

Download the latest Gerber files zip version from the GitHub repo. As of publishing (Dec 12 2021), the latest version is v1-2-0. This zip file can be uploaded directly to any PCB fabrication website with the default options left as is. https://github.com/WillDonaldson/NeoPixel_Control_Board/tree/main/gerber-files

Alternatively, if you do not want to have this board fabricated you can assemble the circuit on a breadboard, following the wiring schematic in the next section.

When assembling the PCB you will notice in the pictures above I have marked the PCB with all the labels of where the different resistors, diodes, chips, and other components go.

Assemble Circuit

Neopixel_Control_PCB_Board v1-1-0 schematic.png
Neopixel_Control_PCB_Board v1-1-0 render.png
Screen Shot 2021-12-13 at 11.20.56 AM.png
Screen Shot 2021-12-13 at 11.20.37 AM.png
Screen Shot 2021-12-13 at 11.19.36 AM.png
Screen Shot 2021-12-13 at 11.21.18 AM.png

As mentioned in the previous section, the first picture in this section shows the electronic schematic. This can be used as a reference when assembling the circuit, although I did my best to label all the components directly on the PCB so you can follow the markings directly on the board when assembling the circuit.

Alternatively, you can also assemble the circuit on a breadboard. I have a picture showing this although I opted to use an Arduino Nano for this whereas the PCB uses an ESP8266, you are free to use any microcontroller, you'll just need to update the pin assignments in the code accordingly.

Laser Cut Frame

Screen Shot 2021-12-13 at 11.16.30 AM.png
Screen Shot 2021-12-13 at 11.16.50 AM.png

To build the lightbox we need several pieces of laser-cut acrylic. The components have been modelled to the dimensions of my PC case so you will likely need to adjust the dimensions to fit yours. All the .svg files for laser cutting can be found on github here: https://github.com/WillDonaldson/NeoPixel_Control_Board/tree/main/examples/matrix-computer-side-panel/laser-cut-files

  • Cut 1 copy of "character-panel.svg" out of 3mm black acrylic
  • Cut 1 copy of "solid-panel.svg" out of 3mm black acrylic
  • Cut 1 copy of "solid-panel.svg" out of 3mm white diffusing acrylic
  • Cut 11 copies of "spacer-grid-1.svg" out of 3mm black acrylic
  • Cut 2 copies of "spacer-grid-2.svg" out of 3mm black acrylic

Comments on NeoPixels

Screen Shot 2021-12-13 at 11.19.00 AM.png
Screen Shot 2021-12-13 at 11.19.08 AM.png

Before we start assembling the side panel I wanted to share some tips on using NeoPixels. A full reference guide can be found here and it is a resource I strongly recommend checking out: https://learn.adafruit.com/adafruit-neopixel-uberguide?view=all

The abbreviated summary of NeoPixels is that they are a strip of RGB LEDs, each with its own unique address. Having a unique address means that all the LEDs can be connected on the same data line as each LED will only listen to messages addressed directly to it.

When cutting the NeoPixel strips, instead of cutting in the middle of the copper pad I recommend cutting just past the copper pad and sacrificing the next LED in the chain as the larger pad will make soldering a lot easier (see picture above).

Additionally, make sure you observe the direction of data transmission (as indicated by the arrow next to each LED). Reversing the direction of data transmission will prevent the following LEDs from turning on (as shown in the second picture above).

Fabricate Side Panel

Screen Shot 2021-12-13 at 11.18.08 AM.png
Screen Shot 2021-12-13 at 11.18.21 AM.png
Screen Shot 2021-12-13 at 11.17.10 AM.png
Screen Shot 2021-12-13 at 11.17.19 AM.png
Screen Shot 2021-12-13 at 12.45.25 PM.png
Untitled.png

After laser cutting assembly the 13 pieces that make up the spacer grid in a lattice as shown in the pictures. The components fit press together and then can be secured in place with acrylic glue or super glue. Not that "spacer-grid-1.svg" has a hole at one end and not at the other. These holes are used to pass the wires through and should be installed in an alternating pattern when assembling the grid. The spacer grid serves two purposes: firstly to ensure the light diffuses nicely in the white layer (if the LEDs are too close there will be visible white spots) and secondly, to ensure light doesn't spill out of one column into its neighbors (thereby ruining the raining code effect).

After the grid is assembled it can be glued in the center of the "solid-panel.svg" that was cut from 3mm black acrylic. This assembly makes up the back panel of the lightbox. The NeoPixel strip should be cut into 12 sections of 18 LEDs, to attach them, peel back the adhesive layer and insert the strips in between the laser cut grid. Note that the LED strips are assembled in an S-shaped pattern as shown in the picture above with blue and red arrows indicating the direction of data transmission.

Install Side Panel

Screen Shot 2021-12-13 at 11.21.51 AM.png
Screen Shot 2021-12-13 at 11.17.40 AM.png
Screen Shot 2021-12-13 at 11.17.55 AM.png
Screen Shot 2021-12-13 at 11.18.42 AM.png
Screen Shot 2021-12-13 at 11.22.02 AM.png
Screen Shot 2021-12-13 at 11.22.21 AM.png
Screen Shot 2021-12-13 at 11.22.35 AM.png

This step is specific to my particular computer so modify the steps as required. I removed the side panel and unscrewed the existing transparent panel and then inserted the 3 layers of acrylic: first the panel with characters cut out, then the white diffusing layer, and then the lightbox layer with LEDs and acrylic spacers. I used M3 bolts to secure the acrylic panels to the existing mounting points on my PC frame.

To power the circuit I used a 6 pin MOLEX connector that plugs into my 850W power supply. For the raining code animation, only a few LEDs are turned on at once so the current draw is minimal. But if you turn all the LEDs on at once to different RGB values the total current draw would be about 4.32 Amps ( = 216 LEDs * 20mA average current/LED). If you have a smaller power supply and/or want to light all the LEDs up I would recommend powering the LEDs from a separate power supply that connects directly to the wall as putting too much strain on a small computer power supply may negatively impact the performance of your computer.

Programming the ESP8266 in the Arduino IDE

Assuming you have the Arduino IDE software installed, we can program the NodeMCU ESP8266 microcontroller.

Unfortunately, the Arduino IDE can't quite hit the ground running with the ESP8266 and we need to do a couple of configuration steps first:

  1. Add the ESP8266 extension. Click the following: File > Preferences > Additional Board Managers > And add the following message: https://arduino.esp8266.com/stable/package_esp8266com_index.json
  2. Download the ESP8266. Click the following: Tools > Board > Board Manager > Find and download ESP8266
  3. Select the board. Click the following: Tools > Board > NodeMCU1.0 (ESP-12E)
  4. Select the port. Click the following: Tools > Port > COM_
  5. Verify success by running blink sketch. Click the following. File > Examples > Basics > Blink > Upload

And finally, we want to add the NeoPixel library to import some useful tools and functionality. Click the following: Sketch > Include Library > Manage libraries > Search and install: Adafruit_NeoPixel

Demo Code

Screen Shot 2021-12-13 at 11.22.48 AM.png

Example code for using the custom PCB is available on the GitHub repo here: https://github.com/WillDonaldson/NeoPixel_Control_Board/tree/main/examples/neopixel-demo

To break down the code there are 3 examples.

1) debounce_switch_demo.ino

This code shows the operation of the momentary push button with an interrupt service routine (ISR) and signals debouncing filter. The momentary switch is connected to an external pullup resistor so it is normally reading a signal of HIGH. The buttonISR() function will be called every time the state falls to LOW, indicating that the use has pushed the button. If however, the signal is noisy a single button press may be measured as multiple, this is undesireable from a user experience perspective so a debounce_delay threshold of 0.2 seconds is included to ignore these erroneous, noisy readings.

2) two_potentiometers_esp8266_demo.ino

Unlike Arduino-based board the NodeMCU ESP8266 only has one analog input pin. To enable the use of 2 potentiometers we need a way to toggle on potentiometer "ON" while ignoring the other potentiometer, and visa-versa. This example program demonstrates how this is achieved using a pair of diodes that act as one-way gates and pulling the pins on the potentiometer either LOW or HIGH when we either want to ignore or listen to them, respectively.

3) neopixel_demo.ino

This program fuses the two previous programs into one, giving multiple user input options, and also builds on the Adafruit NeoPixel library to create several different LED animations. Users can toggle through the different animations using the momentary push button and adjust the speed/brightness with the two potentiometers.


Matrix Animation Code

Screen Shot 2021-12-13 at 11.14.51 AM.png
Screen Shot 2021-12-13 at 11.23.03 AM.png

We are now ready to bring everything into one final piece of software: matrix-raining-code.ino

This code creates the raining code animation using the movingPixel() function I wrote. Unfortunately due to the S-shaped wiring of the LEDs (as detailed in Step 5) creating the raining animation is a little tricky as every even column has the direction of data transmission going "upwards" while every odd column is going "downwards". To combat this the movingPixel() function checks if the column is even or odd with the following conditional:

if((col % 2) == 0){}  // is an even column
else{}                // is an odd column

and then adjusts the direction of the "rain" accordingly.

I encourage you to play around with the variables, adjusting the speed, colors, and even the pattern! Let me know what you create!