Introduction: Programming 101 With DIY RGB LED Scrolling Message Ticker
What?
This message ticker has 64 full color LEDs in an 8x8 grid. The message being displayed can be changed without recoding anything and can be up to one tweet long (140 characters). It supports the entire ASCII character set.
The ticker can be stretched 3x with almost no changes. (See final steps for more info.)
Why?
This is an adaptation of a many-part blog post about learning to write code with LEDs I started in the middle of 2014. I have run classes in Vancouver, Canada using these blog posts. Feel free to replicate them at your local hackspace: it's always a good time.
Share this with your friends so I can keep making weird stuff. Thank you!
Step 1: Get the Parts
I didn't have an appropriate picture.
64 RGB LEDS in a strand, model WS2811, 12mm diameter
One PC power cable. (check your junk drawer.)
One square of cardboard or corroplast. I recommend some material at least 1/8" (3mm) thick.
Step 2: Wire It Up
The power supply in these pictures is more amps than in the model I suggested on the previous step. Makes no difference for this tutorial. I don't want you to be surprised.
DO NONE OF THESE STEPS WHEN POWER IS CONNECTED. YOU WON'T GET TO MAKE THAT MISTAKE TWICE.
Cut off the end of the power plug that doesn't go in the wall.
The three wires inside are black, green, and white
The white wire goes to the power supply's neutral (N), the green wire goes to ground, and finally the black wire goes to live (L).
The three wires are brown, blue, and yellow
If you have a cable that is brown/blue/yellow or brown/blue/green: Brown
is Live (L), green/yellow is ground, and blue is neutral (N).
Connect LEDs to power
From there a red wire from the LEDs to V+.
There's two white wires. Connect either one to to V-.
Connect Arduino to power AND LEDs
Connect the other LED white wire to Arduino GND. Look around the board - there's more than one GND and they're all the same. If you have a soldering iron feel free to tin the white wire so it's easier to stick in the Arduino.
Connect a red wire from power supply V+ to Arduino VIN.
Connect a white wire from power supply V- to Arduino GND.
Now the Arduino and the LEDs are getting power from the PS and they have a common ground (white wire/GND).
Keep it together
I put a rubber band around the arduino to hold the wires in place.
Step 3: Set Up the Grid
Cut 12mm holes in an 8x8 grid as in the pictures. I believe that there is 4cm between each light here. When I do it again there will be more white border around the edge and the lights will be a little closer together.
Slow is Fast
Slow is perfect the first time. Perfect the first time is as fast as you can go.
Thread the lights in an S pattern. You're only going to do this once, so take the time and untwist the
wires. It's satisfying when they're done up right.
Step 4: Joolee, Do the Thing.
Prep
For this step you need to know how to use Git, Arduino, and how to install a library in Arduino. There are Instructables out there to show you how.
Download
Grab all the code for the marquee here:
https://github.com/MarginallyClever/RGBLEDMarquee
The Marquee code uses Adafruit's Neopixel library.
https://github.com/adafruit/Adafruit_NeoPixel
Upload
Connect a USB cable from your arduino to your PC. Upload your code to your Arduino.
Plug in power for your LEDs. "Hello, World." should appear.
Disconnect USB cable. Message should continue.
Use
Open the serial monitor. Set the baud rate in the bottom right corner to 57600. Set the "send newline" option.
Type a new message in the top of the serial monitor window. When the current message finishes the latest message will begin.
Step 5: Final Thoughts
Pay it forward
Share this with your friends so I can keep making weird stuff. Thank you!
Go Deeper
Read the full programming LEDs tutorial to start learning how to bend machines to your will. This is a crucial step if you're going to fight the robot uprising. I'm sorry, you can't lead the robot uprising. I called dibs. It's also a great way to start learning about computer games: one pixel at a time is how I learned way back in the 1990s. Mode 13h for the win!
Make it bigger
The power supply recommended at the start is only enough to power 1 strip of 64 LEDs. For more strips you need to multiply the number of amps. 4a for every 64 LEDs, or 12a for 192 LEDs (x3). Over 3 strips and there will start to be flickering lights and strange behavior. This is because the Arduino is too slow to deliver more instructions quickly enough to fool your eye.
For VHS' giant wall o LEDs - 4 panels wide and 3 panels high - we used a Teensy 3.1 with the Octoshield and a 5v60a power supply - that's 300 watts of power in 768 LEDs. Octoshield can handle a LOT more LEDs than that.
You'll also need to tweak the code in fun ways. If you're keen to build a big wall o LEDs, contact me through my website and we'll make it happen.
FINAL BOSS BONUS ROUND
I challenge you to write a new output plugin for VLC (VideoLAN).
I want to tell the plugin "my screen is X by Y pixels" and "my arduino/teensy is over here" (serial port or ethernet address). The plugin would then send uncompressed RGB values for each frame of video, so we could play any animation we like on the giant wall o LEDS or on your new LED panel.
In order to keep the video looking right, binary AND every RGB value with 0b111111110. On the first pixel of each frame, binary OR each RGB value with 0b00000001. The Arduino/Teensy can then listen for the 0b00000001 bits and re-square each frame of video.