Introduction: Raspberry Pi LED Scrolling Text Display

Picture of Raspberry Pi LED Scrolling Text Display

Hi I'll be showing you how to use a Raspbery Pi and an LED matrix to display some scrolling text.

Step 1: Gather Materials

Picture of Gather Materials
Parts

Tools

  • Soldering Iron + Solder

Step 2: Solder HAT Together

Picture of Solder HAT Together

There are three small pieces that come with the Matrix HAT kit, which should be soldered to the top of the HAT itself.

Step 3: Connect Everything Together

Picture of Connect Everything Together

This step is pretty straight forward.

  1. You should first connect the HAT itself to the Pi, using the 20x8 header bridge.
  2. Then connect the data cable between the HAT and the LED matrix.
  3. After that, The matrix itself needs power, which can be supplied by plugging a power cable into the HAT or using a different connector to bypass the HAT.

After this, everything should be connected, and once you supply power to both the Pi and the matrix, you should be good to go!

Step 4: Setup Pi + Python

Picture of Setup Pi + Python

Connect your PI to a monitor or a laptop and ssh in.

Then you'll need to install Python with these commands:

sudo apt-get update
sudo apt-get install python-dev python-imaging

Then download the code for driving the matrices:

wget https://github.com/adafruit/rpi-rgb-led-matrix/archive/master.zip 
unzip master.zip

Now you'll need to cd into the directory you just unzipped, and build the driver

cd rpi-rgb-led-matrix-master/
make

Now you can run the test demo led-matrix with this command, where D is any number from 1-9

sudo ./led-matrix -D 4

In the next step, I'll be showing you how to write your own program!

Step 5: Programming the Matrix

Picture of Programming the Matrix

Use the following code, replacing the message with whatever you want, along with the colors for each part.

import os
from PIL import ImageFont from PIL import Image from PIL import ImageDraw text = (("Raspberry Pi ", (255, 0, 0)), ("and ", (0, 255, 0)), ("Adafruit", (0, 0, 255))) font = ImageFont.truetype("/usr/share/fonts/truetype/freefont/FreeSans.ttf", 16) all_text = "" for text_color_pair in text: t = text_color_pair[0] all_text = all_text + t print(all_text) width, ignore = font.getsize(all_text) print(width) im = Image.new("RGB", (width + 30, 16), "black") draw = ImageDraw.Draw(im) x = 0; for text_color_pair in text: t = text_color_pair[0] c = text_color_pair[1] print("t=" + t + " " + str(c) + " " + str(x)) draw.text((x, 0), t, c, font=font) x = x + font.getsize(t)[0] im.save("test.ppm") os.system("./led-matrix 1 test.ppm")

Comments

pkilcoyne (author)2016-03-28

Also,

I cannot find the "fonts" directory on my Raspbian install :(

richardw151 (author)pkilcoyne2016-03-31

Try:

fc-list

shows my fonts to be in

/usr/share/fonts/

pkilcoyne (author)2016-03-27

Hi there,

nice project.

Question, is the RGB matrix HAT absolutely necessary, can you not just connect LED panel directly to the RPi GPIO?

Also, could you comment your python code please? I'm new to python so can get confused easily and often :(

Great work though, thank you,

Paul

DIY Hacks and How Tos (author)2015-11-25

Cool looking display

About This Instructable

11,631views

29favorites

License:

More by schwarpi:Raspberry Pi LED Scrolling Text Display
Add instructable to: