Difference between revisions of "Alpha 220 LED Sign"

From NAS-Central Buffalo - The Linkstation Wiki
Jump to: navigation, search
m (Interface Sign to Serial Port Interface)
m (leddisplay-timeofday)
(20 intermediate revisions by one user not shown)
Line 1: Line 1:
{{Articles|Debian|FreeLink|Kurobox}}
+
[http://www.nas-central.org/2009-1-competition-results 2009-1 3rd Place Contest Winner!]
 +
{{Articles|Debian|FreeLink|Kurobox|KuroboxPro}}
  
 
{|align=right width="300"
 
{|align=right width="300"
Line 12: Line 13:
 
In this case a [[KuroBoxPro]] was used however any Linkstation could be used by accessing the 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 KuroBox.  One [[Add a Serial port to the ARM9 Linkstation | serial port on the bottom]]<ref>[[Add a Serial port to the ARM9 Linkstation]]</ref> which is the same as the port on the [[Information/LSPROOverview | Linkstation Pro]] and one on the [[SCON-KIT/_PRO_quick_manual | daughterboard accessible from the front]].  Both are addressed as <tt><b>/dev/ttyS0</b></tt>.  Consider soldering in a pinheader rather than the pressure connector used in the [[Add a Serial port to the ARM9 Linkstation| LSPRO method]].
+
First, install a [[serial port]] interface.  There are two physical serial ports on the KuroBoxPro.  One [[Add a Serial port to the ARM9 Linkstation | serial port on the bottom]]<ref>[[Add a Serial port to the ARM9 Linkstation]]</ref> which is the same as the port on the [[Information/LSPROOverview | Linkstation Pro]] and one on the [[SCON-KIT/_PRO_quick_manual | daughterboard accessible from the front]].  Both are addressed as <tt><b>/dev/ttyS0</b></tt>.  Consider soldering in a pinheader rather than the pressure connector used in the [[Add a Serial port to the ARM9 Linkstation| LSPRO method]].
  
 
      
 
      
Line 40: Line 41:
 
{|
 
{|
 
|-
 
|-
||http://upload.wikimedia.org/wikipedia/en/thumb/9/9c/Rj11_connector.jpg/100px-Rj11_connector.jpg
+
||[[Image:Rj11_connector.jpg|100px]]<br>
 +
[http://www.radioshack.com/search/index.jsp?kwCatId=&kw=279-422 RS-279-422]
 
||
 
||
 
* Pin 4 of the RJ12 to RS-232 RXD
 
* Pin 4 of the RJ12 to RS-232 RXD
Line 98: Line 100:
 
===Alpha Sign Syntax===
 
===Alpha Sign Syntax===
 
{| border=1 class="wikitable"
 
{| border=1 class="wikitable"
 
+
! "\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" !! "\001" !! "Z" !! "00" !! "\002" !! "AA" !! "\x1B" !! "t" !! "\x1C" !! "1" !! Hello World !! "\004"
! "\001" !! "Z" !! "00" !! "\002" !! "AA" !! "\x1B" !! "t" !! "\x1C" !! "1" !! Hello World !! "\004"
+
 
|}
 
|}
  
 
{| border=1 class="wikitable"
 
{| border=1 class="wikitable"
 
!  Value !! Meaning !! Code Type
 
!  Value !! Meaning !! Code Type
 +
|-
 +
| |\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
 +
| | NULL
 +
| | String of Null packets to get attention of sign
 
|-  
 
|-  
 
|  HEIGHT=16 ALIGN=LEFT | \001
 
|  HEIGHT=16 ALIGN=LEFT | \001
Line 157: Line 162:
  
 
====MODE TAG and COLORTAG====
 
====MODE TAG and COLORTAG====
The key parts of this are the <b>MODE TAG</b> and <b>COLORTAG</b>, there is full documentation available for this<ref>[http://www.ams-i.com/Pages/97088061.htm Alpha Sign Communications Protocol (pn 9708-8061)]
+
The key parts of this are the <b>MODE TAG</b> and <b>COLORTAG</b>, there is full documentation available for this<ref>[http://www.adaptivedisplays.com/Documentation/questions.php?questionid=149 Alpha Sign Communications Protocol (pn 9708-8061)]
</ref><ref>[http://www.ams-i.com/Media/97088061.pdf Alpha® Sign Communications Protocol Revision F]</ref>but here are the pertinent parts.
+
</ref>but here are the pertinent parts.
  
 
{|  
 
{|  
Line 168: Line 173:
 
|-
 
|-
 
! width="20px" | a  
 
! width="20px" | a  
|| Regular smooth scroll, right to left
+
|| Message travels right to left.
 
|-
 
|-
 
! b  
 
! b  
|| Appear. Centers as much of message on screen, waits, and  displays  rest of message in similar manner
+
|| Message remains stationary.
 
|-
 
|-
 
! c  
 
! c  
|| Appear with flashing.
+
|| Message remains stationary and flashes
 
|-
 
|-
 
! d
 
! d
Line 180: Line 185:
 
|-
 
|-
 
! e  
 
! e  
|| Scroll up.
+
|| Previous message is pushed up by a new message.
 
|-
 
|-
 
! f  
 
! f  
|| Scroll down from top.
+
|| Previous message is pushed down by a new message.  
 
|-
 
|-
 
! g  
 
! g  
||Jerky scroll from right to left.
+
|| Previous message is pushed left by a new message.  
 
|-
 
|-
 
! h  
 
! h  
|| Jerky scroll from left to right.
+
|| Previous message is pushed right by a new message.  
 
|-
 
|-
 
! i  
 
! i  
|| Wipe up from bottom, covering text.
+
|| New message is wiped over the previous message from bottom to top.  
 
|-
 
|-
 
! j  
 
! j  
|| Wipe down from top, covering text.
+
|| New message is wiped over the previous message from top to bottom.  
 
|-
 
|-
 
! k  
 
! k  
|| Wipe over from right to left, character by character, not by pixels.
+
|| New message is wiped over the previous message from right to left.  
 
|-
 
|-
 
! l  
 
! l  
|| Wipe over from left to right, character by character.
+
|| New message is wiped over the previous message from left to right.  
 
|-
 
|-
 
! m  
 
! m  
|| Scroll up. Same as 'e'?
+
|| New message line pushes the bottom line to the top line if 2-line sign.  
 
|-
 
|-
 
! n  
 
! n  
|| This is doing something weird based on message itself. Will have to investigate.
+
|| This is followed by a Special Specifier ASCII character which defines one of the Special Modes.  
 
|-
 
|-
 
! o  
 
! o  
|| Auto/Random (same as 'd'?)
+
|| Various Modes are called upon to display the message automatically.
 
|-
 
|-
 
! p  
 
! p  
|| --> CENTER <-- Text appears at sides and squishes content in.
+
|| Previous message is pushed toward the center of the display by the new message.  
 
|-
 
|-
 
! q  
 
! q  
|| <-- CENTER --> Text splits in center and pushed content out.
+
|| Previous message is pushed outward from the center by the new message.  
 
|-
 
|-
 
! r  
 
! r  
|| --> COVER <-- New text covers old out to in.
+
|| New message is wiped over the previous message in an inward motion.  
 
|-
 
|-
 
! s  
 
! s  
|| <-- UNCOVER --> New text uncovers in to out.
+
|| New message is wiped over the previous message in an outward motion.  
 
|-
 
|-
 
! t  
 
! t  
|| Compressed text! Using this mode the sign tricks your eyes into seeing more characters than it is capable  of physically producing. Scrolls right to left.
+
|| COMPRESSED - Message travels right to left. Characters are approximately one half their  normal width. (Only available on certain sign models.)
 
|-
 
|-
 
! u  
 
! u  
|| Fast Appear.
+
|| Message flies apart from the center (Alpha 3.0 protocol).  
 
|-
 
|-
 
! v  
 
! v  
|| Medium Appear.
+
|| Wipe in a clockwise direction (Alpha 3.0 protocol).  
|-
+
! w
+
|| Maybe medium-slow appear.
+
|-
+
! x
+
|| Same as 'p'?
+
|-
+
! y
+
|| Same as 'q'?
+
|-
+
! z
+
|| Same as 'r'?
+
|-
+
! @
+
|| The sign went blank.
+
 
|}
 
|}
 
|width="50%"|  
 
|width="50%"|  
Line 291: Line 281:
 
|}
 
|}
  
==Stock Ticker==
+
==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.
+
 
 +
The sign can be used for a number of purposes (to display weather forecasts from an [[w:RSS|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 [[w:Yahoo!|Yahoo!]] it then colors the prices  
 +
 
 +
<font color=green>GREEN</font> if they are positive/up  
 +
 
 +
and  
 +
 
 +
<font color=red>RED</font> if they are negative/down  
 +
 
 +
for the day
 +
{| width = "690px" cellpadding="10px" cellspacing="10px"
 +
|-valign=top
 +
||
 +
Here it is in action: (clip from a cell phone so quality is somewhat poor)
 +
<youtube>ojkgEQLNVG0</youtube>
 +
||
 +
This clip shows it fetching weather Stock quotes and news. This one happens to be running on a [[w:Plug_computer|Seagate Dockstar]]
 +
<youtube>T7l2s0NrXqA</youtube>
 +
|}
  
 
First install perl and make
 
First install perl and make
Line 313: Line 321:
  
 
Lastly here is a shell script to display the ticker
 
Lastly here is a shell script to display the ticker
 +
  
 
===leddisplay===
 
===leddisplay===
 
<pre>
 
<pre>
# /usr/local/bin/leddisplay
+
#! /bin/bash
#!/bin/sh
+
#-------------
 +
leddisplay-
 +
#-------------
 +
#
 +
#  A Script to display stock quotes, weather information, and news "
 +
#  on the ALPHA220C Sign"
 +
 +
#  usage leddisplay [flag] "
 +
#    s = stock quotes"
 +
#    w = weather "
 +
#    n = news " 
 +
#
 +
#
 +
#====================
 +
# User Set Variables=
 +
#====================
 +
#
 +
# Weather Url
 +
#
 +
WURI=http://weather.yahoo.com/united-states/illinois/chicago-12784260/
 +
#
 +
# News Feed URL
 +
#
 +
RSSURI=http://feeds.reuters.com/reuters/topNews/
 +
#
 
# Stock ticker symbols
 
# Stock ticker symbols
 
#
 
#
 +
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
 
PTE=/usr/local/bin
  
stocks="  ^DJI ^IXIC ^GSPC "
+
# 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
 +
$EXEC $RSSURI | grep title |\
 +
sed -e :a -e 's/<[^>]*>//g;/</N' |\
 +
sed -e 's/[ \t]*//' |\
 +
sed -e 's/\(.*\)/ \1/' |\
 +
sed -e 's/\.//' |\
 +
sed -e 's/\"//' |\
 +
sed -e 's/\"//' |\
 +
head -n $(($LINES + 2)) |\
 +
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  " "
  
        quote $stocks | cut -d"(" -f1 |sed 's/^/\x1C9 \x7F \x1C3 /' | sed '/ -/s/:/\x1C1/g' | sed '/ +/s/:/\x1C2/g' > /tmp/textfile
 
        $PTE/alphamon.pl t A  > /dev/alpha
 
 
    
 
    
 
</pre>
 
</pre>
 +
 +
===leddisplay-timeofday===
 +
<pre>
 +
#! /bin/bash
 +
#
 +
# News Feed URL
 +
#
 +
RSSURI=http://feeds.reuters.com/reuters/topNews/
 +
#
 +
# Stock ticker symbols
 +
#
 +
stocks="  ^DJI ^IXIC ^GSPC AAPL "
 +
#
 +
# Weather Url
 +
#
 +
WURI=http://weather.yahoo.com/united-states/illinois/chicago-12784260/
 +
#
 +
 +
LINES=10  #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
 +
$EXEC $RSSURI | grep title |\
 +
sed -e :a -e 's/<[^>]*>//g;/</N' |\
 +
sed -e 's/[ \t]*//' |\
 +
sed -e 's/\(.*\)/ \1/' |\
 +
sed -e 's/\.//' |\
 +
sed -e 's/\"//' |\
 +
sed -e 's/\"//' |\
 +
head -n $(($LINES + 2)) |\
 +
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;/</N' |\
 +
sed -e 's/[ \t]*//' |\
 +
sed -e 's/\(.*\)/ \1/' |\
 +
sed -e 's/\.//' |\
 +
sed -e 's/\"//' |\
 +
sed -e 's/\"//' |\
 +
head -n $(($LINES + 2)) |\
 +
tail -n $(($LINES)) > /tmp/textfile
 +
        perl $PTE/alphamon.pl t 1 > /dev/alpha
 +
 +
      exit
 +
 +
 +
fi
 +
</pre>
 +
 +
==Make it Wireless==
 +
 +
===A USB Wifi Stick===
 +
In this case a [[w:Nintendo_Wi-Fi_USB_Connector | 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.
 +
 +
<pre>
 +
# 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
 +
</pre>
 +
 +
===Software===
 +
Get wpasupplicant and wireless tools (throw in bridge-utils for later)
 +
 +
<pre>
 +
apt-get install wpasupplicant wireless-tools bridge-utils
 +
</pre>
 +
 +
I use WPA on my network, so I used wpa_passphrase to generate the basic contents of /etc/wpa_supplicant.conf
 +
 +
 +
<pre>
 +
wpa_passphrase ESSID passphrase
 +
</pre>
 +
 +
Here is what mine looks like:
 +
 +
/etc/wpa_supplicant.conf
 +
 +
<pre>
 +
# WPA-PSK/TKIP
 +
network={
 +
        ssid="ESSID"
 +
        key_mgmt=WPA-PSK
 +
        proto=WPA
 +
        pairwise=TKIP
 +
        group=TKIP
 +
        psk=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 +
}
 +
 +
 +
</pre>
 +
Edit the interfaces file (I used a static configuration, you could always use DHCP instead):
 +
 +
/etc/network/interfaces
 +
 +
<pre>
 +
#
 +
# we always want the loopback interface
 +
#
 +
auto lo
 +
iface lo inet loopback
 +
#
 +
# default dynamic setup (no adjustment necessary)
 +
#
 +
#  auto eth0
 +
#  iface eth0 inet dhcp
 +
      hostname `hostname`
 +
#
 +
# sample wireless setup
 +
#
 +
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
 +
</pre>
 +
 +
===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!
 +
  
 
==References==
 
==References==
 
<references />
 
<references />

Revision as of 17:25, 11 November 2012

2009-1 3rd Place Contest Winner!

You can find one of these signs for less than $100.
Alpha220.jpg
220 Full Matrix, (Case 37.7" x 3.8" x 2.9 ") Tricolor[1]

Contents

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[2] 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.


The cheapest TTL/RS232 converter found was from futurelec, however the order is shipped from thailand so it takes 2-3 weeks to get it.

http://www.futurlec.com/Mini_RS232_TTL_3V.shtml

ET-MINI RS232 3V.jpg

The sign uses a 6 conductor RJ-12 Jack. A snap in RJ-12 jack is used to interface the sign to the serial port converter

RS-278-2022

RJ12jack.jpg

The serial port board/connector are then enclosed in a 2 port surface mount housing

RS-278-2092

2PSM.jpg

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[3]

Rj11 connector.jpg

RS-279-422

  • Pin 4 of the RJ12 to RS-232 RXD
  • Pin 3 of the RJ12 to RS-232 TXD
  • Pin 6 of the RJ12 to RS-232 GND

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[4].

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

# /usr/local/bin/setledsign
#!/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

Wake up the sign and display something on it

alphamon.pl

# alphamon.pl
#
#!/usr/bin/perl
#
# Script will display the contents of /tmp/textfile to the ALPHA 220C LED
# Display
#
# Usage
#
# alphamon.pl [MODE TAG] [COLORTAG]


# Get the attention of the sign
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";


# Tell the sign to print the message
$message = `cat /tmp/textfile` ;

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

Alpha Sign Syntax

"\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" "\001" "Z" "00" "\002" "AA" "\x1B" "t" "\x1C" "1" Hello World "\004"
Value Meaning Code Type
\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 NULL String of Null packets to get attention of sign
\001 SOH Start of Header
Z Direct at all Signs Type Code
00 All Signs Should Listen Sign Address
\002 Start of Text Character Start Type
A Text File Write File Type
A A File Label
\x1B ESC Start of Mode Field
t compressed text MODE TAG (see below)
\x1C color control code Control Code
1 red COLORTAG (see below)
Hello World Text Message
\004 EOT End of Transmission


MODE TAG and COLORTAG

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

MODE TAG
a Message travels right to left.
b Message remains stationary.
c Message remains stationary and flashes
d Auto. Randomly picks an effect for each part of the message, as opposed to the message as a whole.
e Previous message is pushed up by a new message.
f Previous message is pushed down by a new message.
g Previous message is pushed left by a new message.
h Previous message is pushed right by a new message.
i New message is wiped over the previous message from bottom to top.
j New message is wiped over the previous message from top to bottom.
k New message is wiped over the previous message from right to left.
l New message is wiped over the previous message from left to right.
m New message line pushes the bottom line to the top line if 2-line sign.
n This is followed by a Special Specifier ASCII character which defines one of the Special Modes.
o Various Modes are called upon to display the message automatically.
p Previous message is pushed toward the center of the display by the new message.
q Previous message is pushed outward from the center by the new message.
r New message is wiped over the previous message in an inward motion.
s New message is wiped over the previous message in an outward motion.
t COMPRESSED - Message travels right to left. Characters are approximately one half their normal width. (Only available on certain sign models.)
u Message flies apart from the center (Alpha 3.0 protocol).
v Wipe in a clockwise direction (Alpha 3.0 protocol).
COLORTAG
1 Red
2 Green
3 Amber
4 Dim red
5 Dim green
6 Brown
7 Orange
8 Yellow
9 Rainbow 1
A Rainbow 2
B Color mix
C Autocolor

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

Here it is in action: (clip from a cell phone so quality is somewhat poor)

This clip shows it fetching weather Stock quotes and news. This one happens to be running on a Seagate Dockstar

First install perl and make

apt-get install perl make

Then install the quote package [6]

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

Lastly here is a shell script to display the ticker


leddisplay

#! /bin/bash
#-------------
#  leddisplay-
#------------- 
#
#  A Script to display stock quotes, weather information, and news "
#  on the ALPHA220C Sign"
#  
#  usage leddisplay [flag] "
#    s = stock quotes"
#    w = weather "
#    n = news "   
#
#
#====================
# User Set Variables=
#====================
#
# Weather Url
#
WURI=http://weather.yahoo.com/united-states/illinois/chicago-12784260/
#
# News Feed URL
#
RSSURI=http://feeds.reuters.com/reuters/topNews/
#
# Stock ticker symbols
#
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

# 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
	$EXEC $RSSURI | grep title |\
	sed -e :a -e 's/<[^>]*>//g;/</N' |\
	sed -e 's/[ \t]*//' |\
	sed -e 's/\(.*\)/ \1/' |\
	sed -e 's/\.//' |\
	sed -e 's/\"//' |\
	sed -e 's/\"//' |\
	head -n $(($LINES + 2)) |\
	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

#! /bin/bash
#
# News Feed URL
#
RSSURI=http://feeds.reuters.com/reuters/topNews/
#
# Stock ticker symbols
#
stocks="  ^DJI ^IXIC ^GSPC AAPL " 
#
# Weather Url
#
WURI=http://weather.yahoo.com/united-states/illinois/chicago-12784260/
#

LINES=10  #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
	$EXEC $RSSURI | grep title |\
	sed -e :a -e 's/<[^>]*>//g;/</N' |\
	sed -e 's/[ \t]*//' |\
	sed -e 's/\(.*\)/ \1/' |\
	sed -e 's/\.//' |\
	sed -e 's/\"//' |\
	sed -e 's/\"//' |\
	head -n $(($LINES + 2)) |\
	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;/</N' |\
	sed -e 's/[ \t]*//' |\
	sed -e 's/\(.*\)/ \1/' |\
	sed -e 's/\.//' |\
	sed -e 's/\"//' |\
	sed -e 's/\"//' |\
	head -n $(($LINES + 2)) |\
	tail -n $(($LINES)) > /tmp/textfile
        perl $PTE/alphamon.pl t 1 > /dev/alpha

      exit


fi

Make it Wireless

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.

# 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

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


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

/etc/network/interfaces

#
# we always want the loopback interface
#
auto lo
iface lo inet loopback
#
# default dynamic setup (no adjustment necessary)
#
#  auto eth0
#  iface eth0 inet dhcp
      hostname `hostname`
#
# sample wireless setup
#
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

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!


References

  1. 220 brochure (Pdf)
  2. Add a Serial port to the ARM9 Linkstation
  3. Building a Data Cable for Alpha LED Scrolling Signs
  4. Using the Alpha 215C with Linux
  5. Alpha Sign Communications Protocol (pn 9708-8061)
  6. quote -- command-line stock quote display