Introduction: Internet Connected LED Sign
The LED Internet Sign is a physical LED sign that lives in my home office.
You are able to send your messages to it from the live web feed on my website.
I have had thousands of messages from all over the world sent to my home office via the sign.
This instructable will show you how to make your own LED Internet connected sign.
This tutorial assumes you know the basics of PHP and MySQL.
Before we start, you cangive the sign a test run here:
OR get an overview of the project from the video above.
Step 1: Parts List
This project is made of 2 main components:
- The Sign
- 4 x DMD’s (Dot Matrix Display’s) The physical sign itself is made up of 4 x DMD’s. You can use as many as you like. They can also be stacked in various combinations (vertical, horizontal, 2x3, etc) and the message does not have to just scroll from right to left. They range from $30-$90 depending upon colour (Red is the cheapest). I picked mine up from Freetronics http://www.freetronics.com.au/collections/display , but AdaFruit also sell them.
- 1 x Arduino with Ethernet connectivity. (I have used a Freetronics EtherTen http://www.freetronics.com.au/products/etherten )
- 1 x watchdog timer (optional) to reset the Arduino if it fails http://www.freetronics.com.au/products/watchdog-timer-module
- The Webpage
- The examples in this tutorial are based on PHP and MySQL to send the message to the sign
- The live stream is utilising YouTube’s Live Streaming service.
Step 2: The Sign
The sign itself is pretty straight forward to set up.
- Connect the ribbon cable from your Arduino directly to the input on the DMD and you are ready to go. These displays come with their own Connector board that plugs directly in to the Digital i/o pins and the ribbon cable. I have used these DMD’s - http://www.freetronics.com.au/collections/display
- There is a corresponding output set of pins on the opposite side of the DMD to daisy chain further boards.
I will walk you through the code for the Arduino sketch in later steps, but the following snippet defines the setup of the boards if they have been daisy chained
#define DISPLAYS_ACROSS 4
#define DISPLAYS_DOWN 1
DMD dmd(DISPLAYS_ACROSS, DISPLAYS_DOWN);
You can optionally connect a stronger 5v power source directly to the terminals in the middle of the DMD to provide a brighter LED, but it’s not required in this sort of setting. (NOTE: do NOT power this from your Arduino)
Step 3: The Watchdog Timer Module (Optional)
I found that my Arduino would fail every 400 or so messages, so I added the WatchDog Timer Module to reset the Arduino when it locked up.
The Watchdog Timer is triggered by a line of code strategically placed in the sketch. If the watchdog is not pinged within 60 seconds, it sends a reset to the Arduino and the application comes back up again.
Since the messages are stored on the web server until the Arduino retrieves each one, nothing is lost and the messages simply queue up.
Again, very simple to setup with just 4 wires.
- GND connects to your GND pin on your Arduino
- VCC connects to your 3.3v or 5v pins on your Arduino
- IN is connected to whatever digital PIN you choose to send the pulse from. I chose D2.
- OUT is connected to the RESET PIN on your Arduino
The following code snippet is used to trigger the ping on for the Watchdog Timer (note: The timer can be set to reset in 1 or 5 minute intervals)
/ add these two lines to your setup routine. They set the mode and select the Pin you will use to connect to the watchdog with.
int watchDog = 2;
// add these to a subroutine to be called whenever you want to send the pulse in your loop
Step 4: The Sketch Code for Your Arduino
The following code is the Sketch for your Arduino. This has been based on an Arduino compatible board with Ethernet capabilities. (I have used a Freetronics EtherTen http://www.freetronics.com.au/products/etherten )
Your DMD Display and Arduino board will come with the various libraries that you will need to install including fonts.
I will step through the attached code using comments to help you understand what I am doing.
Step 5: The Web Page
There are 3 parts to the web page:
- The live web stream so that viewers can see their message scroll across the LED’s
- The form the viewer submits to send the message to the database for the sign to pick up and read
- A hidden page for the Arduino to read the next message in the queue
I have used a simple PHP script and MySQL database to run this system. http://laikabot.com/projects/LEDInternetSign.php
The form on the above page posts to the following php script that saves the users message and name in to a simple database.
Set up your database with fields for:
- Unique identifier (incremental)
- Optional Name
- Time submitted
- Displayed (automatically set to 0 to indicate it is unread)
Attached is an example of the PHP code to insert the message in to the database.
Step 6: Read the Message to Display
This php page is called by the Arduino sketch (as documented in Step 4) and it feeds the next message to be displayed to the Arduino.
It simply returns the next unread message from the database as a single line on a html page. The arduino then reads this message and displays it on the LED sign.
It’s not meant to be seen by the public, so keep the URL private.
The next unread message is displayed in HTML with 3 x asterisks on the left and ends the message with 1 x asterisk.
When the Arduino makes a call to the page, all of the html headers are returned to the Arduino and thus I have used the above asterisks to help identify the message to be stripped out.
Attached is example code for the database read. (Note: This page is the one called in the above arduino sketch on step 4.)
Step 7: The Live Web Stream
There are a lot of live streaming services out there, but I have used YouTube’s Live Streaming service for this project.
You can get a good overview to setting up your service here:
With this streaming service, you need your own encoding software. There is an abundance of coders out there and they do give you a lot more flexibility.
Here is a page to review some of the encoders including open source and free versions. https://support.google.com/youtube/topic/2853712?h...
I ended up using Xsplit, but I also used the OBS encoder for a while there too. With the encoders, you actually control everything about the stream from when it starts to when it stops without having to open YouTube. You can also fade between cameras and pre-loaded video.
You do need at least a 1.5mbit upload to get a semi-decent stream going through.
Step 8: Your Ready to Roll!
So that’s the basics of how it all hangs together. It’s pretty simple when you break it down to the fact that it’s really just a DMD plugged in to an Arduino (with an Ethernet Connection), and a web page that writes a message to a database.
It’s brought a lot of entertainment to me and the thousands of people who have left messages, so I guess that makes it’s worth building one of your own!