24×16 RGB Display with PWM

December 8th, 2008 Leave a comment Go to comments

Information:
After seeing a movie on the website of SparkFun (See YouTube movie) I bought 6 SPI controllable 8×8 RGB Led Panels. After recieving them I needed a way to interface them to the Embedded Master.  I connected all the panels together by a flatcable between the ICSP programming connectors removing the MISO and CS wires between each panel. Next I build a simple board with a PCF8574A (An I2C 8-bit I/O Expander) that provides the Chip Select signals for the RGB Matrix boards. The SPI from the flatcable and the I2C interface from the PCF8574A both connect to the Ext connector of the Embedded Master. Pictures of the backpacks connected are available below.

Atmega8 firmware for PWM:
After writing some testing programs and an interface class to the panels I quickly discovered the lack of some simple PWM to control the LED brightness. Looking at the backpack of the Led panels they contain an Atmel atmega8 controller and three 74LS595 serial shift registers to control the 64 RGB LEDs. With the default programming the backpack only displays 7 colors.  Luckally you can re-program the controllers, so I wrote a new program for the backpacks allowing 4-step PWM on each R/G/B Channel. The sourcecode for the new firmware can be downloaded here: avr_rgbmatrix.zip (You need WinAVR and an ICSP programming cable) to update the firmware.

SHT11 Interface:
To display the temperature and humidity indoor I bought an SHT11 sensor from Parallax. This sensor reads the temperature and relative humidity and has a serial interface. Unfortunatly not a regular one like SPI or I2C so I wrote a class for this sensor. For more info visit the SHT11 Class page.

To display images I made a converted using PHP. This script converts an JPG, PNG, GIF or BMP to an C# byte[] array. You can find the script on http://www.koolstof.be/projecten/img2hex/ The sourcecode is also available on that page. 

 

The current application displays the following information:

  • Temperature from Yahoo
  • Humidity from Yahoo
  • Weather image based on Yahoo Weather code
  • Temperature from SHT11
  • Humidity from SHT11
  • Time synced with NTP time server
  • Date synced  with NTP time server
  • Random animation (Stars, Lines and random dots)

 

Download:
You can download the full Visual Studio 2008 solution here: MF_RGB_Matrix.zip

 

Some photo’s from Flickr: (Go to the Flickr page)

And a movie from YouTube:

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • NuJIJ
  • Technorati
  • Yahoo! Bookmarks
  1. dh
    December 21st, 2008 at 20:45 | #1

    Hello,
    Thanks for your PWM code. I am studying your code. But I cannot understand the array values of red[],green[],blue[]. Can you tell me the meaning of array values?

  2. December 22nd, 2008 at 06:55 | #2

    Yes,

    It has to do with the way the leds are connected to the shift register. Idealy bit 0 coresponds to LED 0, bit 1 to LED 1, bit 2 to LED 2, etc.. This isn’t the case, due to (i think) pcb costs. The red[], green[] and blue[] arrays convert led number in to the wright bit value.

  3. dh
    December 22nd, 2008 at 18:46 | #3

    Thanks your reply. Now I don’t have LED unit. So I don’t know the exact pin alignment. Maybe it is related with the pin alignment?
    I want to make 16×16 RGB LED display and control board like sparkfun. I think it is possible. And I want to control the RGB LED units by atmega128 across SPI. About SPI, to send data to RGB LED units
    1. setup SPI
    2. select RGB LED
    3. send data by SPDR
    4. no select RGB LED
    Is this process OK?
    Because I don’t use c#, so I cannot understand master program.
    Thanks.

  4. December 23rd, 2008 at 00:36 | #4

    Yes,

    Each byte you write to the rgb controller is stored in the internal data array. The data array must be selected (CS Low) to allow writing. When CS goes high the counter for the internal data array is reset to 0. This insures that a next write always starts at byte 0 of the data array.

    In my program I assert CS (By making it low)
    Write 64 bytes to the controller
    De-assert CS (By making it high)

    I think 16×16 is posible with the atmega128. Only I wouldn’t use so much shift registers when controlling 16×16x3 = 768 LEDs. But this should be a problem, the atmega128 has enough IO ports.

  5. dh
    January 2nd, 2009 at 15:38 | #5

    Hello,
    I am testing SPI master and slave program for atmega128. It works good. I test with some sample data from master to slave.
    Now I encountered a problem of speed of sending data.
    When using 16×16 dot matrix, the time takes too long because of its internal loop like 16,16,pwm loop. I can estimate if I use 10 16×16 matrix, it will take so long time.
    In this case what is good for master?
    What device do you use for master?

  6. March 31st, 2009 at 21:37 | #6

    i want schematic & parts 24X16 rgb led matrix

  1. February 3rd, 2009 at 16:39 | #1