WS2801 RGB LEDs

WS2801 are a strip of RGB (red-green-blue) LEDs, and there colour and brightness can be in individually controlled. which means with some simple programming you can create some very cool effects (Not least of which is the BerryGlow).

AndyPi’s demo code for Arduino (Check out the Getting started for Arduino here) gives you a starting point for creating your own effects. You only need an Arduino and a strip of WS2801 pixels to try this – although a push button and potentiometer gives more scope for experimentation – see Fritzing diagram for the ArduLight below. The demo code is fully commented so you can see what each part does, and how to connect the hardware:

AndyPi_WS2801Demo.ino

The ArduLight
The ArduLight is a demo project for the capabilities of the arduino with WS2801 pixels, and it’s my first foray into programming with C++, which is the code the arduino uses. The ArduLight is a small lamp which can be changed to whichever colour you want. Farnell Electronics kindly supplied a number of components for this project. If you want to build it yourself, check out the links to the components below, and see the video here:


Further developments
If you have an entire string of pixels you could make some flashing Christmas lights, and I’m working on BerryGlow, connecting a string of WS2801 pixels to your Raspberry Pi and affixing them behind your TV. The LED pixels reflect the colour on the front of the screen, giving a more immersive viewing environment and reducing the amount of glare when watching in a dark room. There are some options available already, but I’m hoping to bring a low cost version for sale at some point this year…
I’m also investigating attaching a small microphone and creating a graphic equalizer or disco lights which respond to sound using these pixels.

Kit list for ArduLight
Arduino Nano (ATMEL – http://uk.farnell.com/arduino/a000005/atmega328-arduino-nano-eval-board/dp/1848691?Ntt=arduino+nano)
WS2801 pixel (1 off a strip)
10K potentiometer (VISHAY – http://uk.farnell.com/vishay-sfernice/t7yb103mb40/trimmer-pot-10k-1turn-thd/dp/1141664)
Push to Make (PTM) switch (TE Connectivity – http://uk.farnell.com/te-connectivity-alcoswitch/msps103c/switch-pushbutton-spst-no-500ma/dp/1598910)
USB cable (MOLEX – http://uk.farnell.com/molex/88732-8902/computer-cable-usb2-0-2m-black/dp/2313727)
PCB header jumper wires (MULTICOMP – http://uk.farnell.com/multicomp/mcbbj65/jumper-wire-assortment-65pcs/dp/2396146)
Heat Shrink (TE Connectivity – http://uk.farnell.com/te-connectivity-raychem/atum-6-2-0-stk/heat-shrink-6mm-black-1-2m/dp/1210460?Ntt=ATUM-6/2-0-STK)
Solder

Hardware Setup
I used an old desk lamp case to install all the components in, but with regards to the electronics, the following Fritzing schematic shows how to connect all the components up.

AndyPiDeskLight_schem

Refer to the info that came with your WS2801 pixels as to the identity of each wire – the colours are not standard and vary by manufacturer. There’s also and input and and output direction, so I’d recommend testing both ends if you don’t know before finally soldering everything up. As there was only a few components I didn’t use a breadboard but instead used the jumper wires to connect to the arduino, and soldered joints where needed, ensuring these were covered with heatshrink to insulate them.
GND and +5v were connected to a usb cable which I could then easily plug into a power supply. On the arduino I used, it needed to be powered externally and then plugged into the computer usb port for uploading, it wouldn’t work using the computer’s usb supply alone, so just be aware of that if you have any issues with your computer not recognizing the arduino.

Code & Usage
The code (download from http://download.andypi.co.uk/AndyPi_ArduLight.ino) has plenty of comments in it so you should be able to understand what is happening! Basically, you switch between modes by pressing the PTM. It cycles through, Red, Green, Blue, White, swirling colours and Black (off). You can alter the speed of the swirling colours by adjusting the potentiometer. Note that this is calibrated for one pixel only, when you have a long string of pixels, it takes the code a certain amount of time to change between the colours for the entire string, so it can’t change as quickly as with a fewer number of pixels.