Dot Matrix LED Display with CloudX CloudX

  • img
Project Details

 

Nota Bene

 

 

Let's learn how to use an LED display ─known as the Dot-Matrix LED Display, for image / message display. Here, we’ll be controlling the individual LEDs making up the display module to realize an image being displayed. The circuit connection is a simple one at that; and we’ll be making use of the breadboard and a simple CloudX code to actualize the project.

So far, so good! We've already learnt how: to blink a simple LED via CloudX's output, to use a switch to control LED on and off states via CloudX digital input, to use LED 7-segment display, and to use a shift-register IC to control an array of LEDs. In this lesson, we'll be implementing the popular “smiley face” image display using an 8x8 dot-matrix display module. 

 

List Of Materials Needed 

(The material full kit can readily be sourced via this link.)

  • (i)   CloudX Microcontroller and Softcard
  • (ii)   Dot-Matrix LED Display
Material Kit

 

 

                    Step 1: Hints and Brief Overview

An LED 8x8 dot-matrix module is just an array of LEDs stacked up into 8 rows and 8columns of LEDs, which can be controlled individually or in groups. As a whole, it totals up to 64 LEDs.

LED Matrix Unit

 

The cell layout is such as follows:

Cell Numbering

 

Powering up a possible combination of 64 LEDs at once may result in the microcontroller being placed in a disadvantaged position of not being able to source (provide) or sink the needed current.  Hence, a technique referred to as Scanning is employed to, among other things, aid in properly harnessing the dot-matrix display into creating some artistic effects. So, in order to display an image, we need to turn on and off the LEDs ─representing the image, at a very rapid rate so as to create the special effect (courtesy of Persistence Of Vision) that the image is literally mapped onto the face of the display module. In other words, the phenomenon known as persistence of vision (POV) effect ─whereby an image still remains in our eye for a fraction of a second even after it is gone, is basically at play here.

Hints:

  • (i)  The numbering of the rows and columns of the LEDs typically does not follow the order of the pins underside the matrix module. So, care must be taken to verify the pin-outs of your module before usage. In our own case, we’re using a matrix display labeled 1088BS.
Internal Architecture
  • (ii)  Pin numbering is traced counterclockwise starting from the one labeled pin 1.
Pin Numbering

 

                          Step 2: Build The Circuit

As demonstrated in the schematic diagram below, the matrix display column pins: 13, 3, 4, 10, 6, 11, 15 and 16, connect up to the microcontroller board pins: P1, P2, P3, P4, P5, P6, P7 and P8 respectively;

whereas the display pins 9, 14, 8, 12, 1, 7, 2 and 5 connect up to microcontroller pins P9, P10, P11, P12, P13, P14, P15 and P16 respectively. 

Circuit Diagram

 

NB:

Double click on the dot-matrix display unit on the simulation software (Proteus) –if you’re using the green display variant, to configure the display as thus:

Editing the Proteus Library

 

Meanwhile ─continuing with the general circuit, power can be sourced to the board either via the USB Softcard; or via connecting an external power supply (between 7 – 12 VDC) to the VIN pin of the microcontroller board.

 

 

                       Step 3: Build The Source Code

The simple code that’ll run the project is as follows:

Project Code
Project CodeII

 

Let’s try throw a little more light on the code: 

The “smiley array” represents the very particular image we want to display. The zeroes (0’s) represent the LEDs that should be in OFF state, while the ones (1’s) go for those LEDs that have to be in ON state to practically represent our desired image. Thus:

Image Array

Since the display operation works off a scanning technique, the “row array” takes care of a particular row that is to be powered on per a time.

The essence of inverting the value of an array element picked up by the code is due to the fact that the row actually needs a LOW logic state to become active in our project.

Thus:

Enabling the Rows

 

Now, equipped with all of the above knowledge, you’re encouraged or kind of challenged to pour in your own custom image / symbol, and marvel at what you could get achieved at the end of the day! 

 

                         Step 4: Compile The Code

At this juncture, we can go ahead to compile the source code to obtain the hex file. 

For further details on how to compile the code into an executable (hex) file, you can refer to this link.

 

                   Step 5: Burn In The Hex Code File

Now, the already gotten hex file could be loaded into the microcontroller so as to complete our project. 

For further details on how to burn in the code to the microcontroller, you can refer to this link.

 

                       Step 6: Power Up The Project

Finally power up the project; and voila, it comes on fully alive as designed!

Project Simulated

 

 

 

Now that we’ve been introduced into the basics as to how to utilize the dot-matrix LED display to create some artistic effects; we’re progressing a bit further to explore that area all the more. So, continue on to the next lesson as we attempt to further simplify the whole user experience, making use of some CloudX special libraries.

 

 

------------------------------------------------------------------------------

Copy the code

 

#include <CloudX/M633.h>   

char smiley[] = { 0b00000000,
0b01100110,
0b01100110,
0b00000000,
0b00011000,
0b00000000,
0b11000011,
0b01111110 }; //an array representing the image we want to display

char row[8] = {1,2,4,8,16,32,64,128}; //array to control which row is to be turned
//on/off each time

setup(){
//setup here

portMode(1, OUTPUT); //sets up digital I/O port1 as OUTPUT
portMode(2, OUTPUT); //sets up digital I/O port 2 (pin 9 – pin 16) as OUTPUT
portWrite(1, OFF_ALL); //clears port 1
portWrite(2, ON_ALL); // clears port 2 (pin 9 – pin 16)

loop(){
//Program here

for(byte i=0; i<8; i++){
portWrite(2, ~row[i]); //loads port 2 with the complement of the row array
//element
portWrite(1, smiley[i]); //loads port 2 with the value inside the smiley array
//element
delayUs(20); //waits for (20 microseconds)

}
}
}

 

------------------------------------------------------------------------------------

Share this with friends