from Hacker News

Show HN: Web-controlled Christmas Lights with Node.js, Arduino, and Raspberry Pi

by Gnewt on 9/15/13, 11:25 PM with 7 comments

  • by btgeekboy on 9/16/13, 4:31 AM

    I tried porting the ColorEffects library from the Arduino to the Raspberry Pi, and it's either not possible to do, or it has to be done much differently than the Arduino does it.

    The problem is that the bulbs and the controller each have their own clock. You need to get Linux (a multi-tasking OS on a low-end chip) to write to the GPIO pins at the proper millisecond intervals. (Have a look at the underlying library; there are some values in there that are "well, these seem to work... adjust the timing if your chip's faster/slower.")

    It works on the Arduino because it doesn't have a multi-tasking OS running underneath it to preempt the task. If you could get a realtime OS running on the Pi though, you might have better luck.

    Good luck with the rest of this project. I did something similar at one point; I was using a RS-485 link between the Arduino and the controller. (Check SparkFun; they have some relatively cheap breakout boards for RS-485. I used one basic RJ-45 to bare pins for the Arduino end, and a RS-485 to USB adapter for the other.

  • by rubypay on 9/16/13, 2:45 AM

  • by andrewmunsell on 9/16/13, 5:05 AM

    I did something similar with a Raspberry Pi and a string of WS2801 12mm diffused LEDs from Adafruit:

    http://www.andrewmunsell.com/blog/raspberry-pi-leds/

    Because the LED string I used has an SPI-like protocol to control them, it can be done directly from the Raspberry Pi's GPIO pins without the need of an Arduino middle-man.

    Right now, it's implemented in Node.js as well (using the node-spi library), but I'm also working on a Golang version that's completely standalone and just uses the SPI device in /dev.

  • by cjdavis on 9/16/13, 1:29 PM

    Replacing the Arduino with a Digispark (http://digistump.com/products/1) would probably work well.