Alpha 220 LED Sign

2009-1 3rd Place Contest Winner!

Install a Serial Port Interface
In this case a KuroBoxPro was used however any Linkstation could be used by accessing the serial port interface.

First, install a serial port interface. There are two physical serial ports on the KuroBoxPro. One serial port on the bottom which is the same as the port on the  Linkstation Pro and one on the  daughterboard accessible from the front. Both are addressed as /dev/ttyS0. Consider soldering in a pinheader rather than the pressure connector used in the LSPRO method.

Interface Sign to Serial Port Interface
A standard 6 wire telephone cable meant for a two line phone is used (a 4 wire one will not work) Plug one end into the sign, and one end into the Quick port RJ-12 Jack. Wire the jack into the serial port board as such

Setup the serial port
Adjust the serial port settings, below is a script to do this. This information comes from a FAQ on using the Alpha sign with Linux.

Basically this


 * 1) Links /dev/ttyS0 to /dev/alpha
 * 2) Gives everyone read/write access to your sign (/dev/alpha)
 * 3) Provides a 9600,E,7,1 connection to the sign (/dev/alpha)

setledsign

 * 1) /usr/local/bin/setledsign
 * 2) !/bin/sh

rm /dev/alpha ln -s /dev/ttyS0 /dev/alpha chmod a+rw /dev/alpha stty 9600 -opost -ocrnl -onlcr cs7 parenb -parodd < /dev/alpha

alphamon.pl

 * 1) alphamon.pl
 * 2) !/usr/bin/perl
 * 3) Script will display the contents of /tmp/textfile to the ALPHA 220C LED
 * 4) Display
 * 5) Usage
 * 6) alphamon.pl [MODE TAG] [COLORTAG]
 * 1) Usage
 * 2) alphamon.pl [MODE TAG] [COLORTAG]
 * 1) alphamon.pl [MODE TAG] [COLORTAG]
 * 1) alphamon.pl [MODE TAG] [COLORTAG]

print "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
 * 1) Get the attention of the sign

$message = `cat /tmp/textfile` ;
 * 1) Tell the sign to print the message

print "\001". "Z". "00" . "\002" . "AA". "\x1B". " $ARGV[0]". "\x1C". "$ARGV[1]". $message. "\004";

MODE TAG and COLORTAG
The key parts of this are the MODE TAG and COLORTAG, there is full documentation available for this but here are the pertinent parts.

Ticker (Stock, Weather, News)
The sign can be used for a number of purposes (to display weather forecasts from an RSS feed, to display news feeds as a news ticker) As a proof of concept the following script uses the sign to display a stock ticker that gets it's data from Yahoo! it then colors the prices

GREEN if they are positive/up

and

RED if they are negative/down

for the day

First install perl and make

apt-get install perl make

Then install the quote package

wget http://www.circlemud.org/pub/jelson/quote/quote-0.05.tar.gz tar -xvzf quote-0.05.tar.gz cd quote-0.05 ./configure ./make ./make install

install curl and lynx so that they can be used later to get content from the web.

apt-get install curl lynx xml2

Lastly here is a shell script to display the ticker

leddisplay
WURI=http://weather.yahoo.com/united-states/illinois/chicago-12784260/ RSSURI=http://feeds.reuters.com/reuters/topNews/ stocks=" ^DJI ^IXIC ^GSPC AAPL" LINES=10 #Number of headlines EXEC="/usr/bin/curl -s" #Path to curl dow=$(date +%u) hour=$(date +%k) PTE=/usr/local/bin
 * 1) ! /bin/bash
 * 2)  leddisplay-
 * 3)  A Script to display stock quotes, weather information, and news "
 * 4)  on the ALPHA220C Sign"
 * 5)  usage leddisplay [flag] "
 * 6)    s = stock quotes"
 * 7)    w = weather "
 * 8)    n = news "
 * 9) User Set Variables=
 * 10) Weather Url
 * 1)    w = weather "
 * 2)    n = news "
 * 3) User Set Variables=
 * 4) Weather Url
 * 1) User Set Variables=
 * 2) Weather Url
 * 1) Weather Url
 * 1) Weather Url
 * 1) Weather Url
 * 1) News Feed URL
 * 1) News Feed URL
 * 1) Stock ticker symbols
 * 1) Stock ticker symbols


 * 1) Script Body

if [ $1 == "" ] then

exit fi

if [ $1 == "w" ] then

lynx -dump $WURI | sed -n '/   Today/,/Tomorrow/p' | sed -e '$d' > /tmp/textfile

perl $PTE/alphamon.pl t 2 > /dev/alpha exit fi

if [ $1 == "n" ] then /usr/bin/wget -q -O - $RSSURI | /usr/bin/xml2 | grep title | sed 's/\(.*\)\(title.*\)/\2/g' | sed 's/$/          /' | colrm 1 6 | head -n $(($LINES + 1)) |\ tail -n $(($LINES)) > /tmp/textfile perl $PTE/alphamon.pl t 1 > /dev/alpha exit fi if [ $1 == "s" ] then quote $stocks | cut -d"(" -f1 |sed 's/^/\x1C9 \x7F \x1C3 /' | sed '/ -/s/:/\x1C1/g' | sed '/ +/s/:/\x1C2/g' > /tmp/textfile       perl $PTE/alphamon.pl t A  > /dev/alpha   exit fi

clear echo "leddisplay" echo "-- " echo " " echo " A Script to display stock quotes, weather information, and news " echo " on the ALPHA220C Sign" echo " " echo " usage leddisplay [flag] " echo " s = stock quotes" echo " w = weather " echo " n = news " echo " "

leddisplay-timeofday
WURI=http://weather.yahoo.com/united-states/indiana/indiana-2347573/ RSSURI=http://feeds.reuters.com/reuters/topNews/ stocks=" ^DJI ^IXIC ^GSPC "
 * 1) ! /bin/bash
 * 2) Weather URL, Zip Code is the important part
 * 1) News Feed URL
 * 1) News Feed URL
 * 1) Stock ticker symbols
 * 1) Stock ticker symbols

LINES=11 #Number of headlines EXEC="/usr/bin/curl -s" #Path to curl dow=$(date +%u) hour=$(date +%k) PTE=/usr/local/bin

if [ $hour -ge 5 ] && [ $hour -le 8 ] then

lynx -dump $WURI | sed -n '/   Today:/,/Tomorrow:/p' | sed -e '$d' > /tmp/textfile

perl $PTE/alphamon.pl t 2 > /dev/alpha exit fi

if [ $hour -ge 16 -o  $hour -le 5 ] then

/usr/bin/wget -q -O - $RSSURI | /usr/bin/xml2 | grep title | sed 's/\(.*\)\(title.*\)/\2/g' | sed 's/$/          /' | colrm 1 6 | head -n $(($LINES + 1)) |\ tail -n $(($LINES)) > /tmp/textfile perl $PTE/alphamon.pl t 1 > /dev/alpha

exit fi if [ $dow -ge 1 ] && [ $dow -le 5 ] then quote $stocks | cut -d"(" -f1 |sed 's/^/\x1C9 \x7F \x1C3 /' | sed '/ -/s/:/\x1C1/g' | sed '/ +/s/:/\x1C2/g' > /tmp/textfile       perl $PTE/alphamon.pl t A  > /dev/alpha   else

$EXEC $RSSURI | grep title |\ sed -e :a -e 's/<[^>]*>//g;/ /tmp/textfile perl $PTE/alphamon.pl t 1 > /dev/alpha

exit

fi

A USB Wifi Stick
In this case a Nintendo WiFi USB connector, which used to be widely available at every store that sold a Wii (before the CSIRO lawsuit).

Udev should pick this up automatically when inserted and load the proper kernel module. You can do a quick dmesg to make sure that it was recognized.


 * 1) dmesg | tail -n4

usb 1-1: new high speed USB device using orion-ehci and address 2 usb 1-1: configuration #1 chosen from 1 choice phy0: Selected rate control algorithm 'pid' usbcore: registered new interface driver rt2500usb

Software
Get wpasupplicant and wireless tools (throw in bridge-utils for later)

apt-get install wpasupplicant wireless-tools bridge-utils

I use WPA on my network, so I used wpa_passphrase to generate the basic contents of /etc/wpa_supplicant.conf

wpa_passphrase ESSID passphrase

Here is what mine looks like:

/etc/wpa_supplicant.conf

network={ ssid="ESSID" key_mgmt=WPA-PSK proto=WPA pairwise=TKIP group=TKIP psk=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX }
 * 1) WPA-PSK/TKIP

Edit the interfaces file (I used a static configuration, you could always use DHCP instead):

/etc/network/interfaces

auto lo iface lo inet loopback hostname `hostname` auto wlan0 iface wlan0 inet static wireless-essid ESSID address 192.168.1.145 gateway 192.168.1.1 dns-nameservers 192.186.1.1, 69.50.168.189 netmask 255.255.255.0 wpa-conf /etc/wpa_supplicant.conf
 * 1) we always want the loopback interface
 * 1) we always want the loopback interface
 * 1) default dynamic setup (no adjustment necessary)
 * 2)  auto eth0
 * 3)  iface eth0 inet dhcp
 * 1)  auto eth0
 * 2)  iface eth0 inet dhcp
 * 1) sample wireless setup
 * 1) sample wireless setup

Test it out
Restart networking or reboot the box, you should be able to login on the address you gave the box (192.168.1.145 in this example) with the ethernet unplugged!