Home > Uncategorized > By “Popular” Demand

By “Popular” Demand

Someone posted a comment on one of my posts asking if they could get hold of the application I made to run my Adalight device. I’ve uploaded a (hopefully) working version now and you can download it here.

Inside this archive you should find 2 directories. First go into “Arduino” and upload the “.pde” file to your Duemilanove. Once this is complete, go into the PC directory where you should be able to run “ControlPanel.exe”. This will give you some buttons to click and gadgets to play around with to run your Adalight. If you see a warning saying that Arduino Comms could not be initialised, go into the “Settings tab” and enter the COM port number to which your Arduino is connected to your PC.

This is just a quick response for the moment but I’ll try to make the program a little more robust and user friendly and document some of it’s features in the not too distant future.



You can get the C++ source code of the library used to communicate between the PC and the Arduino here: ArduinoCommsLib.zip

Categories: Uncategorized
  1. January 21, 2012 at 5:02 am

    I just received the Adalight kit as a gift. I was looking for a better way of controlling the lights, since, as you stated and I concur that Processing takes up way too much cpu usage. Your setup seems to be very great but my problem is that my coding skills have went a long time ago. I downloaded your files and from what I can see is that I have a problem with SPI.h file stating it isn’t there when I verify the system. I don’t know if it another hard piece I need to create or not. I would love to get this together and I don’t know if you can do a step by step or not. Any info would be awesome but if you can’t it is all good.

  2. January 21, 2012 at 10:41 am

    Hi Jeremiah, thanks for checking out my project. Hopefully we can get it working for you so you can enjoy your gift.
    I’ve had a quick browse around and it looks as though the SPI code is a library used for serial communication to peripherals. The original Adalight used this library. I don’t think I do, but there may be some lingering references to it somewhere…
    I don’t remember downloading or modifying SPI.h at all and you should be able to find it in your arduino’s environment folder in “Arduino\libraries\SPI”. If it’s not there you could try downloading a fresh Arduino environment from http://arduino.cc/en/Guide/HomePage.
    While I was having a hunt around my “Arduino\libraries” directory I also found a directory called “AdafruitWS2801LibraryF38d610”. The WS2081 header is actually referenced in my Arduino project so I would definitely recommend downloading the library from here: https://github.com/adafruit/WS2801-Library and placing it in your “libraries” directory.
    If either of these works please let me know because I should include it in my setup instructions. Otherwise I can do some more investigating.

  3. January 21, 2012 at 6:34 pm

    Thanks for the very fast response. I found out last night that something got screwed up in couple of the files in my Arduino folder. I just replaced all the files and added all the ones you told me last night and it then compiled correctly. I uploaded it and now the first led turns blue and stays solid. I am looking through the code and trying to find which pins I use to control the lights. I am just using an Arduino Uno. One of the main questions is do I need to create a hardware SPI. All I know is if I get this going I am going to create so many more. Thanks for all your help.

  4. January 23, 2012 at 8:33 am

    Hmm, well the Uno is based on the same microcontroller as the Duemilanove and you have a fairly similar IO layout so there shouldn’t be too much work needed to modify the setup. In my setup I configure the WS2801 to use digital pin 2 as a data pin and PWM pin 3 as the clock pin. I would think that any of the digital pins should work for either of these 2 outputs to be honest. Sometimes the wire colours on the LED strip can be a bit different in each batch so you’ll want to make sure that you’ve actually got the data and clock wires the right way round (if you look closely at the LEDs you should see writing on the chip showing which wire is 5v, which is GND etc).
    I must confess that I don’t know too much about SPIs, all I know is that the WS2801 library seems to take care of this in software for me on my setup so I wouldn’t think you’d have to build anything elaborate like that yourself.
    One blue light is a start, so I’m sure we can figure out what needs to be done to get the rest of the lights blazing!

  5. January 24, 2012 at 11:18 pm

    I got everything to work with it sending information. I had to move some files around for it to properly detect them, since it was nothing looking for them in the libraries folder. I didn’t really want to edit the code so I moved them to the same directory as the pde file. The only thing that is wrong now is the controlpanel.exe program does not work properly. Out of my many stop and starts it has worked only a couple times for me. It is sending information to the lights but no correct information is getting there. When I change to option to static colors and change to a specific color it pretty much never goes to the right color. Also if I rapidly click a box/led location in the monitor gui it will change colors to all the leds. It works off and on for the wallpaper selection. I haven’t gotten video capture to work at all, when running all it does is randomly change colors to the leds.

  6. January 24, 2012 at 11:21 pm

    I forgot to mention when I do all options like static color, wallpaper and video capture it shows all the correct information in the controlpanel.exe application, it just isn’t outputting it properly to the arduino.

  7. January 25, 2012 at 8:40 am

    Hi Jeremiah, Well I’m glad that the Control Panel seems to be functioning correctly. I’m just wondering whether there’s some way for you to modify the Arduino & its code so that you can check each step of the functionality. Because the C# app makes a serial connection to the Arduino, I don’t think you can get the Arduino to write back down the serial to display its data on screen. You could perhaps attach 3 single, basic LEDs to the output pins of the Arduino and use them to test that the RGB values are arriving correctly at the board. e.g. If you set the static colour to red, you would expect the first LED to light up, if you set the colour to green, the second would light etc…
    I’ve got a pretty simple DLL that does the PC -> Arduino communications. I’ll try to package up the source code a bit so that you can take it and perhaps modify it to help with your debugging.

    • January 26, 2012 at 7:14 pm

      As promised I’ve added a download link for the Arduino communications library in the post above. Hopefully by playing with this code you can find out why your Adalight isn’t working.
      To use it call “InitialiseArduinoComms” with the name of the com port that your Arduino is connected to (e.g. InitialiseArduinoComms(“\\\\.\\COM3”)). Then set each LED colour with “SetLED” and finally call “FlushColours” to update the LED strip.
      Then when you’re shutting down simply call “ShutdownArduinoComms”.

  8. January 27, 2012 at 2:28 am

    Just did some changes to the code to create an infinite loop of two colors washing across the leds from green to blue to see if there was something wrong within the board. The board showed no signs of anything being wrong. I got the same bugs when I connected the Uno to a different computer with the .exe file running. I also put the code onto a Duemilanove328 and ran the .exe with the same results. So there is something wrong with the serial bus sending corrupted/wrong data to the Arduino. I was going to get a serial bus monitor program to see if something wrong was happening there. I also know the usb cable I using was from my printer, which had to problems when being used with it. I downloaded the ArduinoCommLib file and will be taking a look at that.

  9. January 27, 2012 at 2:51 am

    I also would like to note that when I run the program the first time and have wallpaper setting selected it will be correct for a second and then some of the leds will change. When I run the program and have static color selected it won’t work until I select wallpaper/video capture setting and back to it before it will work. If I have wallpaper selected at startup and jump right away to static color it tends to work. If I keep jumping back and forth they tend to switch correctly but if I stop they usually stop working properly. This is all from when I reset the Arduino. Hopefully that makes sense. I will try to get a video up if that would help you. I

    • January 30, 2012 at 8:35 am

      Thanks for the feedback Jeremiah. I don’t think I’ve spotted that bug before so I’ll have a poke around and see if I can spot anything going wrong.

  10. February 4, 2012 at 3:23 am

    I was going to try and do some more debugging this weekend to see what is going on. I will give you more feedback asap.

  1. No trackbacks yet.

Tell me what you think!

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: