Building Large LED Installations

Pages
Contributors: Joel_E_B
Favorited Favorite 21

Setting Up the FadeCandy Server

If you've opted to use the FadeCandy, this is a good time to set up the control portion of the project and begin testing your LED strips. This tutorial assumes that you already have you Pi set up and can ssh into it or have it attached to a monitor, keyboard and mouse.

Inside the examples folder of the FadeCandy GitHub, you'll find a config folder that houses a few different config files for the server. With help from this tutorial, the file below was created for mapping the layout of the CandyBar, which required accounting for the 60 LEDs per strip version I have, versus the 64 LEDs per strips that are set as the default in the file.

{
    "listen": [null, 7890],
    "verbose": true,

    "color": {
        "gamma": 2.5,
        "whitepoint": [1.0, 1.0, 1.0]
    },

    "devices": [
        {
            "type": "fadecandy",
            "map": [
                [ 0,    0,   0, 60 ],
                [ 0,   60,  64, 60 ],
                [ 0,  120, 128, 60 ],
                [ 0,  180, 192, 60 ],
                [ 0,  240, 256, 60 ],
                [ 0,  300, 320, 60 ],
                [ 0,  360, 384, 60 ],
                [ 0,  420, 448, 60 ]
            ]
        }
    ]
}

Another gotcha is that the mapping assumes you are creating an array of LED strips, like a display, and the CandyBar is just a line of LEDs. Thus every other strip was mapped backward, with strip one mapping from 0-59, and the following going from 119-60. You can account for this in software or in the server config file should your project also be linear in design. I ended up just accounting for it in software. The Python sketch below was great for a quick test.

language:python
#!/usr/bin/env python

# Light each LED in sequence, and repeat.

import opc, time

numLEDs = 480
client = opc.Client('fadecandy.local:7890')

while True:
    for i in range(59, 0, -1):
        pixels = [ (0,0,0) ] * numLEDs
        pixels[i] = (255, 255, 255)
        client.put_pixels(pixels)
        time.sleep(0.01)
    for i in range(60, 119):
        pixels = [ (0,0,0) ] * numLEDs
        pixels[i] = (255, 255, 255)
        client.put_pixels(pixels)
        time.sleep(0.01)
    for i in range(179, 120, -1):
        pixels = [ (0,0,0) ] * numLEDs
        pixels[i] = (255, 255, 255)
        client.put_pixels(pixels)
        time.sleep(0.01)
    for i in range(180, 239):
        pixels = [ (0,0,0) ] * numLEDs
        pixels[i] = (255, 255, 255)
        client.put_pixels(pixels)
        time.sleep(0.01)
    for i in range(299, 240, -1):
        pixels = [ (0,0,0) ] * numLEDs
        pixels[i] = (255, 255, 255)
        client.put_pixels(pixels)
        time.sleep(0.01)
    for i in range(300, 359):
        pixels = [ (0,0,0) ] * numLEDs
        pixels[i] = (255, 255, 255)
        client.put_pixels(pixels)
        time.sleep(0.01)
    for i in range(419, 360, -1):
        pixels = [ (0,0,0) ] * numLEDs
        pixels[i] = (255, 255, 255)
        client.put_pixels(pixels)
        time.sleep(0.01)
    for i in range(420, 479):
        pixels = [ (0,0,0) ] * numLEDs
        pixels[i] = (255, 255, 255)
        client.put_pixels(pixels)
        time.sleep(0.01)