The Collatz-O-Matic

Are you sick of having to work out the Collatz Sequence by hand? Run out of whiteboard space? Hand cramping up with all your scribbling? Then you need my latest project, the Collatz-O-Matic!:


Shown with LEDs spooled, ready for computation on the go

This came about because after the previous posts on Cellular Automata, I sent a link to Stephen Wolfram, he kindly emailed back and said he thought it was cool. However the email ended with: (emphasis mine)

P.S. If you’re into such things, you might enjoy

I think in all these years nobody has yet actually implemented this…

Darn it, that sounds like a challenge.

I had actually already planned out what my next project was going to be, but unfortunately my brain felt this was enough of a nifty concept to make me drop what I was doing and start sketching tag systems. After a brief dialog with my shoulder angels, I gave in.

A Post Tag System is a method of computing very similar to a Turing Machine. There’s an array of symbols, or a tape, or a queue, however you want to call it, and a simple series of operations are performed on it at each timestep.

My machine is set up to follow the Collatz conjecture, which we’ll describe shortly. Every step the following things occur:

  • 2 tags are deleted from the start of the tape
  • If the first symbol deleted was:
    • A – then write BC to the rear of the  tape
    • B – then write to the rear of the tape
    • C – then write AAA to the rear of the tape

That’s it. That simple behaviour is enough to implement the [modified] Collatz sequence below. (If the number is even, then divide by 2. If odd, then multiply by 3, add one, and divide by 2.  )

Collatz diagram v02.png

By the way, the Collatz conjecture is still an unsolved problem in mathematics. So far every positive integer tested flows to 1, but it’s not yet been formally proved that all positive integers will.

Back to the tag system! I started looking at systems with rolling balls, as Stephen Wolfram suggested. Hooking up a couple of servos to sort of sluice-gate the flow of balls from a set of hoppers is fairly doable. There are a number of ways to detect the different types of balls, but a colour sensor is probably easiest. I got some cedar spheres from the dollar store and started prototyping.

wooden balls 01.JPG

Computing in action.

Hmm… how many balls would I need? Based on wanting to calculate the Collatz sequence for each number 1 to 30, working out the maximum intermediate values for each… average ball size 23mm… let’s see…. length of the track is… Two hundred and twelve meters.

OK, perhaps a tad too ambitious for a quick project.

As an alternative strategy, I decided to use LED strip as the ‘tape’, and make a very simple interface with an arduino. Here’s how it works:

  • When the machine’s stopped, the A/B/C buttons add that symbol to the end of the tape.
  • If the tape holds only ‘A’s, ( no ‘B’s or ‘C’s), then update the numeric display at the bottom left to show the current number
  • Each step two symbols are deleted from the start of the tape, the corresponding rule lamp is lit up, and new symbols are added to the far end of the tape.
  • Clear button stops or resets the display, ‘Step’ runs one step of simulation forward (until the next number in the sequence is reached), and ‘Auto’ runs the sequence until it reaches 1.


Here’s the machine in action:

Fun fact, if you try and start from 27, then the machine will break! That’s because the values go up to 9,232 on the way to reaching 1. My (inefficient) code uses a byte per tag symbol, and the arduino only has ~2k of memory, so I run out of space long beforehand!

I put in some code to detect the tape running out, and here’s what it looks like after a few minutes of churning away:


Your modern electronics are no match for the might of the number 27.

Inside the machine is an Arduino Nano, some LEDs and switches, and a couple of meters of Adafruit Neopixels


Not my finest work, but it should be reasonably sturdy

The files are up on Thingiverse here for anyone that wants to make their own:

Posted in Uncategorized | 4 Comments

Cellular Automata Explorer

Continuing my cellular automata theme, I’ve just finished a device to allow some hands on play, and exploration of the space of 1D cellular automata.


I spent a while thinking on the interface, and settled on the row of switches to set the ‘rule’ for children of each possible 3 parent combination.

switch closeup.JPG

The gorgeous jewelled indicators were taken from the World’s Largest Electronics Collection, which I picked up previously and had to make an elaborate set of shelves to hold.

I’ve left space for a 7 segment display on the right hand side, to show the rule number in Wolfram Notation. Sadly I don’t have any in my parts bin just yet, so it’ll stay blank for a while.

I spent ages playing with various diffusers for the LED matrix, and settled on this combination of rice paper with a clear polypropelene layer for protection.

The lasercut mask underneath is rectangular, but with rounded edges. I wanted something to show the connectivity in the simulation was much stronger in the horizontal (“Space”) direction than in the vertical (“Time”) direction.


The colour matching of the LEDs looks much worse in this photo than in real life. Also occasionally these photo will ‘lie’ as to whether a single pixel was lit or not, since the LEDs are PWM’d to get brightness control.

Down the bottom left is a switch to specify whether the sim should start with a random configuration, or with a single centre pixel.

There’s three buttons to control the sim, Clear, Step (takes a single step) and Auto (steps continuously while held).

It’s rather satisfying to play with different rules and see how various patterns emerge:

Gif animation v01.gif

Rule 30 in action

Files are here for anyone that wants them:

It uses a pair of LED matrixes from Jaycar:


Posted in Uncategorized | 3 Comments

Cellular Automata PDF Worksheets

I’m quite fond of cellular automata, in particular the simple 1D cellular automata.


I was playing around, drawing them on graph paper, when I decided to make something a bit more easy for newcomers to see how it worked, and how to make their own.

By the way, if these sorts of patterns seem familar, you’re right:


Conus Textile shell – (photo taken shortly before animal declared bankrupcy over royalties to Stephen Wolfram)


There’s a space for the 8 possible cases, and for you to write the rule in Wolfram notation, and they layout hopefully makes it obvious how the two are related.


Circular version (PDF) — cellular-automata-practice-sheet-circles-v01

Square version (PDF) — cellular-automata-practice-sheet-v02

I’d suggest starting with something like either:

  • rule 30 – ( 0 0 0 1 1 1 1 0), or 
  • rule 110 – (0 1 1 0 1 1 1 0)

Since they’re regarded to be pretty interesting examples of behavior. (Fun fact, rule 110 has been proven to be Turing complete!)

You can also check out all the examples here:

I spent a while playing with having the pattern begin at the bottom, rather than the top. (‘Tree’ vs ‘Mountain’). I liked the growing vertically aspect, but for drawing with a pen I found it difficult to read the lower rows while covering in the cells above them, so I eventually settled on the conventional ‘Mountain’ style.

I was also tempted to make the working area more like a truncated diamond. Since the limited area of the page eventually means getting to a stage where working out the next cell depends on cells that are off the page and unknown. That cell’s daughter is similarly unknown, etc. The result of these forwards and backwards ‘light cones’ looks like a diamond shaped worksheet.

However it started looking weird, and I figured I’d keep it rectangular, and let people figure out about that by themselves🙂

It was also cute to play around with times when a cell was unknown, but would still not affect the daughter’s result. The boundaries of the known automata can be pushed back a little, in that case. Also if you make spot a mistake, you can track how it would affect the daughter rows.

Oh, and I’m sure I’ve made more than one error in my colouring in. No points for correcting me, but if you do use these sheets I’d be happy to share a pic here.🙂


Posted in Uncategorized | 2 Comments

My Coffee Table is a Robot – The Sand Plotter

Apparently I didn’t write this one up already. Here’s a build from a couple of years ago:


It’s a coffee table with a bed of sand, and underneath is a CNC plaform and a powerful magnet to drag around a stylus and make patterns.

The hardware is pretty straight forward. I bought a coffee table from Ikea and mounted a wooden frame underneath:


Then mounted the CNC gantry under that: IMG_7311.JPG

I spent a while troubleshooting the motion. Nick and I both made tables previously, and the secret seemed to be having a soft base underneath the sand, and also using a cylindrical disc magnet rather than a ball.


Spherical magnet made the pattern on the left, and a disc magnet mad the circles on the right

This is to minimize the amount of ‘uphill’ work the magnet has to do. A cylinder is just dragged through the sand horzontally, whereas a sphere tends to jump and skitter irregularly, which is bad for both the smoothness of the pattern, and how pleasing the sound is to hear.

Coffee Table v01.JPG

It has a glass top, but we removed it some of the photos.

Here’s it in the Powerhouse Museum, briefly brought in for a photoshoot before Maker Faire a couple of years ago. That’s right, something I made belongs in a museum😀


Posted in Uncategorized | Leave a comment

Standing Desk & Aluminium Extrusion

I recently got a bunch of aluminium extrusion so that I can rebuild the Turquoisebot in a more accessible way.


I’ve used OpenBeam before, but not 8020 style extrusion. As a quick test project, I decided to make a standing desk addon for my work table.


“Before you cut firewood, sharpen the axe.” 


I noticed the metal bandsaw was cutting atrociously, so I spent an hour re-aligning it & testing out the tension and perpendicularity.

IMG_1624.JPG IMG_1625.JPG

Not perfect, but at least the right angle joints didn’t fail the laugh test when I put them together.


Cutting the lengths


Completed stock

Some assembly later:


The completed table

It should be at the right height to have my elbows perpendicular while standing & using the keyboard.

As a construction method, I’m amazingly happy with it. I have an extremely sturdy frame, and it was very quick to put together. Moreover, if I change my mind in the future I can reuse all the parts easily.

Posted in Uncategorized | 2 Comments

Cause I’m a Rocket Lamp….


This was inspired by a pic, of a screenshot, of a photo sent to a friend of mine. No idea where the original came from. (If it’s you I’d love to give you credit).

I couldn’t resist immediately going out and getting a Saturn V kit after dinner, and finished assembling it at 2am. Next day I started on the wiring and assembly of the base. Completely rushed and I’m not going to impress any actual modellers, but hey.

Rocket Lamp

It’s just under 2m tall.

Lights are Neopixels and a quick sketch to make them flicker and flame.

rocket lamp 2

Edit: There’s been a few people asking for details of construction.

The base is a wood block with steel threaded rod for support. Unfortunately I didn’t have joiners, so had to use two rods and cable tie them together to get the length (Did I mention this was a rush project?)

The cloud material itself is polypropylene pillow stuffing. I went to Kmart and picked up their cheapest pillow that mentioned polypropylene for $5. I have about half left over.

This site here has a much more detailed writeup on making ‘cloud lamps’, which is how I got into this in the first place.

Edit2: Thanks to Reddit user Dschull for this photoshop:

Rocket lamp in space.png


Posted in Uncategorized | 16 Comments

Restoring an unusual vintage clock display

I had a good find a few months ago when I picked up that rack for holding my time goodies. It’s an old bulb display unit for showing the time.

Before we had LCDs, TFTs, and even LEDs, there were very limited options for displaying information electronically. One way to do it was decatrons, but the tiny neon glow they create is impossible to read from a distance. Mechanical displays are another option, but they are noisy and unreliable.

The solution this manufacturer used, was to make a projector, using an incandescent bulb, photographic mask, projection lens, and frosted glass display:

Bulb display sketch - single v01

Actually it was a bit more complicated, since each display must be able to show multiple possible digits, there were 12 bulbs, 12 masks, 12 lenses per screen.

Bulb display - group v01.png

Which, for a clock showing HH:MM:SS, means 72 light bulbs to replace.

I didn’t fancy restoring a clock only to have it blow again, so I decided to replace the bulbs with LEDs.


I played around a bit with the colour temperatures. On the left, the ‘1’ is displayed using the original bulb, on the right the ‘8’ is using a cool-white LED.

I decided that a warm colour was more in the original spirit of the clock, so I did a bulk order of warm white LEDs, and started replacing the bulbs.

In order for the projector to work well, the LED must be in the exact position of the old bulb. I lasercut some jigs to hold the LEDs in place, and glued the wooden pieces into the frame.

Afterwards I ran horizontal wires telegraph-style between the digits, and made a multiplexed setup with common-anodes for each digit.


I used an arduino with a $5 RTC module as an accurate time source, and programmed it to display on the multiplexed LEDs. (Later I’ll hook it up with the Rubidium atomic standards as the time source, but for now it’s more than adequate).


Here’s what the final result looks like:


I’m very happy with it. The crispness of the digits is something that’s almost unheard of with modern displays. Check out the points on the ‘5’, they could take your eye out.



Posted in Uncategorized | 8 Comments