This is a short piece about a nightlight I designed and constructed for some of my friends this Christmas. It is based on an ancient algorithm (circa 1970) by British mathematician John Conway called Conway’s Game of Life. It’s an elegant example of emergent behavior. If you have some graph paper and a pencil, you can play it by hand:
- Color some random cells on graph paper black.
- Go through each cell and count how many neighbors it has that are black (min is 0, max is 8). Write the number down in the cell.
- Go through each cell again, and turn all white cells marked 3 black.
- Leave all black cells that are between 2 and 3 alone.
- Turn any black cell greater than 3 or less than 2 white.
That’s it. If you run these simple rules, provably devoid of intention or complex behavior, on a grid of data, interesting patterns emerge.
This pattern is called a ‘Glider’. It predictably repeats and travels down and to the right over successive generations. There is no mention of Gliders in the game’s ruleset, no specifics on how fast they travel or how to form repeating patterns. But this particular pattern, processed through the rules above, produces an ‘organism’. Is biological life a vastly more complex version of this idea? Just a very complex repeating pattern borne without intention from the rules of chemistry?
Anyways, it’s interesting to think about is what I’m saying. But also not something you want to be thinking about 24/7. It’s something that’s nice to think about every so often. And so it seemed like the perfect idea to bring to the oft overlooked artistic medium of the nightlight. I’ve got a 3D printer, whose purchase I often seek to justify. And I love browsing around on Adafruit and listening to Boards of Canada and soldering things, and Christmas was coming, so why not?
On My Process with 3D Printers
I have my Microcenter-brand Replicator Dual clone pretty well-tuned to match my model dimensions, but it is not perfect. I go through dozens of iterations for my designs. Each iteration, I design something that will let me test as many aspects as I can without them interfering with each other, then I print it out. Next, I test it for fit and with calipers and screws, and make adjustments here and there in my 3D model based on the print. Then I print it again and repeat the process. If you are really moving, sometimes you can be tweaking one aspect of your design while a test print for a different design problem is printing and really iterate like woah. In my case, each nightlight enclosure takes about 45–60 minutes to print, so I would generally spend about that long making revisions to my 3D model during a session, and then retrieve the previous round’s print and immediately start the next.
When you’re really moving, and your printer is working well, this is a very rewarding creative process. I was fortunate and had a very low failure rate, only one out of probably more than 40 test prints failed. It was not always so.
Like any craft, 3D printing tools each have their own idiosyncrasies, and you can only master them through experience, repetition, and a complete understanding of the tools themselves. I started out in 3D printing by fixing up a Cupcake CNC back in the day, and my struggles to tune/rebuild nearly every part of the machine rewarded me with a pretty complete understanding of it. That experience really proved invaluable for troubleshooting and designing 3D prints. I’m only recently reaching a point where I’m usually able to go from idea to 3D print without too much back peddling. It’s been a long road to get here. But let me — a person to whom Blender appeared as an impenetrable riot of grey squares and chaos three years ago — stand as testament: you can do it. It Gets Better.
(Also: AquaNet (unscented). I’m serious. I spray a sensible mist of AquaNet on my heated print bed every 25 prints or so, and things almost never curl.)
Designing the Nightlight
For the Game of Life Nightlight, I wanted to use parts that were easy to come by. The Apple Cube USB power supplies are cheap and ubiquitous, they put out a respectable 1 amp of current, and have a nice, sharp-edged shape. I wanted to design an enclosure I could snap one of these in and out of without any fasteners. If I could do that, then the hardest and pretty much only potentially dangerous aspect of this project, connecting with mains voltage, would have been left in the experienced, supple hands of an Apple engineer I’ll never meet, with far more experience and liability insurance than me.
The processor and display module are both from Adafruit, coming in at about $6 and $10 respectively. The processor is an Adafruit Trinket, the display module is an LED Matrix w/ i2c Controller. I could have saved some money by designing my own boards, but I wanted to make something that I could eventually publish on Thingiverse for others to build, and I had a schedule to keep.
Zillions of versions of the Game of Life algorithm have been written. I derived my code from a handful of different sources (esp this one) I found through some Googling. The Trinket has just 5KB of usable program space, and I used very nearly all of it. There is definitely room for optimization, and I am including a rather large LED Display library I’m barely using. But again, I had a deadline, so once it worked and fit on the Trinket, I called it good enough to ship. I let the Game of Life simulation run until 125 generations have gone by, or all the cells are dead, whichever comes first, and the display shows the state of the game array.
I tried several different construction methods until I settled on the one that felt best balance of efficient and hard to mess up. First, I stripped and tinned all the wires I would need to use for each nightlight and set them aside. Then mounted the Trinket and display module in the 3D printed enclosure with some 4–40 screws. I then put healthy blobs of solder on all the pads to which I would connect wires (power, ground, and two data lines on both modules). Next, I soldered the wires that would carry power to the USB connector on one side, then to the power connection points on both the Trinket and the display module. I soldered the Trinket first and worked my way up, as it was the harder one to reach with the soldering iron. Because I wasn’t able to access the back of the board once things were mounted, these wires are soldered kind of surface-mount style. I would rest them on the connection point and then heat the wire and the point with the soldering iron, then pull the iron away away and hold the wire in place until it cooled. Next, after all the wires had been connected, I would program the firmware onto the trinket, then plug the dangling USB connector into an Apple USB cube to test it. If everything worked, I would see the screen light up, with a glider in a leisurely crawl across it. Finally, I gingerly snapped the USB cube into place and plugged it in, and then we were done.
I constructed a bit more than twenty nightlights in this way, usually 2 or 3 at a time. I got to a point where I could assemble one start to finish in about 20 minutes. I’d always plug them in and leave them afterwards to run for a few days, just to be safe. Navigating the house at night during this period of my life was a breeze.
Really, if I’m honest, I’ve always wanted to have a product. I like imagining that something I designed and built is being used by someone somewhere else. Occasionally, when I’m walking to the subway or grinding my morning coffee by hand for some reason, I wonder if anybody’s looking at something I’ve made. At its best, it’s like being in two places at once, and at its worst it feels sort of vain and needy. But, there it is. Deep cut.
It wasn’t until all the nightlights were constructed and ready to be shipped that I realized they needed some kind of context. I couldn’t just send my friends some hunk of plastic with wires hanging out of it that blinked randomly. That’s asking for trouble. Also, I wanted to share something with them that I found elegant and beautiful, but it required a little explanation. A user’s guide seemed like the right choice.
I opened the manual with a letter of holiday greeting / technical explanation. Also a few notes about children and pets, and the annotated source code. My wife Ashley whipped up a corporate logo, a field guide to various repeating patterns you might encounter, and a mysterious Ashley’s Corner section. Once the manual was done, it felt instantly completed, and much less like a suspicious package from some weirdo. A little polish goes a long way, and adding some documentation helps you present your work the way you’d like it to be seen. We boxed them up with copies of the manual and lots of padding, and shipped them off. Some of them even arrived in time for Christmas.
If you’d like to make one of your own, you can find all the information you need on the Thingiverse project page. I’ve also released the designs just for the Apple USB clip separately, for any other IoT projects you’ve been thinking about, but weren’t sure how you’d power/mount on the wall. Now you can do both with a $5, 1 cubic inch part, that you probably already have kicking around in a junk drawer at your house.