Shield MaTrix V0.9

Introduction

Shield MaTrix is a stackable Shield for Arduino, which makes it possible to learn programming using the most simple sensors on board.

Feature

  • Arduino Mega compatible (recommended Freaduino Mega V1.4 (ATMega 2560 ) )

  • Support for Arduino Shield

  • Support for wireless devices based on the nRF24L01+, xBee

  • Support Matrix LED 60mm 8X8 ( bright red , bright green , yellow)

  • IR control ( remote control )

  • RGB LED ( to indicate the various parameters)

  • Clock button ( on / off various settings )

  • Buzzer ( Alarm or pressing the remote control buttons )

  • Light sensor (automatic illumination matrices )

  • RTC ( real time clock )

  • I2C- interface (optional I / O)

  • Voltage 9-24 V or USB controller (recommended 12V 2A)

Application Ideas

  • Digital clock (synchronization NTP) with alarm
  • Weather station (temperature-house street-cellar, pressure, humidity)
  • Marquee (reading e-mail, social networks, etc.)
  • Data transfer (on a similar device)

The principle of data display

To display different information on the LED matrix display uses dynamic . At the same time information is displayed only one line ( corresponding LED lights (red and (or ) green ) ) , all other lines - repaid. The next step - the previous line is extinguished and ignited the next line ( for her current LEDs). Switching rows is very fast and eyes perceive this switch as a single image .

To minimize the number of pins involved are two different types of chips: the shift registers (used for control columns) and a demultiplexer ( control lines).

Shift registers included chain and connected via SPI ( pins involved are described below).

Demultiplexer has three address inputs (DA0, DA1, DA2) - a combination of “0” and “1” at the entrances clearly points to one of the 8 outputs, which will be active level . Additionally the demultiplexer has control inputs (E1, E2, E3) - with the first two (E1 and E2, they are connected in our scheme ) organized a complete quenching of the matrix , and with the input E3 - organized brightness adjustment (using PWM) .

Interfaces

  • Interface for 4 bicolor LED matrix :

    • Set shift registers (74HC595 - 8 pcs.) To control the columns of LEDs

      • Demultiplexer 74HC138 to control the rows of LEDs and their brightness (via PWM)
  • Built-in clock (RTC) - based on the DS1307 with battery backup battery (CR1220 or CR1226)

  • Interface for RF- module nRF24L01 +

  • Clock button (for example, to turn off the alarm sound )

  • IR receiver at 38kHz ( for remote control )

  • Wiring for connecting RGB- LED with common cathode or anode (selected by jumper )

  • Light sensor ( for example, to automatically adjust the brightness)

  • Piezo transducer ” beeper “

  • I2C- interface

  • xBee- interface

  • Interface for Arduino- Shield

Pins on the board, involved on Arduino Mega:

  • D5 - IR receiver

  • D24 - clock button

  • xBee:

    • D16 - DIN

      • D17 - DOUT
  • I2C (DS1307)

    • D20 - SDA

      • D21 - SCL
  • RGB-LED (check):

    • D34 - red

      • D35 - Green

      • D36 - Blue

  • nRF24L01 +:

    • D19 - RF_IRQ

      • D37 - RF_SCK

      • D38 - RF_MISO

      • D39 - RF_MOSI

      • D40 - RF_NSS

      • D41 - RF_CE

  • D45 - squeaker

  • A7 - light sensor

  • Shift Registers:

    • D42 - SS

      • D51 - MOSI

      • D52 - SCK

  • Demultiplex

    • D49 - DA0

      • D48 - DA1

      • D47 - DA2

      • D44 - E3 (brightness)

      • D43 - E1, E2 (quenching)

Cautions

Schematic

The right side of the board (when viewed from the matrix) are:

  • Clock button

  • Interface for nRF24l01 +

  • Place mounting RGB-LED

  • Select jumper type LEDs (common anode or common cathode)

  • IR receiver

  • I2C - Interface

On the left side of the board are:

  • Light sensor

  • Piezo buzzer (beeper)

Schematic of the device

Necessary libraries

To use the various components Shield MaTrix requires the following libraries:

Displays information on the matrix - MaTrix - MaTrix (including a simple display test and two real time display sketches.)

Additionally required libraries that are used during operation of libraries:

Features using libraries

Only two libraries require little comment on their use:

IR receiver

Since the IR receiver connected to digital pin of 5 must file / IRremote / IRremoteInt.h correct code as follows:

...

// Arduino Mega
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
  //#define IR_USE_TIMER1   // tx = pin 11
  //#define IR_USE_TIMER2     // tx = pin 9
  #define IR_USE_TIMER3   // tx = pin 5
  //#define IR_USE_TIMER4   // tx = pin 6
  //#define IR_USE_TIMER5   // tx = pin 46

...

nRF24L01+

Initialize the module as follows:

...

//iBoardRF24 radio(CE,CSN,MOSI,MISO,SCK,IRQ);
iBoardRF24 radio(41,40,39,38,37,19);

...

Library functions MaTrix

To use the library in your sketch MaTrix need to declare a function void setup () to enter the following line of code:

 #include <SPI.h>
 #include <MaTrix.h>  //connection library MaTrix

 MaTrix mymatrix;       //object creation mymatrix

Variables

byte array[8][8] - main array. The data from this array is determined that the currently displayed on the LED matrix

 byte array[8][8] = { // An array of 64 bytes
   {B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000},  // строка 7
   {B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000},  // строка 6
   {B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000},  // строка 5
   {B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000},  // строка 4
   {B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000},  // строка 3
   {B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000},  // строка 2
   {B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000},  // строка 1
   {B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000}   // строка 0
   // red3      green3      red2      green2      red1      green1       red0      green0
 };

Each bit corresponds to the corresponding LED in the matrix. 0 - LED “extinguished”, 1 - LED “lit”

byte shadow[8][8] - additional (“shadow”) array. Library functions used for organizing various effects and scrolling text (data from the shadow of the array for a particular effect rewritten the rule of the “shadow” of the array in the main).

 byte shadow[8][8] = { //An array of 64 bytes
   {B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000},  // строка 7
   {B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000},  // строка 6
   {B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000},  // строка 5
   {B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000},  // строка 4
   {B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000},  // строка 3
   {B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000},  // строка 2
   {B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000},  // строка 1
   {B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000}   // строка 0
   // red3      green3      red2      green2      red1      green1       red0      green0
 };

Definitions

 // Color
 #define RED    0
 #define GREEN  1
 #define YELLOW 2
 // delay iteration in "drawing" effects (ms)
 #define VSLOW  500
 #define SLOW   150
 #define MID    100
 #define FAST   50
 #define VFAST  25
 // effects
 #define FADE   4
 #define LEFT   3
 #define UP     1
 #define DOWN   2
 #define NONE   0
 // hardware data
 #define BRIGHT 44    // brightness (pin 44 - PWM)
 #define LightSENS A7 // light sensor

Main function

mymatrix.init();

_Description_: nitialization module.

mymatrix.clearLed();

_Description_:cleaning the display.

mymatrix.brightness(byte brightLevel);

_Description_: sets the display brightness.
_brightLevel_:brightness level (byte), a value of 255 - set to maximum brightness.

Example of use:

 mymatrix.brightness(177);

mymatrix.get Brightness();

_Description_: returns the current display brightness.

Example of use:

 Serial.println(mymatrix.getBrightness());

printString(String s, byte pos, byte color, unsigned char *Font, char effect, int speed);

_Description_: displays the specified string.
_pos_: starting position of the first character (byte). Counting from the right edge of the matrix, starting with 0.
_color_: color (byte). Three predefined values - RED, GREEN, YELLOW
_*Font_: a pointer to the font (unsigned char). Fonts available at the library: character - font5x8 (Latin), font6x8 (Latin and Cyrillic); digital - digit6x8bold, digit6x8future. Details about fonts, see the file fonts.c of the library archive MaTrix.
_effect_: the effect of the inscription (char). Available predefined values: LEFT, UP, DOWN (shift in the corresponding direction), FADE (manifestation), NONE (No effect - instantly). Default value - NONE.
_speed_: playback speed effect (int). Available predefined values: VSLOW, SLOW, MID, FAST, VFAST (from "very slow" to "very quickly"), default value - MID.

Example of use:

 mymatrix.printString("123", 3, GREEN, font6x8, UP, SLOW);

printRunningString(String s, byte color, unsigned char *Font, int speed);

_Description_: displays the defined "running" line.
_color_: color (byte). Three predefined values - RED, GREEN, YELLOW
_*Font_: a pointer to the font (unsigned char). Fonts available at the library: character - font5x8 (Latin), font6x8 (Latin and Cyrillic); digital - digit6x8bold, digit6x8future. Details about fonts, see the file fonts.c of the library archive MaTrix.
_speed_: playback speed effect (int). Available predefined values: VSLOW, SLOW, MID, FAST, VFAST (from "very slow" to "very quickly"), default value - MID.

Example of use:

 mymatrix.printRunningString("MaTrix test!", RED, font6x8, FAST);

Auxiliary functions

printArray();

_Description_: displays the serial port the current state of the main array (array).

printShadow();

_Description_: displays the serial port the current state of the "shadow" of the array (shadow).

printChar(unsigned char sym, byte pos, byte color);

_Description_: function changes the bulk (array)so that when displayed in the matrix in a predetermined position of the desired output color desired symbol.
_pos_:starting character position (byte). Counting from the right edge of the matrix, starting with 0.
_color_: color (byte). Three predefined values - RED, GREEN, YELLOW

Attention! Font that is used when calling the function must be defined using the setFont.

printCharShadow(unsigned char sym, byte pos, byte color);

_Description_: function similar printChar, but is subject to modification "shadow" array (shadow).

printStr(unsigned char *s, byte pos, byte color);

_Description_: function changes the bulk (array) so that when displayed on a matrix with a predetermined desired position of the array of characters displayed the color desired.
_*s_: a pointer to an array of characters (unsigned char).
_pos_: starting position of the first character (byte). Counting from the right edge of the matrix, starting with 0.
_color_: color (byte). Three predefined values - RED, GREEN, YELLOW

Attention! Font that is used when calling the function must be defined using the setFont.

printStrShadow(unsigned char *s, byte pos, byte color);

_Description_: function similar printChar, but is subject to modification "shadow" array (shadow).

References

Current version of the library MaTrix

Bill of Materials (BOM) /parts list

All the components used to produce the product.

FAQ

Please list your question here:

Support

If you have questions or other better design ideas,

Version Tracker

**Revision** **Descriptions** **Release **
0.9 Prototype 11.04.2013
0.9b Public version 27.10.2013

Help us make it better

Thank you for choosing Seeed. A couple of months ago we initiated a project to improve our documentation system. What you are looking at now is the first edition of the new documentation system. Comparing to the old one, here is the progresses that we made:

  • Replaced the old documentation system with a new one that was developed from Mkdocs, a more widely used and cooler tool to develop documentation system.
  • Integrated the documentation system with our official website, now you can go to Bazaar and other section like Forum and Community more conveniently.
  • Reviewed and rewrote documents for hundreds of products for the system’s first edition, and will continue migrate documents from old wiki to the new one.

An easy-to-use instruction is as important as the product itself. We are expecting this new system will improve your experience when using Seeed’s products. However since this is the first edition, there are still many things need to improve, if you have any suggestions or findings, you are most welcome to submit the amended version as our contributor or give us suggestions in the survey below, Please don’t forget to leave your email address so that we can reply.

Happy hacking