Hacker Newsnew | comments | show | ask | jobs | submit login
Show HN: Web-controlled Christmas Lights with Node.js, Arduino, and Raspberry Pi (gnewt.at)
51 points by Gnewt 686 days ago | 7 comments



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.

-----


Yeah, that's the issue I initially foresaw. I didn't try it but I know enough about non-realtime-OSes that I know it would not have worked consistently. Even on the Arduino, sometimes you have to change the timing a bit -- it's not exact.

There _are_ RTOSes for the Raspberry Pi, but they may introduce their own problems. I don't mind having an Arduino or something smaller in there to handle the light stuff. Even if you want more control than the circular buffer implementation, it's incredibly simple to write a serial protocol to just individually address the bulbs.

If you wanted to minify it, you could have an ATMega on a PCB with just the necessary components to use as a 'shield' of sorts for the Raspberry Pi.

-----


Also relevant: http://www.cheerlights.com/

-----


Another also relevant – especially for people who'd rather buy the hardware than put it together from parts: http://dev.moorescloud.com/ and http://holiday.moorescloud.com/

Its (effectively) a RaspberryPi and an Arduino on a custom board, with Wifi, 4Gig SD storage, and 50 RGB Leds – with a bunch of software (based on top of ARCH Linux). At the current intro price – my RaspberryPi based imitation cost more in parts that the Holiday @ $129 (even though I'm using WS2801 driven leds and don't need the outboard Arduino, a 'Pi + SD Card + power supply + USB WiFi + 50 WS2801 LEDs cost me over $150 - the LEDs alone cost me $90 from Adafruit (a while back now)).

(I said "effectvely", 'cause it's actually an iMX233, not the Broadcom SoC on the 'Pi - it doesn't have onboard video or ethernet, but it does have a USB wifi adapter inside.)

(Full disclosure, I've doing a bit of web-service architecture and devops for them…)

-----


That's incredibly cool! Thanks for that. I think my next project will be implementing Cheer Lights functionality.

-----


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.

-----


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

-----




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | DMCA | Apply to YC | Contact

Search: