Skip to content

Matrix LED TinyShield Tutorial

If you're looking to add some visualization to your project, the Matrix LED TinyShield provides a great way to display text, images, and other feedback across 54 LEDs coming in red, green, or amber.

This tutorial teaches the basics of using this TinyShield for various applications.

Learn more about the TinyDuino Platform


Description

The Matrix LED TinyShield has 54 LEDs mounted to the surface of the board in a 6 x 9 grid. These LEDs only use eight signals from the TinyDuino using a technique called Charlieplexing, which makes each LED individually addressable, and saves the other I/O pins for other functions of your project. This TinyShield is compatible with the popular Arduino LoL (Lots of LEDs) Shield Library created by Jimmie Rodgers.

To see what other TinyShields are compatible with this TinyShield, see the TinyShield Compatibility Matrix

Technical Details LED Specs
  • 54 Top Facing LEDs in a 6×9 Matrix
  • Charlieplexed IO on 8 signals
  • Available in Green, Amber or Red
TinyDuino Power Requirements
  • Voltage: 3.0V - 5.5V 
  • Current:
    • 1.5mA per LED (3.0V)
    • 5.0mA per LED (5.0V)
    • Due to the low current, this board can be run using the TinyDuino coin cell option.
Pins Used
  • Pins 2, 3, 4, 5, 6, 7, 8, and 9 are used, see schematic or sample code for connections
Dimensions
  • 20mm x 20mm (.787 inches x .787 inches)
  • Maximum Height (from lower bottom TinyShield Connector to upper top TinyShield Connector): 3.31mm (0.130 inches)
  • Weight: .75 grams (.027 ounces)

Notes

  • The TinyZero will work fine with the code given in this tutorial. However, other projects and tutorials for this board will not work if the sketches use the Charlieplexing library. This is due to the different processor architectures of the TinyDuino and TinyZero.
  • The Charlieplexing library has to be modified if used such that the pinouts are relevant to the TinyShield.

Materials

TinyZero and Matrix LED TinyShield

Hardware

Software


Hardware Assembly

On top of your processor board of choice, place the Matrix LED TinyShield. Plug a MicroUSB cable into the micro USB port (or USB shield) and then plug the cable into an available USB port on your computer. Make sure the processor is switched on.

An assembled stack of a TinyZero and Matrix LED TinyShield.


Software Setup

First, open the Arduino IDE. If you don't have it installed or are unfamiliar with how to upload the code, check out the TinyDuino Setup Tutorial or TinyZero Setup Tutorial depending on which processor you're using. No special libraries are required for this tutorial.

Upload Program

Code
/*
  TinyDuino Matrix LED TinyShield Example Sketch

  This example illuminates one LED at a time,
  iterating through each LED in the matrix.

  Written 10 January 2019
  By Hunter Hykes
  Modified 
  By 

  https://TinyCircuits.com
*/

const int highpin[54] = {
  5, 8, 6, 2, 8, 2,
  6, 6, 9, 7, 9, 3,
  5, 7, 6, 3, 8, 3,
  7, 6, 4, 7, 4, 4,    
  5, 2, 6, 4, 8, 2,
  8, 5, 3, 7, 3, 9,
  5, 3, 6, 9, 8, 3,
  9, 5, 2, 7, 2, 9,
  5, 4, 7, 8, 9, 4   
};

const int lowpin[54] = {
  6, 6, 9, 7, 9, 3,
  5, 8, 6, 2, 8, 2,
  7, 6, 4, 7, 4, 4,
  5, 7, 6, 3, 8, 3,    
  8, 5, 3, 7, 3, 9,
  5, 2, 6, 4, 8, 2,
  9, 5, 2, 7, 2, 9,
  5, 3, 6, 9, 8, 3,
  4, 5, 8, 7, 4, 9
};

void setup() {
  matrixOff();
}

void loop() {
  for(int i = 0; i < 54; i++) {
    lightLED(i);
    delay(50);
    matrixOff();
  }
}

void matrixOff() { //sets each IO pin used by the board LOW
  for(int i = 2; i < 10; i++) {
    pinMode(i, INPUT);
    digitalWrite(i, LOW);
  }
}

void lightLED(int ledNum) { //sets the specified LED on (0-53)
  digitalWrite(highpin[ledNum],HIGH);
  digitalWrite(lowpin[ledNum],LOW);
  pinMode(highpin[ledNum],OUTPUT);
  pinMode(lowpin[ledNum],OUTPUT);
}

Once the upload is complete, you should be able to see the illuminated LED "travelling" across each row through the matrix.

Common Issues

The TinyZero will work fine with the code given in this tutorial. However, other projects and tutorials for this board will not work if the sketches use the Charlieplexing library. This is due to the different processor architectures of the TinyDuino and TinyZero.


Downloads


Contact Us

If you have any questions or feedback, feel free to email us or make a post on our forum. Show us what you make by tagging @TinyCircuits on Instagram, Twitter, or Facebook so we can feature it.

Thanks for making with us!