Glow Flow LED Diffusion Test: Paper Towel

With Glow Flow sitting stable on three stubby feet, I am out of excuses and must confront an important but very challenging topic that I’ve been putting off: light diffusion.

LEDs are very bright point sources by nature, which is very useful for some applications. But most lighting applications would prefer to diffuse light across a larger surface. Unfortunately there is no single best way to do so, one method which is ideal in one application won’t necessarily be ideal on another. Getting perfect LED diffusion on a cost constrained, mass produced, real world product, is an art form sitting at the intersection of engineering, design, and black magic.

Fortunately, as an one-off hobby project, I don’t need to perfectly balance appearance with manufacturing cost and complexity. I just need “looks pretty good” and that’s an easier bar to meet. I’ll obtain a few experimental data points to guide my design, starting with some cheap and easy diffusers. And there’s nothing easier and cheaper than going in the kitchen to grab some white paper towels for installation with masking tape.

Pixelblaze glow flow paper towel diffuser tape closeup

Paper towels give better diffusion than standard copy paper due to their fibrous construction lending to greater thickness. This helps with their primary purpose of absorbing liquids, but in this off-label application it also helps with absorbing and redistributing light energy.

Wrapping a layer of paper towels around this LED helix had a surprisingly large benefit to making Glow Flow better looking. This was the first data point: I probably won’t need anything terribly fancy to achieve good enough diffusion. The second point came from pieces of paper towel that weren’t sitting flat against the surface: when they bulge away, the diffusion improves, so a little distance helps.

Pixelblaze Glow Flow with paper towel diffuser closeup

This was the state of the project when I brought it to show off at Hackaday Los Angeles July 2019 meetup. People seemed to like it, and I’m only just getting started on the exterior design.

 

Glow Flow Tripod Base

With my Pixelblaze pattern for implementing Glow Flow in good shape, attention turns from software back to hardware. First on the list is another iteration for the bottom end piece. Earlier I had installed a surplus handle on the bottom for experiment’s sake. It was a fun way to test some ideas using an already-printed piece that would otherwise have gone into the trash. But having taken the results around to show a few people, it was clear the lack of an obvious bottom to set it down was disorienting. Confused users are never good from a user experience design standpoint, so I’ll back off to a more conventional base.

With the extraneous bottom handle removed, Glow Flow sat on four screws used to fasten my existing end unit holding the USB power bank. As anyone knows, four points of contact are rarely on the same plane, resulting in a Glow Flow that rocks back and forth on three of the four screws. This had the risk of damaging the four screw heads, as well as damaging soft surfaces that the metal screw heads might scratch up.

Pixelblaze glow flow tripod CAD

To address this in the short term (and possibly long term) a base was designed with three blobs of contact, printed, and installed. Intending to be subtle, not calling attention to itself very much, but now it is obvious to people how they should set down Glow Flow on a tabletop. And once placed, it will stay level.

With that little annoyance out of the way, I’ll have to face a big challenge that I’ve been dreading ever since the start of this project: find a good way to diffuse my 300 LEDs so they blend together well.

Glow Flow Now Use All Sensors

Changing some things around in my Pixelblaze pattern for Glow Flow improved performance and responsiveness, which are good things in their own right. The primary focus and most of processing workload of Glow Flow will remain dedicated to the accelerometer. But with those performance improvements, now Glow Flow can spare a bit of time to incorporate remaining sensors available on the Pixelblaze Sensor Expansion Board.

Microphone

The collection of Pixelblaze sample code includes blinkfade, a sound-reactive pattern that brightens a random subset of pixels based on average energy level reported by the microphone. I copied most of the code, skipping the color selection portions as Glow Flow already has its own. I reduced the range of brightness and the count of bright LEDs because sound-reactive change is not the focus of Glow Flow. The goal for integrating microphone code is to make my rainbow liquid look like it is fizzing and popping in reaction to noise.

The core of code copied from blinkfade is a PI (proportional integral) controller, two thirds of the classic PID algorithm. Here the controller’s mission is to dynamically adjust microphone sensitivity so we have roughly a specified amount of reactive LEDs, expressed as a fractional targetFill value between 0 and 1. If the sensitivity is too high, more than targetFill fraction of LEDs will be illuminated, and the controller reduces sensitivity. Same for the other direction: if the sensitivity is too low, less than targetFill fraction of LEDs would illuminate leaving possibly nothing to see. In this case, the controller will increase sensitivity. When all goes well, this process ensures that the microphone is exactly as sensitive as needed to keep the light show interesting.

Ambient Light Sensor

The ambient light level sensor was designed to allow Pixelblaze LED installations to dynamically adjust their overall brightness based on ambient light. In direct sunlight? Crank up the power to make sure LEDs remain visible. Sitting in the dark? Turn them down to avoid blinding people. I had the ambition to devise something creative to do with this sensor, but I failed to think of something interesting over the past few days. So now there’s a straightforward implementation of the original intent, adjusting brightness based on ambient light.

These additions make Glow Flow a pretty good demonstration of using all three major sensors on the expansion board. The only things I haven’t used yet are its five channels of analog input. I have some ideas for that, but will postpone until later. The next step is to turn my attention back to hardware.

Pixelblaze pattern code for Glow Flow is available on Github.

Glow Flow Pixelblaze Performance

The first draft of Glow Flow is up and running, but response speed is sluggish. It can be argued this is an upside: it adds the illusion my glowing rainbow liquid is viscous, taking a bit of time to flow. But I want to see if faster responsiveness would feel better, so I start hunting for room for improvement. Here is a summary of top gains:

Only recalculate values when they change

The first draft were recalculating my rotation matrices for every LED. However, the accelerometer based rotation matrix values only change once per frame, so I could do it in beforeRender() once per frame instead of doing that work in render3D() 300 times per frame (once per LED.) That is 299 times too many! Fixing this mistake had a tremendous impact. Thanks to Ben for pointing this one out.

Skip multiplication with zero or one

A 3D transform matrix is a general mechanism to handle every possible 3D operation. Calculating a transform involves multiplying sixteen numbers. However, Glow Flow only requires two 3D operations: rotate about the Y axis and rotate about Z axis. The transform matrix for these operations are mostly filled with zeroes. We don’t need to perform a multiplication operation when we already know the result is going to be zero. These multiplications also have elements filled with one, which we can replace with an assignment operation. This cuts down from sixteen multiplications down to four. The improvement here is almost fourfold, corresponding to the ratio of reduction in multiplication.

Minimize data movements

Avoid using global variables is good programming practice, but when trying to extract every bit of performance, it is sometimes worthwhile to put that option back in the toolbox. In the case of Glow Flow Pixelblaze program, many things that are commonly passed as parameters are instead stored as globals. Example: the two rotate transform matrices, as well as the coordinate being transformed. The improvement here is very small, only a few frames per second, but noticeable.

These changes improved frame rate and responsiveness, making it more dynamic and giving me breathing room to add more features to Glow Flow.

Pixelblaze pattern code for Glow Flow is available on Github.

Pixelblaze LED Helix Pattern: Glow Flow

As someone rusty at 3D geometry math, it took some time for me to rub off the rust and get my spherical coordinate and 3D transform math up and running. But once that was debugged, the project has reached its first “ready to demo” milestone. It is now a colorful glowing LED helix that flows in reaction to gravity, so I’ve named it Glow Flow. Built using a 5-meter long strip of SK9822 LEDs under command of Pixelblaze LED controller and associated sensor expansion board by Electromage.

A recap of algorithm implementation details: The Pixelblaze 3D Pixel Mapper gave each LED on the strip a (X,Y,Z) coordinate in real world physical space. The accelerometer reported direction of gravity plus motion along each of three axis, which are translated to spherical coordinate space. Those two angles were then used to transform each LED from their physical (X,Y,Z) coordinate into (X,Y,Z) relative to acceleration vector.

Once transformed, Glow Flow chooses LED color based on the new Z coordinate. Emulating a half-full container of brightly glowing liquid, the plane where Z equals zero is the surface of the liquid. The positive acceleration Z axis is where the half-full container of bright fluid sits. Color hue is mapped to Z coordinate, so we cycle through one axis of HSV color space as we go deeper in this liquid, giving us a rainbow effect. On the negative Z axis, we have the air above the liquid where red-orange gradually cools to black.

This milestone marks the first functional draft of my interactive LED sculpture, with enough of 3D printed pieces, electronic hardware, and Pixelblaze pattern software, to see this pattern is visually interesting and fun for people to play with. The concept has been proven to work and now the process of refinement begins.

Pixelblaze pattern for this project is available on Github.

Pixelblaze LED Helix “Glow Flow” Math

Once new and more ergonomic handles were installed on my LED helix project, it’s time to pause on hardware advancements and switch gears back to software. Let’s see what we can build with what we have on hand before going much further with CAD and 3D printing side of things.

By this point I’ve selected one idea to implement, out of my list of candidate Pixelblaze projects: I want to implement a Pixelblaze pattern that gives the illusion my LED helix is a container holding brightly glowing liquid that moves around inside as it is moved. The accelerometer will provide input for physical motion, and Pixelblaze pattern code will adjust LED colors to present the intended illusion.

And to accomplish this, we’re going to have to do some math. Liquid sloshes about inside a container in response to sideways movement, and this is the acceleration vector of gravity downwards plus vector of however we’re moving the container around.

Rephrase another way: When a container of liquid is standing still on a flat surface, the downward direction of the container is lined up with downward direction of gravity. But when we start pushing the container around the surface, the downward direction of the container doesn’t change but the downward direction of acceleration does: the direction is now gravity plus motion pushing it across the surface.

Our LED helix 3D pixel map declares downward direction of the container as its Z axis, and the accelerometer reports downward direction of gravity plus motion. The difference moves the liquid, and this difference can be expressed in spherical coordinates, translated from cartesian accelerometer data with standard formulae. Once the two angles of spherical coordinates have been calculated, they can be used in 3D transforms for each LED’s pixel mapper coordinates.

The result is to translate a LED pixel position based on spherical coordinate of accelerometer tilt, so we can color in a LED depending as a function of the “down” reported by accelerometer. And once the colorfully glowing LEDs start emulating liquid flowing inside a container, we have our project name: the Glow Flow.

Pixelblaze pattern code for this project is available on Github.

 

New Sturdier Handle For LED Helix Project

The new LED helix top piece gained responsibility for keeping the battery pack in place in addition to aligning the Pixelblaze with LED geometry. The old top piece also provided a few simple handles, but the new top piece has been relieved of that task: there will be a more robust dedicated handle for this LED chassis instead.

The design is mechanically simple: arch attached with one screw at each end. This is a potential downgrade in strength, as the handle is now attached with only two screws rather than four. Hopefully it will still be strong enough.

Replacement glow flow handle v1 too short

The first handle version turned out to be too short. When my hands grasp the handle, my knuckles may bump against some wires or their connectors. It’s something I could avoid if I’m trying to be careful, but I’d like to be able to hand this to other people to play and not have to worry about being careful.

Taller replacement glow flow handle v2

A second, taller handle was printed to provide more clearance. We’ll find out if it does the job. In the meantime… what shall we do with the first handle?

Short v1 handle mounted to the bottom

Rather than tossing it in the trash, I attached it to the bottom end piece. Now the LED helix has handles on both top and bottom end. Now we can hold the helix with both hands and, if held using some compression force pushing the two handles against the middle, there would be minimal stress on fastening screws.

And also, a handle on the bottom meant the assembly no longer sits flat on a tabletop. Forcing the helix to always sit at an angle might be a fun way to show how it responds to gravity. With this round of mechanical upgrades complete, I need to sit down and work through some relevant math necessary for matching software.

Align Axis of Pixelblaze Accelerometer and LED Array

Once I figured out the accelerometer directions for a Pixelblaze Sensor Expansion Board, I realized an earlier oversight was going to cause problems.

Pixelblaze axis misaligned

The first draft of LED helix top end were designed with the following goals:

  1. Have an opening for top end of LED strip to enter interior
  2. Give me something to hold on to.
  3. Physically mount the Pixelblaze somewhere.

Goal #1 was simple to meet. I put in two arched bits of plastic for #2, and there wasn’t a whole lot of thought put into #3. The only goal at the time was to make sure the Pixelblaze doesn’t rattle around and get damaged.

Now that I want to play with the accelerometer and tie it in to my LED strip with 3D Pixel Mapper coordinates in 3D space, I realized my mistake: the Pixelblaze sensor is offset at an angle to the LED. In the image above, the red line represents X axis, the green the Y axis, and yellow is the Pixelblaze at approximately 15 degrees offset from the Y axis. This meant my initial test programs looked odd because the lights were reacting to a force vector 15 degrees offset from where they physically were.

While I could address this strictly in software by changing my 3D pixel map coordinates to match my Pixelblaze axis directions, moving the helix around also exposed more problems with the first draft that I could not solve with just software changes. First, the USB power bank started falling out of place as I had only designed a shallow stand. And second, the thin strips of plastic wasn’t a very good handle for moving the thing around.

So a new top end was designed and printed to satisfy slightly different goals:

  1. Still have the opening for the top end of LED strip.
  2. Give me something to hold on to.
  3. Physically mount the Pixelblaze in a way that aligns accelerometer axis with 3D Pixel Mapper axis.
  4. Hold the USB battery power pack in place.

This top piece no longer has to provide handles, instead I’ll add a dedicated and more ergonomic handle (or two) to this project.

Pixelblaze Sensor Expansion Board Accelerometer Direction

To me, the most interesting peripheral on the Pixelblaze Sensor Expansion Board was its accelerometer module. Its microphone seems to be a decently well-explored space, with multiple examples available on the pattern database, and I haven’t figured out how I would use the light sensor creatively. But there weren’t as many examples of using the accelerometer and I have a few potential ideas there.

The first task of playing with an accelerometer is to determine direction. From Pixelblaze documentation I know it will populate an array accelerometer of three elements for acceleration in X, Y, and Z axis. But which direction do each of these point?

Pixelblaze IDE makes exploration easy. Variables that are export-ed (like the variables to hold sensor values) can be watched live. This simple test program is enough to get started:

export var accelerometer = array(3)

export function render() {
}

Once entered, look for the “Vars Watch” window on the right hand side and a green “Enable” button.

Pixelblaze vars watch accelerometer disabled

Once enabled, Pixelblaze will display values of all exported variables and update them as the pattern is running.

Pixelblaze vars watch accelerometer enabled.jpg

Gravity is a constant acceleration towards the center of the earth, so we could tilt the Pixelblaze around and see which orientation shows the maximum positive number. The downward direction will be aligned with the axis showing the largest number while the other two are nearly zero. Once determined, jot them down in a notebook:

Pixelblaze accelerometer axis handwritten note

To double-check this answer, I went to look up the datasheet for the accelerometer chip itself. Looking on my expansion board, I saw the top was labeled with “*2815 C3H BCSHN” and a web search was inconclusive. Looking into Pixelblaze sensor expansion source code, I found comments marking code to talk with a LIS3DH accelerometer whose data sheet had the following diagram:

LIS3DH pin descriptions from data sheet

All three axis line up as my notes indicated, but their arrows point in opposite direction from mine. Perhaps there’s a convention I’m violating and the arrow actually points opposite of acceleration? This would allow the convenience of a Z pointing up when sitting flat where gravity is accelerating downwards.

Either way, this is enough information to continue. My earlier RGB-XYZ 3D Octants sample program was rewritten to add an accelerometer component. This way the colored blocks move around in response to physical movements of the LED helix. But the visual motion was not intuitive to a human, because my LED pixel mapper matrix does not align with my accelerometer axis. One way to solve that problem is with a new top end piece for my LED helix.

Pixelblaze Pattern: RGB-XYZ 3D Sweep

The success of a static test pattern in 3D space is encouraging, but it’s still in the realm of something fairly easy to replicate with a simple microcontroller. We have barely tapped into the power of a Pixelblaze controller. Using the pixel mapper is fun, but it’s the animation engine that makes a Pixelblaze exciting.

Resisting an urge to go wild, this next step is only a small incremental step from the static pattern. Again it is a test of all three coordinate axis, and again I will map RGB to XYZ in that order. The difference this time is that each axis and their positive direction will be shown with an animation, and since I’m starting to play in the time domain, each axis will get their own time to shine with an animated band of illuminated pixels.

The band needs to be wide enough to span several pixels, for a smooth handoff between one to the next. If the band covers less than two pixels, it would look more like a collection of blinking LEDs which might be cool but the objective is to convey motion.

Since the coordinate space is passed into render3D(index,x,y,z) in the range of 0 to 1, the naive first approach is to animate from 0 to 1. This turned out to look strange, because the animated band would pop into existance across several LEDs, reach the opposite end, and blink out abruptly. The solution to this problem is to increase the range of sweep so that our band (mathematically) starts off the display space before entering the stage, and exits the stage gracefully out the other end.

But that alone didn’t give us a pleasing sweep. I realized the band is too harsh so an additional blend was required: instead of LEDs turning on and off, there will be a ramp-up and a ramp-down for a smoother edge to the band. This looks better but might get in the way of diagnosing pixel alignment issues, so I left both as option in the code that can be switched back and forth with the style variable.

Code for this pattern is avilable on Github and also shared on public Pixelblaze pattern database as “RGB-XYZ 3D Sweep”

What’s next? Maybe add some interactivity by introducing some sensors into the mix.

Pixelblaze Pattern: RGB-XYZ 3D Octants

Pixelblaze documentation offers a simple pattern for testing that my 3D pixel map volume is indeed doing something in three-dimensional space: a simple call piped coordinates (x,y,z) directly into the HSV (hue, saturation, and value) for a LED color. This turns my LED helix into a cylindrical sample of the HSV color space. With this, I could look for color or brightness variations from one side of the cylinder to the other. A non-repeating variation across a single loop tells me X and Y axis are doing something, and a gradient from top to bottom tells me the Z axis is doing something.

The next step is to go from verifying it does something to verifying the X, Y, and Z axis are indeed pointing in the intended directions. And to do that, I wanted something that visually distinguishes each of the three axis and shows the positive direction for each axis. To meet this requirement, I implemented a Pixelblaze pattern to display my 3D pixel map volume cut up into eight octants.

Each axis will be assigned a color. To keep the axis color assignments easy to remember, They’ll be mapped in the order they’re typically named. Color components are usually listed in RGB order, and coordinates listed in XYZ order. Keeping the same order in both means red is X, green is Y, and blue is Z.

Along each axis, the positive direction half of the pixels will receive the assigned color. Pixelblaze render3D() coordinate parameters are given in the range from 0.0 to 1.0, so pixels with a coordinate from 0.5 to 1.0 will receive the color assigned to that axis.

Examples:

  • (0,0,0) lies in the negative direction of every axis, so it doesn’t receive any color and will be black.
  • (1,1,1) lies in the positive half of every axis, so it receives R, G, and B turning white.
  • (0.75, 0.15, 0.35) lies in the upper half of X, but lower half of Y and Z. So this pixel is assigned red.

This render3D() pattern displayed on a 3D pixel mapped display will visually indicate alignment and direction of X by all the pixels with a red component, alignment and direction of Y with green, and Z with blue.

Code for this test pattern is available on Github, and also shared on the public Pixelblaze pattern database as “RGB-XYZ 3D Octants”.

It is a functional test pattern, but not very visually dynamic. Pixelblaze is all about animated LED patterns, so the next step is to make an animated variant of this test pattern.

Pixelblaze Pixel Map For LED Helix

Completing first draft of a LED helix mechanical chassis means everything is in place to dig into Pixelblaze and start playing with the software end of things. There are a selection of built-in patterns on the default firmware, and they were used to verify all the electrical bits are connected correctly.

But I thought the Pixel Mapper would be the fun part, so I dove in to details on how to enter a map to represent my helical LED strip. There are two options: enter an explicit array of XYZ coordinates, or write a piece of JavaScript that generates the array programmatically. The former is useful for arrangements of LEDs that are irregularly spaced, building a shape in 3D space. But since a helix is a straightforward mathematical concept (part of why I chose it) a short bit of JavaScript should work.

There are two examples of JavaScript generating 3D maps, both represented cubes. There was a program to generate a 2D map representing a ring. My script to generate a helical map started with the “Ring” example with following modifications:

  • Ring example involved a single revolution. My helix has 30 LEDs per revolution around the cylinder, making 10 loops on this 300 LED strip. So I multiplied the pixel angular step by ten.
  • I’ve installed the strip starting from the top of the cylinder and winds downwards, so Z axis is decremented as we go. Hence the Z axis math is reversed from that for the cube examples.

We end with the pixel map script as follows.

function (pixelCount) {
  var map = [];
  for (i = 0; i < pixelCount; i++) {
    c = -i * 10 / pixelCount * Math.PI * 2
    map.push([Math.cos(c), Math.sin(c), 1-(i/pixelCount)])
  }
  return map
}

Tip: remember to hit “Save” before leaving the map editor! Once saved, we could run the basic render3D() pattern from Pixel Mapper documentation.

export function render3D(index, x, y) {
  hsv(x, y, z)
}

And once we see a volume in HSV color space drawn by this basic program, the next step is writing my own test program to verify coordinate axis.

3D Printed End Pieces Complete LED Helix Chassis

My LED helix core has been tested and working, but it needs additional pieces top and bottom for a fully self-contained package. I expect that eventually I’ll pack the interior of my cylinder with batteries, but for now it just needs to hold the USB power bank I’ve been using.

LED helix USB power bank base

The footprint for that power bank defined the center of my bottom piece, surrounded by four mounting screws to fasten this end piece to my just-completed core. A slot was cut in the side for me to tuck in the bottom end of the LED strip. Since this project is still developing, I expect to need to reach inside to fix things from time to time, so I cut a bunch of big holes to allow access, ventilation, and it’ll also print faster than a solid bottom plate.

LED helix top with handle and Pixelblaze mount

My cylinder’s top piece is designed to meet slightly different objectives. It shares the four mounting points, the outer diameter, and a slot for me to tuck in the top end of my LED strip. There were a few extra holes cut in the top, in case I needed an anchor point for zip-ties to hold down wires. I also added two segments curving towards the center to function as rudimentary handles for transporting this assembly. The final feature are two horizontal holes which will house M2.5 standoffs to mechanically mount the Pixelblaze board.

Pixelblaze V3 and M2.5 standoffs

Unfortunately there was a miscalculation and the top piece ran out of filament during printing, ending up shorter than I had planned for it to be. Rather than throw away the failed print, I decided it was close enough for use. I just had to drill my two holes for Pixelblaze mounting standoffs a little higher than planned, and now a few components poked above the enclosure by a few millimeters, but it’s good enough for completing the mechanical portion to support Pixelblaze experimentation.

Next step: configure Pixel Mapper to correspond to this LED helix geometry.

LED Helix Core Assembly

It was a deliberate design choice to build the top and bottom pieces of my LED helix separately, because I wanted to be able to iterate through different end piece designs. The core cylinder hosting most of my LED strip should stay fairly consistent and keeping the same core also meant I wouldn’t have to peel and weaken the adhesive backing for the strip. That said, we need to get this central core set up and running, dangling ends and all, before proceeding further.

LED strip helix soldered joints

Unwinding the LED strip from its spool onto this cylinder, I found one annoyance: this is not actually a single continuous 5 meter strip, but rather 10 segments, 0.5 meters each, soldered together. The solder joints look pretty good and I have no doubts about their functionality, but this seemed to affect LED spacing. The lengths varied just a tiny bit from segment to segment, enough to make it difficult to keep LEDs precisely aligned vertically.

LED strip helix 5V disconnect

Once held on to the cylinder with its adhesive backing, I cut the power supply line halfway through the strip by desoldering one of the 5V joints. (Leaving data, ground, and clock connected.) In the near future I will be powering this project with a USB power bank that has two USB output ports, one rated for 1A and other for 2A. Half of the LED strip will run from the 1A port, and the 2A port will run the remaining half plus the Pixelblaze controller.

Each end of the LED strip was then plugged into my USB power bank, dangling awkwardly, so I could verify all the LEDs appear to be illuminated and operating from a Pixelblaze test pattern.

Next task: design and print top and bottom end pieces. A bottom end piece to manage the dangling wires and hold that USB power bank inside the cylinder, and a top piece to mount the Pixelblaze.

3D Printed Cylinder For LED Helix

Translating the calculated dimensions for my LED helix into Onshape CAD was a relatively straightforward affair. This 5 meter long LED strip comes with an adhesive backing, so a thin-walled cylinder should be sufficient to wrap the strip around outside of cylinder. This cylinder will have a shallow helical channel as a guide to keep the LED strip on track.

That’s all fairly simple, but the top and bottom ends of this cylinder were question marks. I wasn’t sure how I wanted to handle the two ends of my LED strip, since wire routing would depend on the rest of the project. A large hollow cylinder is generic but the ends are task specific. I didn’t want to lock into any particular arrangement just yet.

Another concern is that an >18cm cylinder would be pushing the vertical limits of my 3D printer. Mechanically it should be fine, but it’s getting into the range where some wires would rub against structural members and filament would have to take sharp bends to enter the print head.

To address both of those concerns, I limited the central cylinder to 16cm in height. This would be sufficient to support all but the topmost and bottom most windings in my helix.  This cylinder will have mounting brackets at either end, allowing top and bottom parts of the strip to be handled by separate bolt-on end pieces. They should be much simpler (and faster to print) allowing me to swap them around testing ideas while reusing the center section.

Since this would be a very large print, I first printed a partial barrel in PLA to ensure the diameter and pitch looks correct with the LED strip actually winding around the plastic. PLA is probably not the best idea for this project, though, as bright LEDs can get rather warm and PLA softens under heat. My actual main helical barrel will be printed in PETG.

It was a long print (approximately 26 hours) and a long time to wait to see if it looks any good with my LED strip wound around it. (Spoiler: it looks great.)

LED Helix Parameters: Diameter and Pitch

A helix has been chosen as the geometry of my Pixelblaze LED project due to its straightforward simplicity: it turns a single line (the LED strip) into a three-dimensional cylindrical space. No cutting or soldering of LED strip pieces required.

The next step in the design process is to decide exactly what shape this helix will be. A helix has two parameters: the diameter of the cylinder it circles around, and the pitch or distance between each loop in the helix. I wanted my LEDs to be evenly distributed on my cylinder, so there were two options to build this grid: Make LEDs align vertically as they wind around the cylinder, or turn that grid 45 degrees for an alternating-winds alignment. The each have merits, I decided on vertical alignment. If I play with displaying marquee text on this cylinder, I thought it will give us crisper edges to individual letters. Horizontal alignment won’t be as crisp, due to helical shape, but we’ll see what happens when we get there. (In contrast: 45 degree alignment would be better at masking the overall helical shape, at sacrifice of inability to make a clean edge horizontally or vertically. That might be preferable in certain future projects.)

Vertical grid alignment for LED helix

With that decision made, we could calculate helical diameter and pitch based around space between each LED on my strip. 60 LEDs per meter is 1/60 = 0.0167 meter or 1.67 cm between each pair of LEDs on this strip. Maintaining an even grid means 1.67cm will also be the pitch of my helix. The desire to align LEDs vertically mean the cylinder circumference must be a multiple of 1.67cm.

LED cylinder parameters in Excel spreadsheet

I want to use the entirety of my 5 meter LED strip. So a smaller circumference would result in a longer cylinder, and a larger circumference a squat cylinder. I decided to find the size where the cylinder length is closest to its diameter, making it a cylinder that would fit well within a cube. A little math in Excel determined the closest match is to use 31 LEDs around the circumference, which results in a diameter of 16.4cm and length of 16.1cm. But for the sake of dealing with nice even numbers, I chose the adjacent solution of 30 LEDs around the circumference. resulting in the following:

  • 5 meter LED strip @ 60 LEDs per meter = 1.67 cm pitch both horizontally and vertically.
  • 30 LEDs around circumference = 15.9 cm diameter
  • 10 helical revolutions = 16.7 cm length

Next step: turn these calculations into 3D printable geometry.

Choosing a Shape For Pixelblaze LED Project

I’d like my Pixelblaze LED project to be portable. A quick math session has determined while the maximum possible power draw is quite high, a battery powered design should be possible in a more realistic scenario. With that concern settled, the next decision is on choosing a physical shape for this light show.

I want a three dimensional shape because I wanted to play with a cool feature in Pixelblaze: the Pixel Mapper. This feature allows me to specify a mapping from pixel order to their physical location. Then I can write my LED pattern in terms of physical position either in 2D (x,y) or 3D (x,y,z) coordinates, and let the Pixel Mapper figure out how individual LEDs will correspond to my pattern. This allows me to decouple a pattern’s logical behavior from a specific rig’s physical layout, allowing fun tricks like creating a pattern works equally well on 300 or 10,000 LEDs, just by changing over to a new mapping in Pixel Mapper. This would be an extremely powerful creative tool if I could get it to work for me!

Backing off from big dreams, I return to my 5 meter spool of 300 LEDs on a single strip. To support projects like mine, these strips were designed to be cut apart and rearranged. Solder pads are exposed so we could electrically connect them back into a single chain, no matter their physical arrangement. This sent me into analysis paralysis for a while trying to decide how to cut them up and how to rearrange them. Eventually I decided to do the easiest thing: I’ll use the strip in a single segment, no cuts.

The most basic way to create a 3D geometry from a single line is to curve it into a helix. In addition to not requiring any cuts or resoldering work, it also avoids sharp bends which these strips have only a limited tolerance for. A cylindrical shape is an easy introduction into the 3D space of pixel mapping, a “Hello World” before I tackle future projects with more sophisticated geometry.

Next step: designing a chassis for my helical LED strip.

Power Consideration for Pixelblaze LED Project

I now have a SK9822 300-LED strip up and running under command of a Pixelblaze, and since I configured the Pixelblaze to run the strip at 10% of maximum brightness, I was able to run everything on a USB power bank. This is fine for a quick test, but we should have a better understanding of power requirements for what lies ahead.

The standard rule-of-thumb for LED power budget has been 20mA per LED, and this appears to still hold true for RGB modules like the SK9822. With three LEDs per module, the popular recommendation is to budget a maximum of 3 * 20mA = 60mA per module. I thought the integrated control chip would add to this power requirement but I found no mention of such. With a 5 meter strip of 60 modules per meter, for a total of 5 * 60 = 300 modules, my strip may draw up to a maximum of 300 * 60 mA = 18,000 mA or 18 amps. Running at 5 volts, that is 5 * 18 = 90 Watts of power.

Yikes.

The good news is that, for these types of LED strips, the task of supplying power can be easily parallelized. While they must share a common ground and clock+data lines must run through them all, the voltage supply lines may be separated. So I can, for example, cut the voltage supply line every 50 LED modules and put a power supply on just that segment. 50 * 60 mA = 3,000 mA or 3 amps, which matches the maximum rating for the MP1584 chip I have been using to power my Raspberry Pi projects. I’d just need six of them in parallel to run this strip. I also recently found voltage converters built on the XL4015E1 chip, which can deliver up to 5 amps. This would allow driving the strip at max power with fewer modules in parallel.

These are all considerations to keep in mind as the project progresses, but those are not necessarily what will end up in the final product. Mainly because those numbers are worst case scenarios with every module illuminated at maximum brightness, and that’s boring and not flashy at all. In reality I expect to end with only some fraction of LEDs illuminated, and only at a fraction of their maximum power.

So that covers the LEDs, but how much power does a Pixelblaze consume? Since V3 is still under development, precise specifications are not yet available. But it is built around a ESP32 module and I could research from that side. According to this forum thread, ESP32 power consumption is fairly low at roughly 100mA. However, it will occasionally spikes up to as much as 0.6A for brief periods of time. In a LED project with hundreds to thousands of modules, a Pixelblaze’s power consumption is a negligible rounding error.

In the immediate future, I’ll proceed with the project running the strip at 10% brightness and only fraction of 300 modules illuminated. This will allow me to continue using my USB power bank to iterate on ideas and postpone finalizing power supply requirements until there’s a better idea of what the LEDs will do. And an important part of that will be deciding their layout.

Connecting LED Strip to Pixelblaze

Once our Pixelblaze is configured for a local WiFi network and type of LED strip, the next step is to actually make that electrical connection. It is also time to unplug the Pixelblaze from our computer, because once our LED strip is connected we will need more power than what a computer USB port can safely deliver.

SK9822 5m60 LED strip package

For this particular project, my Pixelblaze will be controlling one of these built from SK9822 LED modules, they are signal compatible with APA102 which is one of the control data types supported by Pixelblaze. This strip is 5 meters long with 60 LED modules per meter for a total of 300 pixels. That’s more LEDs than what I can track in my head, but well within a Pixelblaze’s ability as it could drive thousands of LEDs.

SK9822 5m60 LED strip wires

This particular package had a label which described the role of each wire. Not all of them have this information presented, and we have to determine 5V and GND rails using a meter. But even when we have a convenient label this time around, it is still worthwhile to double check. Not every LED strip vendor follows wiring convention: the red wire is not always 5V and the black wire is not always GND. Getting it wrong could destroy both our LED strip and our Pixelblaze. [UPDATE: Good news! Pixelblaze V3 features reverse polarity protection so it would gracefully tolerate reversed +5V / GND without damage, until we realize our mistake and rewire it correctly.]

Thankfully these strips were designed to be cut to length, with solderable pads for each of the four lines. This means we have conveniently accessible pads to check for continuity between a GND pad and (what we believe to be) GND wire, and 5V pad to 5V wire.

SK9822 5m60 LED strip connector on PixelblazeV3Thankfully it is less critical to get data and clock lines right. A mixup would mean nonsensical patterns or no patterns at all, but no permanent damage. For this particular strip, the data and clock lines were inverted from the order on Pixelblaze circuit board hence the yellow/green crossover visible in this picture.

The row of headers visible on the right is an expansion bus, capable of hosting the optional sensor expansion board which I plan to incorporate into this project down the line.

Because I had configured my strip settings to be at low (10%) brightness, I could power this entire rig with a portable USB power bank advertised to deliver up to 2A. This was enough to verify I could run prebuilt patterns on my newly connected LED strip. But how much more power might this setup draw? Time to do some math and figure it out.

SK9822 5m60 LED strip with PixelblazeV3 on USB power bank

Pixelblaze Project Begins With Initial Setup

A Pixelblaze is a small board who generates data signals for a color LED strip to display interesting dynamic patterns. These patterns are described via a program written in a web-based editor running on the Pixelblaze itself. It is a nifty little self-contained unit for projects that involve a large number of individually addressable LEDs. I have a prototype Pixelblaze V3 on hand for a candidate project. I’ll be using my blog here to publish a first draft of Pixelblaze general setup and configuration information, as well as documenting my work to apply a Pixelblaze to a specific LED project.

The first thing to do with a freshly unpacked Pixelblaze is to connect it directly to a computer’s USB port. A standard computer USB port will not provide enough power to drive a large LED strip, but it is a stable and known power source. It is useful for verifying a Pixelblaze was undamaged in shipping and for performing initial setup.

Ubuntu WiFi selection

Less than a minute after being plugged in, a new Pixelblaze would show itself as an open WiFi access point our device could connect to.

Pixelblaze network connect

Once connected, open a web browser and try to load any URL, we will be redirected to Pixelblaze WiFi Settings menu. The browser will complain there’s no internet access but this is expected: we’re just using this to connect to an actual WiFi access point. Select the network we want to use and login.

Optional: check the discovery service box. Because after this step is complete, Pixelblaze will not longer be an open access point: it would have joined the new network. To reconnect to Pixelblaze and resume setup, we will need to know its IP address. If this is not possible (or just inconvenient) check the discovery service box. This is an optional feature to let a Pixelblaze announce its address on a network.

Pixelblaze discovery

Once Pixelblaze’s own WiFi access point disappears, our device can rejoin the original network and visit http://discover.electromage.com to see addresses for discovery-enabled Pixelblaze on the same network.

Pixelblaze connected

If discovery is not enabled and the Pixelblaze IP address is known, we can point our web browser to that address. Or if discovery is enabled, we can clicking “Open” from the Pixelblaze Discovery Service list. Once a Pixelblaze is configured for a WiFi network, the “Saved Patterns” menu is where it will start.

Change to Strip Settings menu to configure our Pixelblaze for our LED strip.

Pixelblaze Strip Settings

Name: This will show a Pixelblaze default name, we can optionally replace it with a friendlier one.

Brightness: This is a slider bar that defaults to 100% brightness. In the case of most LED strips, this will be a blindingly bright setting that consumes a lot of power. For our initial test and experimentation, we don’t need to blind ourselves or burn that much power. Move that slider lower: somewhere in the 10-20% range will still be easily visible.

LED Type: Change this to match the communication protocol used by the LED strip that the Pixelblaze will be driving. If the modules on a LED strip is not on the list, check online to see which of the listed modules are compatible and select that. Example: SK9822 LEDs are compatible with APA102, so we can select APA102 for LED strips that use SK9822 modules.

Pixels: Change this to match the number of modules on the LED display that the Pixelblaze will be driving. Example: a 5 meter long strip with 60 LEDs per meter will have a total of 5 * 60 = 300 pixels.

Data Speed: Leave this setting alone for now.

Color Order: Leave this setting alone for now.

Once the Strip Settings have been updated to match our intended LED output device, we shift our focus to hardware. Unplug the Pixelblaze from our computer, and warm up our soldering iron, it’s time to connect LED strip to Pixelblaze.