The inspiration for this project is the numerous curves that are created by the intersection of a cylinder and a plane! I wanted to create an LED light show, but I have already built several LEDs cubes recently. I wanted to do something different, both from a hardware and software standpoint. And I thought this would be a fun environment in which to program –something with as much potential as a cube, but which is distinctly different!
I've chosen to use 8mm APA106 programmable LEDs for this tower. There're more expensive than regular RGB LEDs, but they are so much easier to work with both from a hardware and software standpoint. No shift registers - everything is controlled by two data lines. And no ISR (interrupt service routine) and no multiplexing between layers of LEDs - these LEDs are on all the time.
I decided to build my cylinder/tower as a set of 12 rings stacked on top of each other. The rings are 8" in diameter, and each ring contains 24 LEDs spaced 1 " apart (actually π * 8 / 24 but close to an inch). The rings are themselves separated by 1 inch, so LEDs are 1" apart in both directions. Acrylic rod is used to fasten the rings together to form the tower.
APA106 LEDs can draw 60 ma at max brightness and white, so worst case, this tower could draw 17 amps! But these LEDs are so bright that I seldom have the brightness set at more than 10% in software. And turning the whole tower white isn't really done anywhere either. So in practice, I never had any problem using the USB port to power it. And if you want to use a separate power supply, 2 amps seems to work fine.
ConstructionI found some 8 " diameter metal rings on Amazon that I thought would make a good base for my LED ring. It was actually a pleasant surprise when I found I could solder to them easily! The term "easily" is relative - the ring is heavy and a lot of heat is required to get it hot enough, so my 40 watt soldering iron was turned up all the way, and it usually had to sit there for 5-10 seconds before solder melted. I wet the ring with solder first before attempting to solder an LED to it, and always used clip heatsinks on the leads of the LEDs.
But I am getting a little ahead of myself. Before you can start soldering LEDs to the ring, you need to lead-form 24 of them per the diagram below
As part of the lead-form operation, I put a small bend at the end of the ground lead. It both makes it easy to identify, and well as making it easier to attach it to the ring.
Another preparation step before soldering LEDs to the ring is to mark off 24 even spaces on the ring where the LEDs will be placed. I also found the need to clamp the ring vertically while attaching LEDs. I ended up using the contraption below to hold the ring in place,
Once a few LEDs are soldered onto the ring, it is necessary to connect the data-in leads to the data-out leads as shown below. Note that clip-on heat sinks are always used to protect the LEDs.
After all the LEDs are on the ring, you should have one data-in lead for the ring as a whole, with the data-out lead across from it ready to go to the next ring above it. At this point, we are ready to connect all the +5 volt leads together with a straightened piece of 22 gauge tinned copper wire. Straighten a 26" long piece of wire by clamping one end in a vise and giving the other end a hard pull with pliers. Then attach it to the LEDs as shown below.
When you have a finished ring, you can test it, using the test sketch I have included. Testing is important - much easier to fix a bad LED or a cold solder joint now than when it is in the middle of a completed tower! Testing is accomplished by attaching the open data-in pin to UNO pin6. The included test sketch is somewhat different than the one in this video, but should show you if the ring is working properly.
Now you have to make 11 more rings. It's a lot of work, but with a little practice, you can get the task of making one ring down to a couple of hours.
It is important that the LEDs in each ring line up with their counterparts on the other rings. If the LEDs are spaced out perfectly, this isn't an issue, but I had enough small variations in spacing that I found it necessary to use one ring as a template for the others, always carefully placing the open data-in lead (the one not connected to a data-out lead) in the same place. (If you look closely at my tower, the first two rings don't line up with each other very well. But after that, I used this template approach with a much improved result.)
Once you have at least four rings built, you can start the process of assembling the tower. The initial assembly of the lower four rings is probably the most critical part of construction. We don't want to create a Leaning Tower of Pisa! To put rings together, you will need spacers 22mm high to create the 1" space between rings. I used 3D printed black plastic for my spacers, but 1/4" dowelling would work just as well. To hold the spacers in place, I used a little Blue Tack, a temporary adhesive.
The rings are held together to form the tower using six 12inch long acrylic rods. It is important to get everything exactly in place before applying these rods.. Once the rods are hot glued to the rings, it is nearly impossible to make any changes, so get everything where you want it first. Once you have everything in place, you can turn the tower on its side and hot glue the acrylic rods to the rings. The photo below shows the first four rings with the first three rods attached. Three more were then attached for a total of six. The rods are placed between the LEDs with 4 LEDs between each rod.
Once all rods are attached to the rings, the spacers can be removed and then reused as additional rings are added. When all 12 rings are in place, we are ready to connect the ground, +5v, and data lines between rings. This is done using 22 gauge tinned copper wire. The power rails are linked up with all 12 rings in parallel.
There are two data lines, each with 144 LEDs - one for the top 6 rings (which eventually goes to UNO pin 6) and one for the bottom 6 rings (which eventually goes to UNO pin 7). Each data line starts with the lowest ring and works its way up to the uppermost ring. I had originally planned on having only a single data line, but by ring 8, I started seeing some strange unwanted flashes of light. I thought at first that it might be the power rails, but adding some capacitors across the rails didn't help, so I resorted to splitting the tower into two data lines. That solved the problem.
So above is a picture of the finished tower. The Arduino UNO is installed at the bottom. I actually used my 4 remaining acrylic rods to suspend the UNO, using hot glue to attach everything together. An alternative approach might be to mount the tower on a base with the UNO inside. There are 4 connections to the UNO, Ground and +5v rails which connect to all 12 rings, and the two data lines to pins 6 and 7.
Programmable LEDs like the APA106 are easy to use because there are several libraries available that handle the timing of data pulses used to control them. For the previous projects I have done with APA106 LEDs (my 2nd 5x5x5 RGB cube and the triangle art project), I used Adafruit's popular NeoPixel software library. But for this tower, however, I chose the FastLED library. It has lots of great features plus some fast math functions that I thought would come in handy. It also allowed me to easily replace my rather crude 43 step rainbow palette with a 256 step palette. It has hundreds of functions, predefined palettes, and other stuff that I haven’t used for this project, but which make it a great choice for both this and future projects. And still another feature of FastLED I found very handy is its ability to easily do fades.
I always like to have a function that allows me to easily specify an LED and its color. With this tower, it needs to be in the form of setColor(row, column, color), where row is which ring it’s on and column is which position on that ring. This one routine deals with all the conversion from which data line the LED is on and what its position is in the data chain.
One powerful tool in the FastLED library is its object class of all web named colors. You just specify the color as CRGB::HotPink, where CRGB is the class and HotPink is the member of that class. But class members are hard to keep typing and annoying to pass to functions as parameters, so I used #define statements to set up a small palette of named colors that I can refer by simply their name without the CRGB::.
I have another function that sets the color of a particular LED as a rainbow palette hue from 0 to 255. Between these two functions, I can easily specify 10 named colors or generate a smooth rainbow palette of hues for any LED in the tower.
Another basic function I created was rotate(ring, direction), which rotates the content of any ring around on that ring. Each call is one step, but this routine can be used to rotate the content of the entire tower, or rotate parts of the tower in opposite directions, etc., creating many interesting effects.
One other thing I might mention about the FastLED library is that it directly supports the APA106 LEDs that I am using. While Adafruit’s NeoPixel library also worked with the APA106, I had to experiment with the setup to get it right. With FastLED, the setup is automatic just by specifying the APA106 as the LED you are using.
As I said in the beginning, one of the more interesting effects you can create with this tower is intersections between a cylinder and a plane. At first I thought about trying to accomplish this on the fly with math. But there are issues about whether the UNO is fast enough and it turned out doing it in tables was pretty easy, so I took the latter approach. Basically this table lights up the intersection of a plane with the tower at 18 different angles, and the height at which the intersection takes place can be varied. You will see the results in several different places in the show.
I used the same table approach to create various intersections of a cylinder with a sphere. It worked, though not nearly as effective as the intersection with a plane. There is one effect in the show that uses it. Both these tables are stored in program memory, so as not to consume RAM.
There are three sketches for the UNO included in the software package:
1) a quick test for a single ring.
2) a 45 second preview of the show
3) the 8 minute long show with 16 different effects or animations
All three are shown here in videos in this write-up (though the ring test is somewhat different than the one in the video).
One last thing on software. At the end of the main loop, where the different animations are called out, I have added a software reset. This normally wouldn't be necessary, but I have a bug somewhere in my software. Without the reset, after running numerous passes though all the animations, the program hangs. Likely I have something not coming off the stack in RAM when it should. It might even be an issue in the FastLED library. But I never found it, and the software reset insures smooth operation, though not the most elegant solution.
Comments