USING THE LED MATRIX DISPLAY
In this project, we introduce the LED Matrix 8x8 display and get it working.
LED Matrix RaspberrySTEM Cell
Having issues? Check out the Troubleshooting Guide.

In this project, we're going to introduce a new component that can be used for a variety of purposes, including building games. It's called an LED Matrix, and like the name implies, it is basically a small device that contains lots of little LEDs (64 of them, to be exact). This is what an LED Matrix looks like (though yours won't have the smiley face just yet and the writing you see on the image below is actually on the circuit board, not the display):

Included with the RaspberrySTEM CREATOR Kit is a bag labeled, LED Matrix RaspberrySTEM Cell. This bag contains all the parts that you'll need to build and program the LED Matrix. In that bag you should find the following:

Installing the Mounting Posts

The LED Matrix comes with two small mounting posts and screws that are used to attach the LED Matrix to the breadboard. The mounting posts should be installed prior to using the LED Matrix. To install the mounting posts, follow these steps:

Step #1: Remove the LED Display from the Circuit Board

The LED Matrix consists of two parts, connected together by 16 pins (8 on each side). To install the mounting posts, you will need to pull the top part (the LED display) from the bottom part (the circuit board). This is done by gripping the edges of the LED display gently in one hand, gripping the edges of the circuit board gently in the other hand and carefully separating the display from the board. Try to apply equal pressure all around the display to avoid bending or breaking any pins.

Once the display is separated from the circuit board, set the display aside.

Step #2: Attach the Mounting Posts to the Circuit Board

On the circuit board corners are four holes, two labeled "A" and two labeled "B". You can attach the mounting posts either in the "A" holes or the "B" holes, but you will want to ensure that both mounting posts are attached to holes with the same letter (either both in "A" or both in "B"). Attach the mounting posts, as shown below:

Use the triangular plastic piece (a guitar pick) to tighten the mounting post screws.

Step #3: Re-Attach the LED Display to the Circuit Board

Once the mounting posts are secured and tightened, you'll need to re-attach the LED display to the circuit board. Holding the circuit board in one hand and the LED display in the other, carefully align the 16 pins on the LED display with the 16 holes on the circuit board. Once the pins and holes are aligned, gently press the LED display into the circuit board, applying equal pressure around the display to avoid breaking pins.

Note: There is a specific orientation for the LED display to be mounted on the circuit board. The serial number of the LED display should be be on the same side as the words "MATRIX TOP" on the circuit board, as shown in the picture below:

Power Up the LED Matrix

Note: For the next several projects, we'll be introducing new components that will require at least one-third of the breadboard space. If you have enough room remaining on the breadboard, you can use that empty space; otherwise, we recommend removing some or all of the circuits you currently have on the breadboard to allow enough space for the next set of projects.

The first step in using the LED Matrix is to provide it power and ground. While this won't be enough to do anything interesting with it, by doing this, we can at least verify that it's working properly. Before you get started, you'll want to ensure that the breadboard has power (3.3V) and ground (GND) coming from the Lid Connector Board.

Step #1: Place the LED Matrix on the breadboard

Once the binding posts are attached to the LED Matrix, attaching it to the breadboard is as simple as inserting the binding posts into the breadboard anywhere you'd like. Keep in mind that the LED Matrix doesn't connect to the breadboard electrically -- meaning, it doesn't need to be attached to the breadboard to work. All of the signals going between the RaspberrySTEM CREATOR Kit and the LED Matrix will be going over the LED Matrix cable, and not through the breadboard.

Step #2: Attach LED Matrix Cable to the LED Matrix

Once the LED Matrix is situated on the breadboard, you're going to attach the LED Matrix cable, as shown:

Note: The plastic part of the cable has a top and bottom -- the top of the cable is all black, the bottom of the cable has access to the silver pins of the wires. You will want to ensure that the cable is plugged into the LED Matrix with the top of the cable (all black plastic) is facing up.

Step #3: Attach the 3.3V Pin to Power and GND to Ground

Once the cable is attached to the LED Matrix, you'll want to connect the 3.3V wire and the GND wire, as follows:

Once power and ground are correctly attached, you should see vertical and horizontal bars sweep across the display a single time. This is indication that the LED Matrix is powered up and working correctly.

Step #4: Attach SCLK, MOSI, CE & MISO Pins to Lid Connector Board

Now that we've verified that the LED Matrix can be powered up and is working properly, we can finish wiring it so that we can start controlling it with our software. To finish wiring the LED Matrix we need to make the following connections:

  1. Connect SCLK on the LED Matrix to SCLK on the Lid Connector Board.

  2. Connect MOSI on the LED Matrix to MOSI on the Lid Connector Board.

  3. Connect CE on the LED Matrix to CE0 on the Lid Connector Board.

  4. Connect MISO on the LED Matrix to MISO on the Lid Connector Board.

Note: Both CE0 and CE1 are on the Lid Connector Board -- ensure that you're connected to CE0.

Note: Use a separate jumper wire (this is not included in the LED Matrix bag, but you can use any of the provided colored wires) to connect MISO from the right side of the LED Matrix to the MISO pin on the Lid Connector Board (see the blue wire in the picture below).

Here is what the breadboard should look like with the LED Matrix fully wired:

Note: If you have a wire attached to the RST pin on the LED Matrix, you have likely attached the LED Matrix cable upside down. You will want to remove the cable and start over.

Testing the LED Matrix

In order to display graphics on our LED Matrix, we use a set of functions that allows us to create, draw, display and erase a framebuffer.

Framebuffers

You can think of a framebuffer as a temporary "canvas" that sits inside of a computer (specifically inside the computer's memory).

We use a framebuffer with the LED Matrix. The RaspberrySTEM API provides a set of functions to use the framebuffer:

Here is the basic code we'll use to initialize our LED Matrix and draw a single dot to it:

Let's take a look at what our code is doing:

When you run this code, you should see a dot appear on the LED Matrix towards the middle of the display.

home | prev | next