[Tutorial] How to use Dot LED Matrix Display with Arduino

###Hi!,

In this post I’m going to show you how to use 16x16 Dot LED Matrix Display with Arduino.

It has a column control 74HC595 and line control 74HC138. Let’s check.

To turn the development easier, I’ll show your the .PNG Arduino Framework :)

About .PNG Arduino Framework

The .PNG Arduino Framework was developed by students of Unesp – São Paulo State University, Brazil, with the goal to turn Arduino project development easier. The framework has a chain of modular classes, compatible with some Arduino components.

Source code

Get updates Follow @aron-bordin
Star it: Star
Contribute: Fork
Download: Download

I - About the item

In this tutorial, I’m using this Arduino LED Matrix: http://www.elabpeers.com/led-matrix-display.html.

I’m using the 16x16 LED Matrix.

II - Basic usage

Connect the LED Matrix with your Arduino like the image bellow:

Led Matrix

After downloading and installing the .PNG LedMatrix module, the following code:

#include "LedMatrixObject.h"

LedMatrixObject *led = new LedMatrixObject(2, 3, 4, 5, 6, 7, 8, 9);

unsigned char Scene[16][16] = {
  {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
  {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
  {1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1},
  {1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1},
  {1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1},
  {1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1},
  {1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1},
  {1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1},
  {1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1},
  {1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1},
  {1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1},
  {1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1},
  {1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1},
  {1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1},
  {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
  {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
};

void setup(){

}

void loop(){
  led->setScene(Scene);
  led->draw();
}

When creating the object, we define the PINs used. In this example we are using the same PINs visible in the image.

If everything works as expected, you’ll get the following result:

LED Matrix example

III - How does it works?

From now, I recommend you using this class to develop LED Matrix applications on your Arduino. It’s easier.

In the beginning of the code, you have the following variable:

unsigned char Scene[16][16] = {
  {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
  {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
  {1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1},
  {1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1},
  {1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1},
  {1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1},
  {1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1},
  {1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1},
  {1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1},
  {1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1},
  {1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1},
  {1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1},
  {1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1},
  {1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1},
  {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
  {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
};

That variable is going to be draw in your screen:

  • 0 turn the LED ON
  • 1 turn it off.

So, to draw anything else, you can edit it on the main loop();

void loop(){
  led->setScene(Scene); // optional, uses the variable scene created above
  led->setLedOn(0, 0); //optional, change the led 0, 0
  led->setLedOff(8, 5); //optional, change the led 8, 5
  led->draw(); //obrigatory, draw everything
}

Before the draw() call, edit the Scene variable as necessary and draw anything that you want :)

IV - Available Methods();

Check all available methods here: http://png-arduino-framework.readthedocs.org/led_matrix.html

It’s just a simple post, I’m going to post some games created with this Arduino LED matrix soon.

Thanks for reading,

Aron Bordin.

Aron Bordin

Aron Bordin
Computer Science Student and AI researcher. Always coding something fun :)

[Tutorial] Developing Android Background Services

### Welcome!In this post, I'll show you how to develop background services on Android Studio. We'll see two type of services: `Service` a...… Continue reading