Sorry folks, I know I’ve been pretty slow to update the site, it’s just that I bought an Arduino Duemilanove development board , an Ethernet shield from sparkfun electronics and some MegaBrite, ShiftBrite and OctoBrite modules from MaceTech.   I have some experience in programming the atmel Mega series of micro-controllers so it was pretty easy to get into working with the Arduino. The USB interface is great, it uses a USB serial interface and the board is powered via USB (OR external supply).   You plug in the Arduino and then install a couple of drivers and your set.

The Arduino IDE is pretty flexible and easy to build with and it includes a built in serial monitor so you can send reports back from your little project. Additionally there are quite a few example projects and a reasonable resource base on the internet for finding out most anything you need to do whatever you might want to do.

My project is pretty generic, it’s a simple lighting system with LEDs. I chose the MegaBrite, ShiftBrite and OctoBrites because they’re already built and they’re pretty easy to program.  They use a bit-shift register so in order to send data to 20 of them, you just stream out 20 sets of data to the set and there you go.  There’s libraries for them so you don’t have to do all the bit shifting yourself.  You basically just need to send the data to an array for LED position and RGB values (0 – 1023) and your set.  I was very happy with how easy this was to setup, and the guy over at MaceTech has been very helpful with some non-common questions I had.   The MegaBrite modules were around $10 each, the ShiftBrite around $5, and the OctoBrites a bit more expensive at $24.   The arduino itself only cost $29.95!!

You can’t beat a deal like that, $29.95 for a completely programmable microcontroller development set, ready to plug and play (you could beat it if you built the programmer and other circuitry yourself, but.. I like things ‘ready to go’.)

I wanted to be able to control these LEDs via a serial port, and I’m a terrible computer programmer type, however I’m most familiar with PHP/MYSQL, etc.   I originally downloaded the NetBeans IDE for Java and tried to write a Java control program. Trying to do serial communications in Java is a bit of a nightmare, because most of the libraries are old, unsupported or broken.  Though there may be one way to do serial for Java pretty easily, I’ll cover that next.

I gave up on Java after a DAY of trying to find a working serial library.  I resorted back to PHP to see what could be done there.  I downloaded XAMPP from Apache Friends which is a complete web server, php, mysql, etc solution.  Everything you need to experiment with PHP on your PC without installing Linux and other things. I had originally tried the php_serial class.  It didn’t work, period and also there are some possible coding deficiencies discovered after reading various message boards.  It is a good library to use if you want to communicate in Linux, but I wouldn’t recommend it for window.

After a bit more search I found some references to SerProxy, it’s basically a proxy server that works as an interface between your Windows serial ports and any programming language which can do TCP/IP network communications. There are pre-compiled windows versions available or you can compile it yourself. I found a few examples online and within minutes had my PHP application sending the control codes to the Arduino code I had written.  It’s so much faster than php_serial seemed to be (long delays). It didn’t cost anything and it also supports 2 way connections in PHP under Windows, something that the php_serial class did not provide.

I’ve spent quite a bit of time playing with this little project of mine, as well as I am busy working on building a copper vapor laser.  You can keep up to date with my laser projects over at my laser blog .  Quite a few things to distract me from working on the house and such.  This weekend though we will be working on digging out the base for the new concrete front sidewalk and I will be posting pictures and information about that so stay tuned!

Tags: , , ,