Introduction - a life-long obsession

So I’ve been working on a new project and it is slowly growing more complicated, I figured it’s time to finally start documenting it.

When I was a teenager I read the book Jurrasic Park and became obsessed with Chaos Theory - from there I read the book Chaos by James Gleick which introduced me to Fractals, and for months my mind was lost in a world of imaginary numbers. My parents had just bought me a TI-81 graphing calculator which had a very rudimentary BASIC progrmming language and I coded up a fractal generator on my calculator. This was not a fast processor, and it would run for hours generating a 96x64 pixel fractal - I went through so many AA batteries!

From there I discovered the textbook Chaos and Fractals - New Frontiers of Science - and it was the only thing I asked for for my birthday. The book was full of fractals, example code, and introduced me to cellular autonoma - specifically Conway’s game of life.

The Game of Life

The Game of life has very simple rules. The environment is composed of “cells” - each cell is a pixel in an X-Y grid. You know, like displays, computer monitors etc.

  • Each cell can be alive or dead (1 or 9), and knows the state of it’s 8 neighbors.
  • If 1 or 0 of the cell’s neigbors are alive, the cell dies.
  • If the cell is alive, and 2 or 3 of it’s neigbors are alive, it stays alive.
  • If a cell has 4 or more live neighbors, it dies.
  • A dead cell with exactly 3 neighbors alive, becomes alive.

You iterate the cells in a loop. Each iteration the cells look at their neighbors and live or die according to the rules. Like a clock tick.

The rules are very simple, but the behavior that emerges is complex. You can populate the cells randomly alive and dead, and given a large enough XY grid, a vast array of complex objects self-assemble.

  • Static objects like blocks, beehives boats and tubs - objects that are stable over infinite iterations, until they are interfered with by other objects
  • Oscillators like blinkers, toads and pulsars that stay in a fixed area and repeat through a complex pattern over time (iterations)
  • Spaceships, like gliders and their variants that can move across the board and collide with other objects.

When objects collide crazy things can happen. This emergent behavior is interesting enough, but it turns out that complicated structures can be built and their interactions can perform useful calculations. Turns out Conway’s game of life is turing complete. This basically means that you can build a whole computer, inside of a sufficiently large XY grid.

Back in the 90’s it was computationally intensive to simulate a large XY grid - nowadays it’s trivial, but still fun :) I’ve been obsessed with this all of my life, and many of my electronics and coding projects have been somehow centered around this.

The Idea

So I have an idea. What if each cell (pixel) in an X/Y grid was a full, powerful computer in it’s own right (or possibly even a collection of logic gates dedicated to the GoL computation), and each cell is connected directly to it’s 8 neighbors.

There is no overarching ‘program’ that is scanning the grid and performing the calculations - each cell performs it’s own simple calcuations by looking at it’s neigbhors and choosing if it lives or dies. Maybe they’re synchronized by a shared clock signal, maybe they’re not.

Microprocessors have gotten so cheap and so fast that it’s financially possible to build hundreds of individual pixel modules, each with it’s own processor running at 10s or hundreds of mhz, and it’s own IO to connect to it’s neighbors. Because they’re re-programmable you can even experiment with different CA rules - or do something entireley different like have them run fractal calculations.

Aside Yeah, this is where I realize it’s kind of like neurons in a brain, each one interconnected with it’s neigbhors running some kind of calculation, self-organizing without a central program controlling them. There is a small difference - the input and output state is only on or off, to better simulate a neuron they’d have to be a variable voltage - but that’s just an idea for 2.0 :)

The Project - First Revision

So I fired up Kicad and started building. First revision was a 48x48mm square board with an ATTiny404 microprocessor. The cell’s states would be sent to pins along the edge of the board, to be soldered to it’s neigbors, and there are input pins along the edge to read the neigbors state - through a a PCF8574AP I2C IO expander. The LED was to be a WS2812 so that it could be different colors.

![image](../images/lifebrick_3drender_attiny404.JPG]

The component choices were all very reasonable. But once I uploaded the design to JLCPCB I realized that I need to spend a lot more time choosing compontents optimized for cost

  • The ATTINY404 is $1.37 each - very affordable but I’m looking at having 150 to 250 of these little boards manufactured. This cost alone quickly skyrocketed the budget and they would end up costing more than having the PCBs themselves manufactured.

  • Likewise for the PCF8574AP IO expander - $1.66

I want to build a 12x12 grid to start - that’s 144 indidvidual boards. The boards work out to very roughly $100 which is not terrible, but just the microprocessor and IO expander alone work out to $436 - plus they’re considered extended parts which bumps up the manufacturing price. Sure, I could get them a bit cheaper off aliexpress but not by much, and hand assembling 144 boards is not something I want to do.

Second Revision - a very cheap MCU, simpler IO expander

I picked the ATTINY404 because it was small, easy to use, and “cheap”. $1.37 is quite cheap for what you get, and great for single use - not so great when you need hundreds of them.

After a ton of additional research I decided to switch to the CH32V003F4P6. This is a great little processor - 32 bit RISC processor running at up to 48mhz, 16kb of flash, 18 GPIO pins and a wide voltage range. But the biggest feature is it’s price: $0.3678 - down to $0.2512 in quantities of 150+. I also experimented with a different IO expander - TCA9534PWR which is “only” $0.48 in quantities of 100+ - this ended up being my most expensive component at $68 for the total project. Booo.

Enter much research, multiple additional IO expanders and I finally settled on a classic - 74HC165. Many models are avilalbe, I settled on one that was $35 for 125. Much more affordable!

Which leaves the current project - **5 5x5 panels - 125 boards created, assembled and shipped, for $298CAD*. It’s up there, but do-able for a hobby project / home interactive art installation. And if I double the order to 250 boards it only goes up $89 - bringing the total cost closer to $1 per board.

Still more revisions to come

At this point I could pull the trigger and have them manufactured although I’d have to save up for a few months first. This is a benifit though - it gives me more time to revise my design. Currently the boards all have one shared clock signal, and each board only has 1 other output - it’s state - which is split and sent to all 8 of it’s neigbors.

But, what if each output could be controlled individually? Right now the boards can’t really send data to a specific neighbor, just all of them in a star. But if it could output to it’s right neighbor, or the one above specifically, I could pass actual data to them in a daisy chain, like the venerable WS2812B.

Data like - this is a 12x12 matrix, your coordinates are 2,7. Run this variation of rules. Run this algorythom (maybe calculate a Mandelbrot Fractal) instead of the game of life. A whole new world of programmable options opens up!

So the next version is going to include a 74HC95 IO output expander. Sure it’ll add $15ish to the project, but it opens up sooo many options. Plus to save on costs I had switched from a WS2812B to a basic red LED. I think I’m going to switch back to the WS2812B - more cost - but with all of the new options it would be great to be able to indicate more than OFF/ON.

So there we are. Be sure to stay tuned for more revisions and more lengthy blog posts. And someday, hopefully, actual pictures of an actual physical grid of these things installed on my wall, performing masivley overpowered parallel computation - so many blinkey lights!