Yesterday Simon spent the whole day studying the concept of Cellular Automaton (CA), a discrete model of a system of “cell” objects used in physics, math and theoretical biology. He learned a lot from Daniel Shiffman’s tutorials on Cellular Automata and his book The Nature of Code (Chapter 7).
Simon describes Cellular Automaton as a set of rules for getting nature-like patterns. 1D cellular automata are static (think of a pattern resembling the Pascal triangle) and 2D are not static (the most famous example is Conway’s Game of Life).
The mathematician who made cellular automata a big thing (and even Turing-compatible!) was Stephen Wolfram. Simon also looked at some of Wolfram’s writings. Wolfram’s book A New Kind of Science is intimidating (in content and size) but full of graphic illustrations and available for free at http://www.wolframscience.com/nksonline/toc.html
A CA is basically a grid where cells live, each cell in a particular state (the simplest example being “1” or “0”). In Processing, it’s possible to have a CA draw a beautiful pattern this way. Simon tried to write a CA program in another language. He tried writing it in Python on his RaspberryPi first, but I overheard him say “don’t know how classes really work in Python, let’s try Ruby – I know how classes work in Ruby!” Then I saw him move over to the desktop and plug his long forgotten Arduino in. He said he now wanted to translate a CA code into C. Of course, there would be no pattern, but he wanted to have the Arduino “spit out numbers in the console” instead. Eventually he got an error and gave up, but it was intriguing to observe him.
The videos below show Simon talk about CA and program a CA in Arduino (C):
Simon wrote a sketch in Sublime Text (a text editor) and uploaded it on to his Arduino. It didn’t work at first but he found the bug.
I wouldn’t publish this video if it wasn’t for one observation: this electricity project would have taken two hours just a few months ago. Now Simon assembles things like this within minutes, without using any manuals, just as a little break from anything else he was doing.
Yesterday, while we were celebrating Halloween, Simon had more important things to do: he assembled his first laptop and spent hours programming it.
Simon changed the default blink LED code to make the LED double blink (cut down on the delay time):
Simon has been scrutinizing yet another platform, Particle (producing the Electron, Photon and Core microcomputers https://docs.particle.io/guide/getting-started/intro/photon/ ) and wrote this code online at https://build.particle.io/build/new
Unfortunately, he doesn’t have any of their devices to try it on.
Simon was trying to program his Arduino board to use a magnetic switch to turn an LED on and off, but the code didn’t work. The LED was burning no matter what we did to the wiring leading to the magnet.
Many of those crafty projects don’t work. Our DIY bend sensor project last month was a flop, too:
Today we had a much busier day as we had to bike for two hours to get Simon to his Scratch programming class. That said, Code Academy still largely ruled the day. Simon has completed four and a half courses by now and the tasks are getting tougher. Sometimes he finishes a tasks without errors, but mostly not and then he asks me to help debug his code. We sit down together and go through it again and brainstorm and try different variants. Yet it hit me that most of the time it’s not I who finds the final solution but Simon.
And he even squeezed some Raspberry Pi Photon Red Board programming in, too:
To write a Python project in Arduino Simon had to calculate how many milliseconds there are in one day, one month and one year. Here he explains how he did that (in Dutch):
This is the result. As it turned later it does contain errors, but still impressive for someone who is only getting acquainted with both languages. The code, that Simon says should be uploaded on New Year’s day at midnight, should be able to send you weather and humidity updates every hour, every day or every month, depending on your personal settings.
Every morning Simon smiles at me and says: “It’s morning!” That means he can get back to his projects and doesn’t have to stay in bed anymore. Friday morning he got up and rushed to do what he had planned the evening before: make a drawing of how a battery works:
He then turned to making a battery of his own using a screw, a coin and a lemon. It didn’t really work to light up an LED, the voltage was probably too low. Simon kept trying with different wires and electrodes. He was so involved in the process that he had little interest in his math class this time and his tutor who came in the middle of the battery session had no choice but watch Simon carry on, with a few breaks when he managed to grasp his attention to do some math. The battery project ended in quite a creative conglomerate of Arduino, digital clock and an apple. Simon invented a way to restart the clock by using a transistor in this rather grotesque circuit: