Simon installed Processing on his RaspberryPi recently (using the terminal, which looked terribly sophisticated and scary as on Linux you’re forced to do everything through the terminal) and started preparing examples that he hoped to show during his own livestreams, but the RaspberryPi seems to have crashed, unable to bear the weight of so many examples…
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 tried out a new language Wolfram on his RaspberryPi. Wolfram is a programming language that can be used to program 3D print sketches. “With different functions and constants you can do it exactly the way you want”, Simon says. In the video below he used Wolfram in a simple terminal.
Simon later also used Wolfram in Mathematica, a text editor pre-installed on RaspberryPi.
Wolfram can be used to program objects for 3D printing.
Simon carried out a project on his new RaspberryPi today that allows to see his programming and problem solving level quite well. Luckily I was there on time with my iPhone camera to film and take pictures.
It involved a simple Blink-an-LED code for Python, but note that Simon wrote it completely from memory. Also interesting that since he was missing the M/F jumper wires required for the project he decided to use his broken M/M wires instead, which I thought was quite inventive.
He used Terminal to create a program called led.py, saved and closed the file and opened the File Manager. He looked for the led.py file, but it wasn’t there. So he hit Shift-Ctrl-F to search for it and found it. He opened the file by right-clicking on it and selected Python 2 (IDLE). He made sure the correct screen appeared and that the Python code was complete. He then ran the code by typing “sudo python led.py” . Unfortunately a syntax error message popped up.
After a moment of hesitation (when I though he maybe would give up) he said he knew what the error was: he missed a couple of comas. After inserting the comas in the Leafpad file he ran the code again. And it worked!! We were both so happy as if we witnessed sheer magic.
Later Simon also showed me how to make the LED light burn continuously or turn it off again.
The missing comas back in place:
When Simon got a new RaspberryPi 3 from Sinterklaas on Sunday joy quickly turned into drama as he discovered the old (and only) keyboard we had at home was outdated and had no usb connection. His original plan was to use the television screen as the RaspberryPi screen and that would have let towards constant struggle with those other members of the family who actually wanted to watch tv. What made things worse was that it was Sunday and all Belgian computer stores (and all other Belgian stores) were closed. Simon was devastated as he’d really set his mind on this project. We jumped in the car and drove to The Netherlands where people never stop working and neither does MediaMarkt. Within an hour we got a wireless keyboard and a nice Samsung screen, both at a good price, and went for a drink on the Grote Markt square of the old Dutch town Bergen op Zoom. And now we’ve got one more “desktop”.
It was Simon’s idea to reimage the corrupted SD-card, he tried doing it himself the morning after the crash. He downloaded Noobs and Raspbian from RaspberryPi’s website but couldn’t go any further. The desktop said the files were “damaged”. As it turned out later, they were zipped and the desktop simply had no space on the hard drive to unzip them. But that was a good thing Simon stopped there as he didn’t know he should format the SD-card first, before uploading the new OS.
Later the same day we received an email from PiTop support with the steps to reanimate our newborn. The procedure was quite like what Simon had suggested, except that were advised to start with extracting the old OS and formatting the SD-card. We also received useful links to download imaging software:
The new OS came directly from PiTop’s site.
After reimaging the SD-card Simon reinstalled the tiny thing back into the RaspberryPi inside the PiTop without removing the RaspberryPi – he has thin fingers! It was a very exciting moment, we didn’t know if it would work. But it did!!
Simon went straight on to programming again.
These were the steps we followed:
Extract the old OS from the SD card onto to your desktop.
Reformat your SD card by using SDFormatter which will ensure the the SD card is in the correct format.
For the most up-to-date version of the pi-topOS, download it here: https://pi-top.com/product/pi-top-os
Follow this link for instructions on installing the OS onto your SD card: https://www.raspberrypi.org/documentation/installation/installing-images/
Follow the instructions for, “Writing an image to the SD Card,” based on your operating system. (We had to install new imaging software at this pont). Once you’ve completed this you should be able to plug your microSD card back into your Raspberry Pi and go!
Didn’t really feel like going to his first Fench class this morning. All he wanted to do before and after French class was program:
We were utterly shattered when at the end of day two the PiTop stopped working. First it froze and we had to force reboot it by pressing the on/off button. This may have caused corruption of the MicroSD. The PiTop’s power does go on but the screen remains grey. Simon was crying bitterly at first but started looking for rebooting solutions on YouTube later in the evening. He is planning to reimage the SD-card tomorrow. Even if that doesn’t help there is a lot of learning involved in the process I believe. I have also written a letter to the PiTop support team.