Introduction: LED Art Car Tank. FadeCandy + RPi
In this instructable I will demonstrate how to map LEDs to non-uniform shapes using 3 Fade candy boards, Raspberry Pi3, and first attempt at python. My friends have tasked me to upgrade their art car that is shaped as a tank so I take that idea and give a new design. The FadeCandy boards are an adafruit product so they have a great setup tutorial:
This instructable builds on that basic setup.
For this project materials as follows:
5 Sheets of 1/2 plywood (make sure its the good non warped stuff)
987 WS2811 outdoor LEDs
1 Raspberry Pi
3 Fade Candy Boards and mini usb cables
30a 5v psu
20v 5v psu (These are what I had laying around)
3 conductor 22awg wire (stranded)
Silicone glue x 4 tubes
Cameo spray paint x 8 cans
15/32 drill bit
CnC machine (optional)
Step 1: Design, Cut, and Paint
First I started off with measurements of the existing structure, in this case a golf cart. One side will be made from 2 panels and the door side with 3. Since the LEDs are 3" apart I decide to make the spacing 2 1/2. The tank tracks I made from 1 x 2 x 1/2 plywood cut on the table saw and sanded with the belt sander. The gears and rollers I made with my cnc machine. Carefully marking out a grid pattern I first pre-drill with a small bit so the 15/32 bit doesn't walk. I used a dremel sander to round off each hole front and back. When putting in the LEDs you want to maximize efficiency, don't worry about what numbers are next to which, we will worry about them later. How ever they physically fit best. I used clear silicone glue to hold each one in place at the correct depth. I didn't have enough time to make connectors so I soldered most things in place
Step 2: Numbering and Mapping
Each port on the fade candy can support up to 64 LEDs. We are using a variable size for each strand depending on how the design is laid out. I started marking each LED with a marker but then ended up just marking the end numbers. This is the tedious part, counting and putting them in an excel spreadsheet ( I like using open office). Depending on how you put the LEDs in a horizontal or vertical array you can use the autofill feature to making it easier. After each side mapped out in excel we can use them to arrange the array around in the code. You can also export the spreadsheet as a csv to quickly add them into your code. In such a hurry I left out a number (341) in between boards and rather than do a whole bunch of rewriting I eventually used it as a null placeholder to make equal length multidimensional arrays.
On the fcserver.json file, note that I used mostly 50 LED strips but not always, so the numbers need to be adjusted
Step 3: Coding
I only had a few good hours to code this thing before it had to roll out the door so forgive me if there are parts that are inefficient. First I ported over the wheel function from the arduino neopixel code so we can simplify one number to color instead of three. I then copy from the spreadsheet the numbers into arrays on how I want to sequence them, thus creating frames of animation. Looping through a multidimensional array simplifies things but requires it to be equal length so I substituted the LED i'm not using to make the array even. I ended up with a test pattern plus two good functions.
There are different ways in starting a program on boot. I edited the xyz.desktop file for the default user and added a line to start the python script so no other action is necessary for this thing to light up with power on.
For my first Python project it was fun and I hope that by showing my code will help some of you out there.
We have a be nice policy.
Please be positive and constructive.