Adafruit: 8x8 Yellow LED Matrix Panel

From eLinux.org
Revision as of 20:00, 15 October 2012 by Xinyu1991 (talk | contribs)
Jump to: navigation, search


Overview

The adafriut 8*8 yellow Led matrix has been used in my mini project 2. I'm using it to display some simple pattern, Chinese characters and even some simple animation.

The code of the project is modified from the sample code provided by Dr. Yoder. And my code has been commited to my github: The github repository of Xinyu Cheng.

Here is a display sample of the Led Matrix:

Display Sample.JPG

Hardware Connection

To ensure the matrix works properly, we need to connect the four pins in the device to the Beagle Bone. Here is a picture for the connection:

Hardware Connection.jpg

As we can see in the picture, the VCC and GND are connected to the VCC and GND in the Bone. And the data pin is connected Pin D18, which is I2C2_SDA. Connect the clock pin to Pin D17, which is I2C2_SCL. After the above connection, the hardware part is done.

Software Design

The mainly work of the software here is to display the correct pattern. And the pattern can be depicted through write a correct value (1 or 0) to each LED in the matrix. 1 means the LED is on and 0 means the LED is off.

For example, the pattern of ❤ can be displayed through the array:

Heart_bmp[]={0x0C, 0x1E, 0x3E, 0x7C, 0x3E, 0x1E, 0x0C, 0x00};

I have write a function to implement the display:

//The Function to Display a BMP.
int display(__u16 bmp[], int res, int daddress, int file)
{     
    int i;     
    for(i=0; i<8; i++)      
    {	block[i] = (bmp[i]&0xfe) >>1 |  
        (bmp[i]&0x01) << 7;     
    }     

    res = i2c_smbus_write_i2c_block_data(file, daddress, 16, 	   
    (__u8 *)block);     

    usleep(400000);
}

The codes for the whole project can be found in my github: Codes for Mini Project.

Demo Video