Introduction
Building a small LED matrix display is a fun electronics project that allows you to create custom animations, graphics, and text effects. With just a handful of common components, I can make an LED display capable of showing pixelated images in a compact form factor.
In this comprehensive guide, I will cover everything you need to know to build your own miniature LED matrix on a budget.
Components Needed
To build an LED matrix display, you will need the following components:
LEDs
The LEDs produce the light for each pixel in the display. Smaller LEDs allow for higher resolution and more pixels in a compact size.
- 3mm or 5mm LEDs are common sizes that work well.
- You need one LED per pixel. For a 16x16 matrix, that's 256 LEDs.
Resistors
- Resistors are used to limit the current through each LED to prevent damage.
- 220 ohm resistors are a good value for common small LEDs.
- You need one resistor per LED, so 256 resistors for a 16x16 matrix.
Matrix Perfboard
- The LEDs are mounted into a perfboard with holes spaced for the LED spacing.
- A 16x16 0.1" pitch perfboard works well for small matrices.
- The perfboard provides a sturdy structure to mount the LEDs.
Shift Registers
- Shift registers take serial data and convert it to parallel outputs to control the LEDs.
- 8-bit shift registers like the 74HC595 are commonly used.
- Chaining together multiple shift registers controls all the LEDs.
Microcontroller
- A microcontroller generates the animations and outputs the serial data signal to the shift registers.
- Arduino Nano or similar is a good option for the microcontroller.
- Code running on the microcontroller updates the LED display.
Power Supply
- The LED matrix and control electronics need a 5V power supply.
- A 5V USB power adapter provides a simple power solution.
Wires, Solder, Hardware
- Jumper wires connect all the components together.
- Solder electrically joins the LEDs to the perfboard.
- Screws, standoffs mechanically mount the perfboard.
Circuit Design
The overall circuit design consists of the microcontroller, shift registers, LED matrix, and resistors:
Microcontroller
-
The microcontroller is programmed to generate the image data and output it serially one pixel at a time.
-
It outputs serial data on one pin which connects to the shift register data input.
-
Another output pin clocks the shift register to latch the data.
Shift Registers
-
An 8-bit shift register like the 74HC595 has a data input, clock input, and 8 latched parallel outputs.
-
Chaining together multiple shift registers provides control for all the LEDs in the matrix.
-
The parallel outputs connect to the LED rows/columns to turn individual pixels on and off.
LED Matrix
-
The LED anodes or cathodes are connected together in rows and columns to form a grid.
-
The shift register outputs each connect to a row or column to control one axis of the matrix.
-
Pixels light up when their row and column drivers are both activated.
Resistors
-
Each LED needs a current limiting resistor between it and the shift register output.
-
220 ohm resistors work for common small indicator LEDs.
-
The resistors protect the LEDs and shift register outputs from overcurrent.
Mechanical Assembly
Constructing the physical circuit requires some mechanical assembly:
Mounting the Perfboard
-
First, solder header pins to the perfboard in a grid to match the layout of the LED matrix.
-
Mount the perfboard on standoffs secured with screws to a base structure for stability.
Soldering the LEDs
-
Insert each LED into the perfboard at the desired pixel locations in the matrix layout.
-
Solder the LED anodes or cathodes together in rows/columns on the bottom of the board.
-
Solder the other connection of each LED to a header pin.
Connecting the Electronics
-
Mount the shift registers and microcontroller board on the base near the perfboard.
-
Use jumper wires to connect the control pins between the components.
-
Supply 5V power to the microcontroller and shift registers.
Programming the Microcontroller
The microcontroller code generates the animations and outputs the control signals. Some key aspects:
Image Data Array
-
Store the pixel state for the entire matrix in a 2D array in the code.
-
The array holds a 1 or 0 for on or off state of each LED.
-
Refresh the array multiple times a second to animate graphics.
Shift Register Serial Output
-
Use a loop to go through each element in the image array.
-
Output the 1 or 0 value of each pixel sequentially using serial communication.
-
Clock out each bit to the connected shift registers.
Animation Timing
-
Use timers or delays in the main loop to control the refresh rate.
-
Faster refresh rates create smoother animations.
-
Update the image array on each refresh cycle to show new frames.
User Input
-
Monitor buttons connected to the microcontroller to allow interaction.
-
Let the user cycle through different animations and graphics.
Example Animations
Here are some examples of fun animations you can program:
-
Scrolling text - Output custom messages or animations.
-
Tetris game - Code a basic Tetris game with falling blocks.
-
Conway's Game of Life - Generate the cellular automata simulation.
-
Snake game - Animate a snake controlled with buttons.
-
Pacman game - Create a simplified single-screen Pacman game.
-
Pixel art - Display pixelated graphics and images on the matrix.
The small resolution is ideal for retro style games and art. With some coding skills, you can create tons of cool effects!
Low-Cost Options
Here are some tips for keeping the cost down:
-
Buy components in bulk on eBay or AliExpress.
-
Salvage components from old electronics for things like LEDs.
-
Repurpose an existing Arduino board instead of buying a new microcontroller.
-
Hand wire connections instead of using perfboard or PCBs.
-
Laser print your own custom circuit boards.
You can build a basic matrix display for under $20 worth of parts with some resourcefulness. The hardware is inexpensive - the real value is in the custom animations you can create!
Conclusion
Building an LED matrix display with a microcontroller is an achievable electronics project for hobbyists. With common components, you can construct a compact pixel screen to show any graphics and text animations you can program. Following this guide, you now have all the knowledge to build your own mini LED matrix on a budget and start creating awesome visualizations!