NerdKits - electronics education for a digital generation

You are not logged in. [log in]

NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.

Project Help and Ideas » LED Marquee alternative

June 30, 2009
by mcai8sh4
mcai8sh4's Avatar

Hello people...

I've seen a few posts regarding the led marquee, mainly about some problems with the python listener.

So here's a simple alternative.

I've already posted two other python scripts - one displays scrolling text of piped data to the script, and the other displays static text piped to it - but alas, they've been wrote with Linux in mind.

Since I don't have windows on this machine, I can't vouch for the usefulness of the following for you Windows people, but it's worth a try.

I've been needing an excuse (for a year or so) to try my hand at perl.. this was the perfect excuse.

I started learning pearl at ~5:30 today, it's now 11:50, so I'm proud of my achievement.

Disclaimer : This is a work in progress - I dont know what I'm doing, but maybe someone with brains could elaborate/improve... So here's the script :

use strict;
use warnings;
use Device::SerialPort;
my $arg_string=join(' ',@ARGV);
my $ob = Device::SerialPort ->new ("/dev/ttyUSB0") || die "oops, cannot open port";
sleep 5;

And thats it - there's bugs, but it seems to work.

USEAGE : assuming the files named

perl HELLO

This will show 'HELLO' on the display for 5 seconds then should clear the display.

It doesn't always work, sometimes the display isn't cleared and when you first turn on the nerdkit, you'll have to run the script twice for it to work (like I say I'm new to this).

So, Windows people, install perl (can't help you with that yet - I've never done it) and you'll need Win32::SerialPort Then probably change the line

use Device::SerialPort;


use Win32::serialPort;

and it might work.

I'm going to continue to learn this beast that is pearl, so if you can get it working let me know - I'll work on the scrolling display.

I hope this is of some use to someone, but even if it's not, it's a good excuse to learn something new.

I have to thank JB for helping debug and get this thing working, nice to meet you in the IRC channel (#nerdkits on freenode - shameless plug) - you were a great help!

July 01, 2009
by jbremnant
jbremnant's Avatar

Hey Steve,

Glad to be help. It's good to see you made good progress! Hopefully I can also post something helpful for other people soon. :) The irc channel was a good idea. See you @ #nerdkits on (another shameless plug)

July 01, 2009
by mcai8sh4
mcai8sh4's Avatar

Oh, I forgot to mention the following two points.

Windows guys - you'll have to alter "/dev/ttyUSB0" to whatever port you use!

Everyone else - I know, I've spelt perl wrong on a couple of instances, ho-hum!

If anyone gets this working on windows, let me know. Whilst it needs tweaking a little, I'm going to try to get a scrolling text working next - this is more useful.

July 20, 2009
by mcai8sh4
mcai8sh4's Avatar

I've made a little more progress regarding controlling the LED Marquee using perl instead of python. I now have 2 programs, one displays static text, the other displays scrolling text.

The code for both is still very sloppy - but they seem to work ok. (once you've turned the LED Marquee on, you may have to run one of the progs twice, whilst it gets into the correct mode - but after that... all good)

Feel free to improve, play, ask, whatever.

static text

scrolling text

July 20, 2009
by mcai8sh4
mcai8sh4's Avatar

ok just noticed a stupid error.

On the scrolling text program (around line 34) - its better to use :


I was struggling to get that bit working, but the input version seems to be better.

July 20, 2009
by jbremnant
jbremnant's Avatar

Good stuff mcai!

I also have some code/etc to share, but will post the details when I get the chance. If anyone's interested, I've modified the ledarray project:

* modified the code to use 5x5 grid instead of 5x12 - leaves extra pins to do other stuff (e.g: LCD).
* added small convenience functions for more displaying options
* modified python script to accomodate my "special" commands
* the whole thing runs on arduino platform which uses the same series of atmega MCU's
* of course, it works on nerdkit too

It's hooked up to my linux box at work to alert me when crap hits the fan. :-)

It turns out arduino is quite compatible with nerdkit and its build chain. One thing I don't like about arduino, however, is that it puts too much reliance on the IDE for development, and the "sketches" you end up creating are too abstracted out from the real MCU programming experience. I very much prefer nerdkit's approach. Teach the real tools and the underlying avr-lib to build the projects instead of writing "sketches". Besides, arduino tools on linux was somewhat broken. I'd recommend arduino as complimentary hardware option, since it does use the same MCU and couple of nice features that nerdkit doesn't have yet. But as far as education is concerned, I'd say stick with the nerdkit.

July 21, 2009
by mcai8sh4
mcai8sh4's Avatar

Ok you Windows folks... it all works for you guys too. Quite simple!

So if you want to run your LED Marquee from Windows and are having trouble with python, here's the perl alternative.

I have just done the following myself and it all works, I don't use Windows as a rule, but this worked for Vista. If you have any problems, let me know (might not be able to help, but I'll try).

First you need to download Active Perl from here : Active Perl

It's free and around 17MB

Once you have that install it and check all works by typing (on the command line)

perl -v

if you see stuff other than an error, then it works!!

You'll then need my little scripts AND the Win32::Serialport package - I've put all the files into a zip to make life easier for you.

You can get the files here : STUFF

unzip these into somewhere you plan to run the code from (remember these scripts are to be run on the command prompt).

Once thats done you have to install the serial port package, this is quite simple.

First open your command prompt and navigate to where you unzipped the files, then change directory to the "Serialport-0.19" directory. At this point I connected the nerdkit to my computer (and I turned the LED marquee on - not sure if I had to, but I did). I checked what com port I was using for the nerdkit - it was port "COM3"

Next type something along the lines of : (alter to use your port) Type one line at a time!

perl Makefile.PL COM3

You'll see stuff on the screen. It does tests and things - I had a lot of fails, but no need to worry. This took about 30 sec.

The I think I rebooted (might not be needed).

Thats it!! Your ready to test.

If your Nerdkit doesn't use COM3 - edit the files and alter the line :

my $port = "COM3";

Connect your LED Marquee up to the computer and turn that bad boy on!

Go to the dir that the are in and type the following :

perl hello

and you will see.... nothing (this always happens first time... I'm working on it). Type the above line again, then you should see "HELLO" displayed for 5 seconds. If that works, next we'll do a scrolling display. Same as before but with the other script :

perl hello

"HELLO" should scroll across your marquee!! If it works, pat yourself on the back (and buy me a beer)

Whilst these programs work - they're not great, there are a few funny things that happen occasionally, but if it goes wrong, run the command again and it seems to sort itself out.

"But Mr.Mcai8sh4, I want to pipe my text to the display, make it do that!" - One step ahead of you young Grasshopper, edit the program and remove the "#" at the beginning of the line

# @ARGV = <>; # uncomment if you want to pipe to the script

Then you can pass the text to the prog something along the lines of :

echo "works" |

now you can have program outputs sent to the display (use batch scripts... whatever)

Play around, have fun.

If you do have problems, I'll try to help - but windows isn't my territory - so no guarantees.

DISCLAIMER : if following these instructions messes up your computer in some way - not my fault - I will be sincerely sorry, but still not to blame.

Post a Reply

Please log in to post a reply.

Did you know that inductors try to keep their current constant over short periods of time? Learn more...