This month, HackerBox Hackers are exploring jumbo LED matrix displays, ESP32 single-chip computers, and joystick game controls. This Instructable contains information for getting started with HackerBox #0036, which can be purchased here while supplies last. Also, if you would like to receive a HackerBox like this right in your mailbox each month, please subscribe at HackerBoxes.com and join the revolution!
Topics and Learning Objectives for HackerBox 0036:
- Configure the Arduino IDE to program the ESP32
- Interface joystick and push-button control inputs
- Wire data and power to JumboTron LED Panels
- Program various applications leveraging matrix displays
HackerBoxes is the monthly subscription box service for DIY electronics and computer technology. We are hobbyists, makers, and experimenters. We are the dreamers of dreams. HACK THE PLANET!
Step 1: HackerBox 0036: Box Contents
- P3 RGB LED Matrix with 64x32 pixels
- ESP32 Development Board
- Game Controller Board with Joystick
- Power Supply Harness for LED Matrix
- DuPont Jumpers Female-Female 20cm
- Exclusive HackerBoxes Glider Koozie
- Exclusive Atari retro fan art Decal
Some other things that will be helpful:
- 5V DC power supply (2-4 Amps)
- Soldering iron, solder, and basic soldering tools
- Computer for running software tools
Most importantly, you will need a sense of adventure, hacker spirit, patience, and curiosity. Building and experimenting with electronics, while very rewarding, can be tricky, challenging, and even frustrating at times. The goal is progress, not perfection. When you persist and enjoy the adventure, a great deal of satisfaction can be derived from this hobby. We all enjoy learning new technology and hopefully building some cool projects. Take each step slowly, mind the details, and don't be afraid to ask for help.
There is a wealth of information for current, and prospective, members in the HackerBoxes FAQ.
The Glider is a pattern that travels across the board in Conway's Game of Life. It has been loosely adopted as an emblem to represent hacker culture since the Game of Life cellular automaton appeals to hackers and the concept of the glider was born at almost the same time as the Internet and Unix. Can you program Conway's Game of Life on the 64x32 LED Matrix?
Step 2: ESP32 and Arduino IDE
The ESP32 is a single chip computer. It is highly integrated featuring 2.4 GHz Wi-Fi and Bluetooth. The ESP32 integrates the antenna switch, RF balun, power amplifier, low noise receive amplifier, filters, and power management modules. As such, the entire solution occupies minimal Printed Circuit Board (PCB) area.
There are a few types of ESP32 Development Boards. The one used here is a variation on the "DOIT ESP32 DevKit". Most of the I/O pins are run out to the pin headers on both sides for easy interfacing. A USB interface chip and voltage regulator are integrated into the module. The ESP32 is supported within the Arduino ecosystem and IDE, which is a very quick and easy way to work with the ESP32.
The Arduino ESP32 github repository includes installation instructions for Linux, OSX, and Windows. Click to that link and follow the instructions that correspond with the operating system on your computer.
PROGRAMMING THE DEVELOPMENT BOARD
To test that the IDE is correctly configured before moving on, load the BLINK example to flash the onboard LED. Change the delay values to try different blink frequencies and make sure the code is effectively reloading onto the ESP32 board.
When programming the ESP32, press and hold-down the “BOOT” button in the ESP32 development board prior to hitting the upload button on the Arduino IDE. Once the “Connecting _ _ _ …” message appears on the Arduino IDE, you can release the “BOOT” button and programming should begin.
Step 3: Game Controller Board With Joystick
This game controller "breakout board" includes an analog joystick control and four buttons. Its size and shape are well suited for handheld operation.
The analog position control is based on two potentiometers (one for x and one for y) which are wired up in the standard "voltage divider" configuration. Accordingly, OUTX and OUTY must be read as analog values and scaled appropriately as shown in the demo code. OUTZ and the four buttons are simple on/off digital switches that normally float open and short to GND when activated.
The board can be wired to the ESP32 using DuPont Jumpers on the following pins:
ESP32 Game Controller GND GND 3V3 VCC 35 OUTX 34 OUTY 26 OUTZ 27 KEY1 32 KEY2 33 KEY3 25 KEY4
There is nothing special about these pin assignments, but they are the ones used in the demo code. Since certain IO pins on the ESP32 are output only, you might want to keep it simple and just use these same values.
Step 4: 64x32 RGB LED Matrix P3 Panel
With 2048 full-color RGB LEDs, this matrix is like your own personal "mini" jumbotron display. These panels are actually the same type used in jumbo LED displays as you can probably tell from the industrial strength power harness. The LEDs are positioned on a 3mm pitch grid (hence the P3 designation). They are driven with a 1:16 scan rate.
We will be using the PxMatrix Library for the Arduino IDE. Go ahead and install that library now. There is also a ton of operating theory detail at that link if you are interested to check that out.
There are three connectors on the rear of the LED Matrix Panel. These include two 16 pin dual headers (labeled IN and OUT) and also a small power header. There are three different sets of wires to connect up to these as described below.
FINE Jumpers from DATA IN to DATA OUT
IN OUT R2 R1 G1 R2 G2 G1 B1 G2 B2 B1
NINE Jumpers from the ESP32 to DATA IN
ESP IN 13 R1 22 LAT 19 A 23 B 18 C 5 D 2 OE 14 CLK GND GND
The provided power harness needs to be connected to a 5VDC supply. If you plan to illuminate all the LEDs to full brightness, the panel will draw up to approximately 4A. If you have a decent "bench supply" that should be apply to provide 4A. For typical average operation, 2A might suffice. For example, we tested out a 2.5A USB power bank (battery pack), which worked fine. We soldered a USB connector in place of the screw lugs on the power harness allowing it to be plugged into the USB power bank.
There are two four-pin headers on the power harness. These are for powering two panels. One of the headers can be removed if you wish to tidy things up, just be sure to wrap up the cut wire ends (with tape or tubing) to prevent shorting the power supply.
Common Power Supply to LED Panel and ESP32
Cut one end off of a DuPont jumper. Strip and tin the wire to connect it to a red line of the harness. An easy option is to use one of the lines where we removed the extra four-pin power header. Again, be sure to wrap the power splices to prevent shorting things out. After the ESP32 is programmed and the USB cable is removed, the female DuPont plug on the other end of the spliced wire can be placed on the VIN pin (not the 3V3 pin) of the ESP32 board. This will supply power to the ESP32 board and and the LED matrix from the same 5V supply making a tight and portable configuration for running under battery power.
Step 5: Matrix Demo Prog
Program the attached jumbotrondemo.ino sketch into the ESP32.
Be sure that the PxMatrix library is installed.
The four modes of the demo program are selected using K1 - K4. The code should be fairly self explanatory for extending into your own projects.
Step 6: 1 2 3 GO!
What are you going to make with your 64x32 Color Display and Game Controller? Start brainstorming with some inspiration from other example projects...
- Morphing Digital Clock project
- Adafruit Matrix Display resources
- Instructable with LED Matrix Projects
- Add Android BLE control
- How about a nice game of Tetris ?
- CHIP-8 Games (originally for 64x32 displays)
- Library for use with the ESP32 IDF (not Arduino)
- Ten Great DIY Electronic Games from WIRED
Please send in a link to your project so we can share it with the others below:
Step 7: HACK THE PLANET
If you have enjoyed this Instructable and would like to have a cool box of hackable electronics and computer tech projects descend upon your mailbox each month, please join the revolution by surfing over to HackerBoxes.com and subscribe to receive our monthly surprise box.
Reach out and share your success in the comments below or on the HackerBoxes Facebook Page. Certainly let us know if you have any questions or need some help with anything. Thank you for being part of HackerBoxes!