# Secret Project Glow Cloud (Electronics)

A few months ago I ordered this Glow Gloud T-shirt, one of the first pieces of merchandise available promoting Welcome to Night Vale. A lot of other people love Welcome to Night Vale, and so the shirts were massively oversold for their first printing; as a result, I wasn’t sure when I was going to get my shirt. With a determination born of despondency, I turned to a big box of stuff I had ordered from Adafruit and a pile of fabric, and I said “Okay, I’ll make my own T-shirt. With glowy bits! And I’ll bet I can get it done before this T-shirt everyone else is going to have arrives!”

Four months later (and about three and a half months after the mass-produced T-shirt arrived), I wore my shirt for the first time. Here’s how I made it.

## Design and Vision

The Glow Cloud is a character that first appears in the second episode of Welcome to Night Vale. Canonically, it’s a glowing cloud that shifts color in an unspecified way and rains dead animals of varying sizes; it has other attributes which I encourage the unfamiliar reader to discover by listening to Welcome to Night Vale, and won’t spoil here because they’re not relevant to the shirt project. Since Welcome to Night Vale is an audio podcast, there isn’t a canonical visual representation of the cloud, but Welcome to Night Vale has a very robust fan art community from which I drew some inspiration; for other depictions, check out what Tumblr has to say on the issue.

I knew I wanted a recognizable cloud design, lit from behind by a LEDs which would suffuse the entire cloud with light. I also knew I wanted some kind of possibility for interaction with the Glow Cloud, and I toyed with a few ideas before deciding that I would use a light sensor to make the brightness of the LEDs correspond to the ambient light. I went through a few iterations before I landed on a simple hand-drawn cloud in the foreground, with the Welcome to Night Vale logo in the background hiding the light sensor.

I dithered a lot on the correct action of the LEDs lighting the cloud. It’s completely unclear in the source material whether the Glow Cloud glows only one color which is constantly changing, has regions which glow different colors, or does something else which is not obvious to mere human imagination. It’s also not clear whether the colors have a pattern, whether the cloud ever brightens or dims (or shows only colors not visible to human eyes), so I had a lot of freedom to just pick the action that I thought looked the neatest. In the end, I chose to have each LED run an independent randomization cycle, avoiding all-bright (white) and all-dark (black).

## Components

Most of the Glow Cloud’s electronic components came from Adafruit by way of Sector67, our local Adafruit distributor and hackspace in Madison, Wisconsin. The LEDs behind the cloud are NeoPixel independently addressable wearable LEDs, the light sensor is the TSL2561 wearable lux sensor, and the controller is the FLORA, Adafruit’s wearable Arduino microcontroller. The circuit is worked in 3-ply conductive thread, with the exception of the data lines, which are worked in some thin conductive thread I was gifted. I had intended to use a 1000 mAh lithium-ion battery to power the project, but the power needs were too intense and I ended up using the Goal Zero Guide 10 rechargeable battery pack instead.

The backing for the final project was a natural canvas. The cloud element is a piece of linen with embroidery floss edging. The cloud is filled with leftover batting from a project of my mom’s. The Welcome to Night Vale logo is worked in embroidery floss on linen. Layers were joined together with embroidery floss. The final home of the assembled design is a simple purple cotton shirt, provenance forgotten.

The final design used 18 NeoPixels ($31.46), one FLORA ($24.95), one TSL2561 ($7.95), and most of a 60-foot spool of 3-ply conductive thread (let’s call it$5.00 worth). The canvas backing material is $6/yard at my local fabric store, and the final project used about 14 of a yard ($1.50). Most of the embroidery floss and linen used in the project was gifted to me, and I reused a battery pack that I already owned. The total out-of-pocket cost was \$70.86, but it would’ve been more if not for the generosity of those around me and my access to multimeters and other tools at Sector67.

## Assemble/Insert

Despite this being my first electronics project, I didn’t fall off the turnip truck yesterday, and the first thing I did was test all of the components individually to make sure they worked. I connected the FLORA to a computer and ran it through some simple “light an onboard LED” code, then loaded it with the example code provided in the Adafruit NeoPixel library which I could use to make sure the LEDs weren’t faulty. I connected each LED to ground, power, and a data pin and made sure it lit up red, green, and blue as expected before I sewed it into anything. (Careful readers will notice that I missed something here. Don’t worry, I’ll be punished for that later.) I also hooked the clips up and ran the TSL2561 through some sample code which provided light readings over serial, and confirmed that the input reads seemed basically sane. I didn’t find anything broken, to my extreme delight!

I started out by laying out the microcontroller and some LEDs on canvas in a small embroidery hoop. I ran a single line through all of the ground connection points, a few continuous lines through all of the power connection points, and individual lines between each data connection on the LEDs.

I managed to get the first two LEDs lit in situ within about 90 minutes of beginning the layout, and I was feeling like pretty hot shit. Naturally, at that point I put it down and went outside, and didn’t touch it for another week. During the week I was away from the project, all of the ends of the conductive thread had frayed considerably, and some had slipped their knots entirely and lost contact with their components - it turns out the Adafruit folks were absolutely not kidding about the need for some kind of fray check on any knots or ends for this thread. I tried to do some remediation with hot glue, but the circuit was never entirely stable after that.

When the fabric was nicely stretched in the hoop and nobody was touching it or looking at it too hard, the circuit was healthy enough to run some nice demo code, including this rainbow cycle demo. I decided to plumb in the light sensor at this point, not realizing the magnitude of the stability problems I was seeing.

At this point, I touched some code for the first time in this project. In order to get a nice indication of the light readings from the sensor without having to read the serial port, I hacked the sample light sensor code and the sample NeoPixel code together, and wrote a loop that would change the brightness of the LED strip in accordance with the light sensor readings.

For as simple and stupid as it was, I found it surprisingly fun to play with. Bright lights are neat, and making lights do stuff is super fun! After some fun playing with this, I sewed the power, ground, clock, and data connections for the light sensor, wrote the more-or-less final version of the code, and was ready to call it done… except for a few minor problems.

First, I didn’t have a nice way to power the circuit. I had been doing all of my testing by powering it over USB, but that’s not too portable. I ordered a couple of lithium-polymer batteries from Sparkfun to address this, which would fit into the JST plug on the FLORA. In the couple of weeks it took for them to arrive, I had plenty of time to think about my other and more severe problem – the stability problems when the fabric was deformed in any way (or even just breathed on). I pulled and re-sewed a few lines and managed to stabilize it slightly, but I was still unsatisfied. And there was another problem - it just wasn’t big enough or glowy enough to do the Glow Cloud justice. When I looked at it, I didn’t think “ALL HAIL THE GLOW CLOUD”, I thought “Those are some nice twinkling lights! Aw.”

Then my Officially Licensed Glow Cloud T-shirt came in the mail, and I thought “okay, screw this, I gotta up my game.” I ripped the controller, sensor, and LEDs off of the canvas and began stitching on Glow Cloud Mark II.

This time I immediately hot-glued the knots and ends, which was smart, and stitched the circuit on linen rather than canvas, which was very, very dumb. The circuit, despite having all elements sewn in place and secured as well as I could make them, was also extremely sensitive. Experimentation revealed that this was because the fabric itself was prone to deforming around the elements, making “as secure as I can make them” not nearly secure enough. This circuit was doomed from the start for another reason; I stitched all of the lines with a single run of 3-ply conductive thread, and as a result there is very visibly not enough power getting into the circuit; the inner LEDs, which are further down the circuit, are consistently much dimmer than the outer LEDs. Had I stopped to remember high-school physics, I would’ve realized this was a totally expected result of wiring the LEDs in series. (A sensible person would’ve thought about this before embarking on a dozen hours of painstaking hand embroidery.)

If the brightness drop had been consistent across all of the LEDs, this circuit probably would’ve been usable. The LEDs are bright enough that even half-brightness is visible enough in daylight. Having such an obvious difference in the perceived power of different parts of the shape makes it a complete failure, though, so off I went onto Mark III - (slightly) bigger, bolder, better.

Mark III had to be the last iteration of the project. I had done most of the work on Mark II while recovering from surgery in November, and decided to redo the project in late December, just before Christmas. I wanted to wear the finished project to the Welcome to Night Vale live show on January 16th, and so I didn’t have time for any more mistakes or rework. After conferring with some folks at Sector67 with electronics experience, I decided to disregard the Adafruit circuit layout advice and take a different tack with the Mark III.

The previous iterations had the LEDs wired in series, with respect to the power and ground (i.e., the thread connects to the FLORA power or ground output pin, goes to an LED, loops through the connection on the LED, then continues to the next LED in the circuit). The addressing protocol for the NeoPixels demands that the data connection run this way, but does not actually require the power or ground connections to work like this. For Mark III, I made groups of power and ground buses (and used doubled-up conductive thread, hoping to be able to supply more power this way), and connected each LED in parallel to a ground and power bus.

I did a lot of testing of these LEDs as I added them into the circuit. Connecting them in parallel allowed me to decide whether to add more LEDs after the most important, shape-defining elements were all attached. The ten LEDs which formed the outlines of the cloud had no problems pulling enough juice to light up the whole night sky.

I kept filling in LEDs in the middle until the circuit began to get unstable, and in retrospect I probably should’ve quit while I was ahead or done some math or something; I ended up with 18 LEDs, out of the 35 that I could accommodate with the layout I’d chosen, and I had to do some special programming to keep two of them from flickering distractingly. (Without an impending deadline I probably would’ve taken everything apart and rewired it, but with only a couple of days to spare fixing the problem in software seemed by far more expedient.)

While populating LEDs in the Mark III circuit, I had been sewing in their connections to the power buses, but passing the data signal by just touching their data-in pads to the data pin on the FLORA with an alligator clip. Because the LEDs will retain whatever data signal they last received, the LEDs would stay lit until they were powered off; this meant I could just move quickly through the circuit illuminating LEDs without having to wire up the data connection in series. Unfortunately, this meant that I didn’t find the one LED in my circuit with a bad data-out connection until I’d already sewn it in. (Data-out, of course, was the one connection I didn’t test on all of the LEDs before I even set needle to thread.) I learned my lesson and tested all four connections on the replacement LED before sewing it into the circuit.

At 18 LEDs I pronounced the cloud circuit as done as it was going to be. I sewed the light sensor into the canvas after a quick and extremely imprecise chest measurement, then started on the decorative elements (details forthcoming in another blog post). I also made the programming changes I alluded to earlier - LEDs number 13 and 16 in the circuit had consistent flicker problems when attempting to run at high current, so I had the software turn them off when other LEDs were running at more than a quarter brightness. I also programmed those LEDs to use only blue (for LED 13) and green (for LED 16), to minimize the appearance of flickering when they were illuminated at all. Those compensating measures, combined with the batting diffusing the LED output, made the performance of the circuit acceptable for my purposes.

{% youtube -mpxDTA8Df4 640 480 %}