/Conway-8x8

8x8 Circuit Sculpture of Conway's Game of Life

Primary LanguageC++MIT LicenseMIT

Conway-8x8

8x8 Circuit Sculpture of Conway's Game of Life conway front conway back conway sideways

This project is the collection of files necessary to make the above pictured 8x8 grid sculpture playing out Conway's Game of Life on an ATmega 328P. This project spanned 3 separate periods: 110 hours were spent developing the original software and building a circuit sculpture for a separate 6x6 design which maxed the CPU capabilities; 20 hours were spent doing a technical analysis, refactoring, and writeup of the created data structure to scale from 6x6 to larger sizes; 130 hours over 3 weeks were then spent developing this project into new physical hardware.

The 130-hour period is captured in this github. This time was spent integrating the new 8x8 software to match new hardware, conceptualizing the full physical design from scratch, modeling the wooden case in Fusion360, designing the circuit boards in KiCad, producing CNC gcode for the PCBs and case in Fusion360, cutting the wood and copper/fr4 circuit boards on an Onefinity CNC machine, treating the wood and creating epoxy lenses, soldering the circuits, as well as testing and improving the design while in-progress. The project was created to demonstrate hardware implementation of a data structure (from concept to physical object) for a classroom grade, as this process is much more complicated than a solely-software approach. Unfortunately, the project did not count for very much credit, however the entire process was quite therapeutic and educational, and I was very pleased with the results.

What the Sculpture Does

brain PCB The sculpture creates a random gameboard using a floating microcontroller pin, and then applies Conway’s rules to evolve which cells live or die. The floating pin polls random energy in the air to seed the random number generator. The gameboard itself represents viewing one of an infinitely repeating 8x8 grid in every direction, as the top/bottom and left/right sides are considered ‘touching’ for the evolution process. Another way to visualize this is as a grid stretched over a torus. This implementation remembers 48 board histories to check for duplicates, as a duplicate gameboard will always evolve along the same path (which traps the display into repeating itself forever). The bulk of the processor’s memory is used in saving these histories. If a duplicate gameboard is detected in history, the living cells flash out of existence in a specific way to let the observer know they ‘lived forever’, and a new random gameboard is generated. Otherwise, the game will continue to play out until all cells die out, and afterward a new board is generated. This 8x8 board has 68,719,476,736 unique starting conditions possible.

You can see the sculpture running in the video below. Unfortunately, the camera shutter speed clashes a bit with the FPS of the sculpture so the video footage doesn’t look as good as seeing it run in person. Lopsided ‘blinky’ math is used to transition cells on and off to make it easier for one's brain to track the groups of cells dying and coming alive each evolution cycle. The video was recorded while testing that the sculpture display matched what the software was providing, with an external Arduino streaming data to the display and the laptop simultaneously. running display

I enjoy seeing the display run from behind the sculpture, where the LEDs can be seen through the circuit boards. running display from behind

The Project’s Goals

The intent of the project had two primary purposes: refactor the existing software data structure to be more efficient, and to develop new improved techniques for hardware creation to realize the data structure physically. In software, a technical analysis of the original 6x6 data structure was done and improvements were made to allow up to a 32x32 size (while still maintaining auto-reset features to detect if a repeating pattern emerged). Methods for further improvement were also discovered, but not yet implemented. After the software was improved, an 8x8 size for the hardware was chosen for timeline practicality. In hardware, the goals were to create working SMD circuits using a CNC process, integrating multiple of these PCBs together into a larger overall circuit, designing this circuit alongside a tailor-cut housing to host them, and to attempt using epoxy as an appealing LED lens.

The software was developed in Arduino IDE v1.8.13. The source code is provided here.

The Build Log

The rest of this readme is designed as a build log. The build process is documented below for anyone wishing to recreate this sculpture. STL files for all housing pieces are located here, KiCad files for the circuit are provided here, and images of the different PCB traces for an etching process are provided here. Creating/providing gcode is outside the scope of this writeup, as the process is highly dependent on the specific tools used to manufacture.

The housing is made from poplar wood, a light wood with a subtle natural greenish tint. The feet (and failed trim) are made from sapele, a naturally red wood. The wood and PCBs were all sealed with a polyurethane spray for protection. The circuits are all cut from single-sided copper fr4 PCB blanks. The CPU is a standalone ATmega 328P (flashed as a standalone chip using it's internal oscillator), 10k resistor (with yellow/blue shrink, to pull the reset pin up to 5v), and 10uF capacitor (seen on the rear, required for power smoothing). The LED PCBs use 74HC595 shift registers, 470 Ohm resistor arrays, and generic green 3V 20mA LEDs. A generic USB PCB was soldered to the GND and 5V lines of the bus PCB (the 328P chip used does not support USB data, so only power was connected).

After developing the software, the circuits were drawn in KiCad (v5.1.9) to find the practical sizes and shapes for the circuit boards. kicad

Once the circuits were designed and sized, electronic components were ordered and the wooden housing was modeled in Fusion360. After modeling, machine cutpaths were assigned and exported as gcode in Fusion360 and the back of the housing was cut. Wooden pillars were used to place the wood stock precisely on the CNC bed, as the board would need flipped on the next step, and the pillars allowed for exact X and Y axis alignment. Before cutting, a small amount of polyurethane was sprayed where the text engraving would be to prevent paint overspray from absorbing into the wood. After cutting, this engraving area was taped off and sprayed with black spray paint. After drying, sanding the area removed the excess paint but left the engraved text painted. cutting rear housing

The wooden board was then flipped, aligned to the bed’s peg holes, and the front was then cut. The front used different woodworking bits to create the wavy pattern, cut away bulk material, engrave lettering, and drill LED holes. The same spray paint technique from before was used to fill the LIFE lettering with black paint (green epoxy was added later). front housing front housing front housing

A process with two different types of epoxy was used for the visibile lenses over the leds. First, clear tape was placed over the display face, covering the LED holes, and a small amount of 2-part green epoxy was poured into the holes from behind. After the epoxy had time to set, the tape was removed and a different UV epoxy was added in a droplet-shape to create a magnifying lens over the top, then hardened with a UV light into its round shape. This picture shows the piece of scrap wood to test the process. Only one of the 5 test pours pictured has the UV lens over the top. testing epoxy

Additional trim was modeled and cut, with the plan to have more contrast in the design. trim design This did not work out as planned, though. The trim wood was cut to only be 3mm thick, but the board used was not perfectly flat and this resulted in a failed cut. Pre-processing the side of the board resting against the CNC machine bed flatter with a surfacing bit could have prevented this. There wasn’t enough sapele left in my shop to try again, so the contrasting trim idea was scrapped along with the failed cuts.
trim failure

Luckily, the section of sapele reserved for the feet was still usable, and this cut went well. feet cutting

The LED PCBs were then cut on the CNC machine. The electrical traces are 0.7mm wide, and I had not cut this finely before. A total of 4 different styles of bits were used over multiple days before finding a 60-degree (inclusive) carbide bit that cut well at around 10k RPM, with some of the finer angled bits breaking in the process. More than 15 PCBs were cut, with 8 being usable in the end. You can see some of the progress from right to left in the picture. led pcb cuts

Each PCB was hand soldered using a syringe of lead-free low temperature solder on the SMD parts, and lead-free spooled solder on the through-hole parts. The soldering was done with a combination of hot air reflow and soldering iron work until all connections tested correctly with a multimeter. led pcb soldering

The LED PCBs were then assembled using the bus PCB to connect them all, and then brain PCB was attached using solid-core wire (to create a floating effect) and a thin data wire was run to the data-in of the first LED PCB. All the data-out/data-in ports on the LED PCBs were then connected using solid core wire along the side of the structure. The USB port was also connected to the bus PCB, but only 5v and GND were connected to the USB port. completed circuit completed circuit from behind

The display was tested during assembly by streaming data from an Arduino UNO (with a 328P processor) using jumper wires, making sure the display matched up with what the software was outputting to the laptop over serial connection (shown in a video above). After the testing was verified and the circuit was fully assembled, the copper was sprayed with polyurethane to protect it from moisture. testing the circuit

After all testing was done, a standalone 328P was flashed with the 8x8 program (using the internal oscillator instead of external clock) and the circuit was attached to the housing with screws. The view from the rear while its running is still my favorite. circuit running and viewed from behind

If you’ve made it this far, extra thanks for taking a look! If you make one, be sure to let me know!