Introduction: Arduino Neopixel Game Console
Hi makers!
This project was born in 'Creative Electronics', a BEng Electronics Engineering 4th year module at the University of Málaga, School of Telecommunications.
Pixel and play is an open hardware/software project to make the creation of interactive games easy. This Instructables is a detailed assembly guide of the console. But that's not all the game. We also provide an Arduino library with lots of processing like methods and several game examples and demos and even a processing app for painting images etc.
Find all .stl (3d) and Gerber (PCB) files to build your own Pixel and Play console at Open Hardware Github. You can install the library either using the Arduino library manager or downloading it directly from our GitHub repository. Also an instructables
The big picture:
Pixel and Play is an open hardware/software project with the aim of simplifying the creation of interactive games based on Neopixel matrixes. We provide an Arduino library and a console design alongside all files needed to replicate it, casing 3D models, PCB Gerber files, and an assembly guide.
Supplies
Hardware:
- 16x16 RGB Display WS2812B chip – Recommended
- Arduino Nano 33 BLE Sense
- 2x battery 18650 3.7V 3000mAh
- Battery case for two 18650 in series
- PCB and its components, detailed later.
- Soldering wire
- Wires
- 3D printer, or a friend with one ;)
- Tiny woodscrews
Software:
- Arduino IDE 1.8.10 - Required
- 3D printer SW (Cura for our 3D printer) - Required
- Processing 3.5.4
- KiCAD 5.1.5
- SolidWorks 2019
Step 1: Printing the Frame
The frame is a 3D printed piece that mounts all the components. Due to its size, it's not possible to print it in one run without splitting it up first. But fortunately, we have already done it for you ;)
1. Download STL files
Download this GitHub repository. The .stl files are located in master/3D_design/STL
2. Print all parts separately
Printing the parts separately will make the final piece more sturdy.
3. Glue all four parts together
Use a special glue for 3D printed models. Sandpaper the contact areas before applying the glue and join the upper pieces first to make the PCB fit better into its mount
Step 2: PCB
The PCB was designed in KiCAD, an open software to design PCBs and it's been designed to be easy to solder and make. Its main function is to adjust logical levels between Arduino and Neopixel display, and steps the Arduino supply voltage down to 5 V from the 8ish battery volts, making the Arduino's power supply more stable and independent from the battery level.
1. Download the Gerber files
All files needed for manufacturing the PCB are available on GitHub. (path: master/PCB/gerber_files), so you can send it to your favorite manufacturer or do it yourself.
2. Making the PCB
Although all pads and traces are large enough to make the board ourselves. We trusted on a Chinese manufacturer to make our PCB because it's quite cheaper although it's less fun :(
3. Solder the components
Use a good and slim soldering wire, and flux, it will help a lot
The components needed are:
- C1 - 1000uf capacitor, it works as a current buffer for the Neopixel.
- R1 - 470ohm resistor, we do recommend placing it close to the Neopixel data input.
- U1 - 74AHCT125 level shifter, used to step 3.3 V (Arduino Nano BLE logic level) up to 5 V (recommended Neopixel logic level)
- J2 - A barrel jack, for connecting the power supply
- J3 J4 P1 P2 - Pin headers used as a socket for the Arduino and expansion pins.
- SW1 - A switch to turn on and off.
- U2 - An 378R05 LDO regulator, a different LDO can be used as long as the pin mapping does not change.
- C2 - 0.33uf (C2 and C3 are decoupling capacitors recommended by the voltage regulator manufacturer)
- C3 - 47uf
Finally, we only have to solder the components in the board.
4. Screw the PCB
Step 3: Glue the Neopixel Matrix
The frame has been designed to have a gap around and beneath the panel. Some panels include a 3M tape already stuck behind, if not, you can use double-sided tape or glue to join both pieces
Step 4: Glue the Batteries
You can use glue or tape as in the prior step. Make sure the battery wire can get into the frame's hole. Although it's not necessary, it will make the wiring look cleaner.
Step 5: Extra Tips
1. Improving the ergonomics
A racket grip rolled around the handles will make the console easier to handle when playing.
2. Gluing side breadboards
Two mini breadboards fit in thegap above the Neopixel matrix, one on each side of the PCB. Those breadboards can be used to extend the capabilities of the console by adding sensors, controllers or actuators. Some cool ideas that may like you are: joysticks, scoreboards, speakers... the possibilities are endless
Step 6: Using the Arduino Library
Step 7: Using MatrixPaint (processing)
MatrixPaint is an app developed in processing to make paint Matrix Images easier and abstract the user from having to calculate the pixels that must be lighted up to display the image. We used it for painting the maps of the games
The interface has a canvas, emulating the Neopixel matrix (for changing the canvas matrix size modify the constants "columns" (width) and "rows" (height) in the main file).
In the upper right corner, there is a color palette, which can be modified if you want to enter a specific color. In order to change a color field, find the "Palettes" class, enter the RGB combination of the desired color at the same position of each array in its corresponding primary color. If you've made a mistake painting a pixel and want to erase it, just paint it black. After pressing the "Generate Code" button you have to type a name for the drawing then, press enter.
In the same program directory, it will automatically create a file with the chosen name and with the extension ".ino"
This file will contain an array of the selected screen size, with each of the pixels that must be turned on to form the created image. To display the image call the API "Panel.h" function named image(), whose first parameter is the created array. And the second argument is the position where the image will be displayed.
Step 8: Troubleshooting
General
1. The Arduino Nano BLE sense is not recognized by the PC. The orange LED is blinking. This happened to us quite frequently, to solve it, press the reset button repeatedly. Pressing it once is not enough, try 10 reps rounds. When the orange LED blinks slowly, increasing and decreasing its brightness slowly up and down, the Arduino is ready again.
2. The Neopixel does not light up or it behaves unexpectedly.
- Normally, Neopixel matrixes have two ground terminals. One near to VCC and another close to Data input, make sure all grounds are short-circuited.
- In low-quality panels, the pin mapping may be printed wrongly.
- Make sure all the connections are correct and secure.
3. The panel is too bright or turns down after it. If the current drawn by the Neopixel is too high, the voltage regulator may turn itself off due to overheating. With the API setBrightness(val) method is possible to select the panel brightness, val ranges from 0 up to 255, but we do recommend stay under 40.
API
3. API calls do not print anything. Yes, you have to call show() to display data on the panel.
4. Calling line() does not print anything. The release 1.1.0 does not support lines with angles different from multiples of 45 degrees.