The starfield effect is one of the earliest computer effects demos: stars are rendered on a screen and blurred to make it look like you’re flying through them. Stars far away move slowly, and those close to you zoom by. Many people know of this effect from the Windows 3.1 screensaver, but it’s been around since at least the late ’70s. In this project, we’ll create a starfield demo using a 32 × 32 LED matrix, with a SmartMatrix SD Shield to act as intermediate hardware between the microcontroller and the LEDs. This shield microcontroller handles most of the complexity involved in driving all those LEDs.
GET THE PARTS
I’ve done my best to make the code and explanation for this project easy to adapt to any LED matrix, but you’ll find this project easiest if you use the SmartMatrix SD Shield and a SmartMatrix SD Shield–compatible LED matrix.
- 32 × 32 RGB LED matrix (Adafruit P/N 1484 or SparkFun P/N 12584; must be compatible with the SmartMatrix SD Shield that plugs directly into a Hub75 connector)
- 5 V 4A+ wall power adapter (Adafruit P/N 1466; must have the standard 2.1 mm center-positive connector)
- SmartMatrix SD Shield (available from the manufacturer or Adafruit P/N 1902; v3 is the latest version as of this writing)
- Teensy 3.1 or 3.2 (Adafruit P/N 2756; this is a small, inexpensive, and really powerful microcontroller board)
- MicroUSB cable Inline power switch with 2.1 mm connectors (Adafruit P/N 1125 or SparkFun P/N 11705) Shadowbox (8 × 8 inches)
- Diffuser (a piece of translucent material that can help diffuse the light, filling in the gap between LEDs; I used a piece of thin black felt, but you could use tissue paper, plastic, or even something smeared on the glass) (Optional)
- Cardboard (to get everything to fit snugly in the shadow box
- Soldering iron and solder
- Diagonal cutters
- Wire strippers
- Small screwdriver
- Handsaw, drill, or file
- Black marker
First, you’ll assemble the SmartMatrix SD Shield according to the manufacturer’s instructions and connect it to the LED matrix. You’ll then need to sandwich the diffuser between the LED display and the shadow box glass. After checking that everything fits nicely into the shadow box, you’ll take the box’s back off again, cut a small notch for the power cord, upload the program, and reassemble everything.
Make sure you’ve connected the power supply to the power switch, and then turn the switch on. Upload the code to your Teensy, make sure everything is uploaded properly, and reattach the back to your shadow box.
Congratulations! You should now have a beautiful LED matrix mounted in a nice box. You can improve and expand this project in many ways. But remember that in our project, the majority of the LEDs are off at any time. If you change the project and turn a lot more LEDs on at the same time, you’ll need to be careful with power. The inline switch is not rated to carry enough current to light the whole screen at full brightness, but you can remove it and plug the power supply into the board directly.