At this point you should have gone through the network configuration steps from the prior page, and should have working internet access before continuing. There’s a little more software to be fetched…
Recent Raspbian versions have the git tool preinstalled, but for posterity let’s confirm:
sudo apt-get -y install git
Then retrieve the Fadecandy software from Github:
git clone https://github.com/scanlime/fadecandy.git
The package includes a pre-built executable for Raspberry Pi, but it’s built on an older version of Raspbian and won’t work on the current system. Not to worry, a new one can be compiled in just a few steps:
cd fadecandy/server
make submodules
make
This takes about 10 minutes to complete, depending on your internet connection. Once it’s finished, type:
sudo mv fcserver /usr/local/bin
To make the fcserver program start automatically when the system boots:
sudo nano /etc/rc.local
Just above the final “exit 0” line, copy and paste the following:
/usr/local/bin/fcserver /usr/local/bin/fcserver.json >/var/log/fcserver.log 2>&1 &
Then create a new configuration file:
sudo nano /usr/local/bin/fcserver.json
Copy and paste the following block into the new file:
{ "listen": [null, 7890], "verbose": true, "color": { "gamma": 2.5, "whitepoint": [0.7, 0.7, 0.7] }, "devices": [ { "type": "fadecandy", "serial": "TVUCPRXHXJQJOFKR", "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 ] ] }, { "type": "fadecandy", "serial": "DBDJIGEEZLWFYVYJ", "map": [ [ 0, 480, 0, 60 ], [ 0, 540, 64, 60 ], [ 0, 600, 128, 60 ], [ 0, 660, 192, 60 ], [ 0, 720, 256, 60 ], [ 0, 780, 320, 60 ], [ 0, 840, 384, 60 ], [ 0, 900, 448, 60 ] ] }, { "type": "fadecandy", "serial": "SIUEOKCKPNKVOLSN", "map": [ [ 0, 960, 0, 60 ], [ 0, 1020, 64, 60 ], [ 0, 1080, 128, 60 ], [ 0, 1140, 192, 60 ], [ 0, 1200, 256, 60 ], [ 0, 1260, 320, 60 ], [ 0, 1320, 384, 60 ], [ 0, 1380, 448, 60 ] ] } ] }
The “serial” strings refer to the unique serial numbers of each Fadecandy board: left, center and right. The default serial numbers above are meaningless…you’ll need to change them to the serial numbers of your own boards.
There are a couple of ways to get your serial number(s). If you haven’t yet rebooted the system since installing the fcserver program above, run it manually:
fcserver
Then connect each of your Fadecandy boards to a USB port. You’ll see messages such as this one:
USB device Fadecandy (Serial# TVUCPRXHXJQJOFKR, Version 1.07) attached.
If you’ve rebooted since installing fcserver, it’s already running in the background now, and you’ll instead find the connection messages in the log file:
tail -f /var/log/fcserver.log
Once configured, you can hunt down and restart the fcserver process, but I find it much easier just to reboot:
sudo reboot
If fcserver doesn’t seem to be starting up, check the log as shown above. It’ll warn of configuration file errors (the format is very exacting…missing or misplaced characters are not uncommon).
"whitepoint": [0.7, 0.7, 0.7]
At their brightest, each NeoPixel can draw up to 60 milliamps of current. With 1,440 of them, that’s up to 86.4 Amps, exceeding the limits of our 60A power supply. 60 ÷ 86.4 = 0.746, but we’ll round down to 0.7 for a slight safety margin. If using a different power supply or a different number of NeoPixels, adjust these numbers to suit.
Then there’s these “map” sections in the file:
"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 ] ]
Our 2-meter curtain strands each contain 60 NeoPixels. We could just produce data for 64 pixels and let the surplus be ignored off the end of the strip. But as a persnickety thing I didn’t like having to account for the extra nonexistent pixels in code. These map sections let us address the LEDs contiguously in software, despite the gaps in the physical layout. Each line contains four values:
- A channel number. This will always be 0 in our application.
- A starting pixel number as we’d like to address them. For example, the first pixel of the second strand will be 60 (normally it would be 64). First pixel of the third strand will be 120. And so forth through 1380, the first pixel of the last strand.
- The corresponding pixel number as handled by this Fadecandy board. Remember, it regards every strand as 64 pixels, always, even if physically shorter. So we’ve mapped the second strand to position 64, third to 128, etc. Unlike the prior value, these numbers apply to the current board only, not globally, so they’ll always be from 0 to 511, never larger.
- The number of pixels being remapped. 60 in this case, the length of our strips.
If you’ve created a different strip layout, you’ll need to adjust these tables accordingly. Or if using a Fadecandy board in its ideal configuration — 8 strips of 64 pixels — you can leave the map section out altogether.
Page last edited March 08, 2024
Text editor powered by tinymce.