Categories
TUTORIALS

Displaying MESSAGES THROUGH AN LED MATRIX

This tutorial shows you how to display written messages on an 8×8 LED Matrix. Emitting such messages is part of a larger project to respond to an opioid overdose through sensor responses. In this case, the LED matrix will display the message: “SOS Call 9-1-1” to bystanders should an individual be in danger of an overdose.

The parts for this tutorial can be more easily put together if you have a solder or a second standard breadboard. However, this tutorial will show you how to circumnavigate such challenges to display messages on the LED matrix when you have just one breadboard and are solderless.  

Parts List
  • Arduino Uno
  • 1C2 LED Matrix 8×8
  • HT16K33 Backpack
  • 4-pin header
  • Breadboard
  • 4 Wires
Circuit Diagrams
Breadboard Circuit Diagram
Schematic Circuit Diagram
1: Assembling the LED Matrix to the Backpack

If you had a solder handy, you would be able to solder the matrix to the backpack for a seamless connection. Moreover, the matrix is too large to fit on a standard breadboard given the divider that runs through the middle of the breadboard and a second breadboard could also be helpful for the connection. However, it is possible to get a connection with just one breadboard and without a solder with some accommodations.

First, you need to ensure metal contact from the backpack’s 16 brass rings along the outer edge of the backpack to the LED matrix. You will first slip the LED matrix pins through the backpack’s brass rings to connect the two parts. Notice that since the pins are smaller than the rings, the two metal parts are not touching. To ensure a constant connection, bend the pins of the LED matrix 90o along the outer edge of the backpack to make contact with the brass rings. Your matrix-backpack connection should now appear to look like a “spider.”

2. Connecting to the Breadboard

Once the LED matrix is connected to the backpack, place the 4-pin header on the breadboard along any letter column with the short side in the breadboard and the long side poking upwards. Next, slip the edge of the backpack with 4 brass rings over the header pins. Ideally, these parts would be soldered together, however, without a solder, this connection will have to be manually held together. Tinfoil can help the connection as well, but ensure that the tinfoil only touches one header pin at a time if you decide to use it.

Next, we will connect 4 wires to the breadboard from the Arduino. These wires should connect to the breadboard in the same rows as the 4-pin header. The four specific connections back to the Arduino are:

  • VCC (+) to 5V
  • GND (-) to GND
  • SDA (D) to Pin A4
  • SCL (C) to Pin A5
3. Utilizing a Pixel to Matrix Converter to Draw

The LED Matrix is 8 lights by 8 lights for a total of 64 lights on a grid. Each of these lights can be controlled by a matrix indicating whether each light needs to be OFF or ON (0 = LED OFF and 1 = LED OFF).

Download the Pixel to Matrix Converter to help you draw the shapes, numbers, or letters you would like your matrix to display. Using this converter you can click on each position of the grid to indicate whether the LED should be on or off. Using this particular converter ORANGE positions indicate ON and GREEN positions indicate OFF. Download here: https://drive.google.com/file/d/1OyfBdyevPCnSMZCYmoSB7yr5k_8Ozsb5/view

Once you have your grid pattern, click the GENERATE button to create the corresponding code to the pattern you have created. For example, below you will find the code matrix for the letter “S”.

0 1 1 1 1 1 1 1
0 1 1 1 1 1 1 1
0 1 1 0 0 0 0 0
0 1 1 1 1 1 1 0
0 1 1 1 1 1 1 0
0 0 0 0 0 1 1 0
1 1 1 1 1 1 1 0
1 1 1 1 1 1 1 0

As you can see above the “1s” form the S pattern on the grid. Save these pieces of code to enter into your Arduino software coding. Once you have all your patterns, place each block into your code with no spaces. These blocks form the “S” “O” “S” blink display on the matrix.

The final parts of the message alert bystanders to “Call 9-1-1.” Instead of blinking these letters individually like above, these will be displayed as a string that scrolls from the right side of the matrix, this will allow bystanders to read the message left to right through Arduino code.

“9” from the “9-1-1” string displayed on the matrix
Code
/*************************************************** 
Tutorial on LED Matrix IC2 Backpack with 1 breadboard and no soldering for an SOS Call 9-1-1 Signal 
using flash and scroll lettering 
 
This project combines code from the Adafruit LED Backpack Library Matrix 8x8 sketch and 
a Pixel to Matrix Converter found here: https://drive.google.com/file/d/1OyfBdyevPCnSMZCYmoSB7yr5k_8Ozsb5/view

Designed specifically to work with the Adafruit LED Matrix backpacks 
 -----> https://www.adafruit.com/product/1080

These displays use I2C to communicate, 2 pins are required to interface.
This backpack works with 2 Addresses, so select pins: 0x70, 0x71, 0x72 or 0x73. 

Original Sample Sketch Written by Limor Fried/Ladyada for Adafruit Industries.  
BSD license, all text above must be included in any redistribution
 ****************************************************/
// Connections
  // - VCC (+) to 5V
  // - GND (-) to GND
  // - SDA (D) to A4
  // - SCL (C) to A5

//Libraries and Product
#include <Wire.h>
#include <Adafruit_GFX.h>
#include "Adafruit_LEDBackpack.h"   //necessary 

Adafruit_8x8matrix matrix = Adafruit_8x8matrix();

void setup() {
    
  matrix.begin(0x70);  // pass in the address
}

static const uint8_t PROGMEM    // Setting Static Constants for the LED Matrix
  S_bmp[] =                    // Declaring the "S" Shape Bitmap for the Matrix
  { B01111111,                // String of characters dictates each LED position as on or off on 8x8 gird
    B01111111,               // 0 = Off LED 1 = On LED  
    B01100000,
    B01111110,
    B01111110,
    B00000110,
    B11111110,
    B11111110 },
    
  O_bmp[] =               // Declaring the "O" Shape Bitmap for the Matrix 
  { B11111111,
    B11111111,
    B11000011,
    B11000011,
    B11000011,
    B11000011,
    B11111111,
    B11111111 },
    
  S2_bmp[] =          // Declaring the second "S" Shape Bitmap for the Matrix 
  
  { B01111111,
    B01111111,
    B01110000,
    B01111110,
    B01111110,
    B00000110,
    B11111110,
    B11111110 };

void loop() {
  matrix.clear();                                     // Starting with clear matrix where all LEDs are off
  matrix.drawBitmap(0, 0, S_bmp, 8, 8, LED_ON);      // Drawing the "S" Bitmap according to void setup configuration
  matrix.writeDisplay();                            // With 2000 milisecond delay
  delay(2000);

  matrix.clear();                                    // Transitioning with clear matrix where all LEDs are off
  matrix.drawBitmap(0, 0, O_bmp, 8, 8, LED_ON);     // Drawing the "O" Bitmap according to void setup configuration
  matrix.writeDisplay();                           // With 2000 milisecond delay
  delay(2000);

  matrix.clear();                                    // Transitioning with clear matrix where all LEDs are off
  matrix.drawBitmap(0, 0, S2_bmp, 8, 8, LED_ON);    // Drawing the second "S" Bitmap according to void setup configuration
  matrix.writeDisplay();                           // With 2000 milisecond delay
  delay(2000);


  matrix.setTextSize(1);                          // Setting matrix text size to 1
  matrix.setTextWrap(false);                     // Preventing text wrapping to scroll text continuously through matrix
  matrix.setTextColor(LED_ON);                  // Turning LED On
  for (int8_t x=0; x>=-36; x--) {              // Setting for loop to position letters side by side for the scroll
    matrix.clear();                           // Transitioning with clear matrix where all LEDs are off
    matrix.setCursor(x,0);                   // Defining letter positions to print one at time side by side
    matrix.print(" Call");                   // Printing "Call" on the matrix
    matrix.writeDisplay();                 // With 100 milisecond delay
    delay(100);
  }
  matrix.setRotation(0);                  // Prevent rotation and keep scroll at the same angle
  for (int8_t x=7; x>=-36; x--) {        // Setting new for loop to position letters side by side for the scroll
    matrix.clear();                     // Transitioning with clear matrix where all LEDs are off
    matrix.setCursor(x,0);             // Defining letter positions to print one at time side by side
    matrix.print("9-1-1");            // Printing "9-1-1" on the matrix
    matrix.writeDisplay();           // With 100 milisecond delay
    delay(100);
  }
}

Leave a Reply

Your email address will not be published. Required fields are marked *