LED controller (with Arduino, RaspberryPi and WebSockets)
I haven't posted here for a while so I figured I'd write about this little project I made some time ago. I've had an aquarium for some time but it had no lights so it didn't look that cool during the dark time of the day. I had an old Arduino Uno lying around from times before RaspberryPi and it just so happens that Arduino has 5 PWM output pins and I only needed 3.
I connected a single RGB LED and a couple of white LED's (which is enough to light a small aquarium properly) to the Arduino and made the program use serial connection to send and receive JSON formatted data.
Then I connected Arduino (using USB) to my RaspberryPi that I use as a home server and wrote a Perl script that connects to Arduino's serial port (using IO::Async::Stream).
The Perl script creates a WebSocket server (using Net::Async::WebSocket::Server) that allows realtime control of LED's and color modes from a web browser.
In the future I could tweak it a bit more and bring back the scripts that I used to switch on LED's based on events from IM clients (Pidgin/Skype) or E-mail but at the moment I'm happy with it as it is. https://www.youtube.com/watch?v=_Pirt0kDZcA