This is a really awesome DIY which results in sequential movement of pixels implemented with the legendary Raspberry Pi board! The link for the code has been given in the maker’s blog.
The heart of the project is in the code which is pretty easy to understand. The makers have called it a Lifebox! as there are two ‘species’ who compete to live. By species they imply the two differently coloured LEDs used, blue and red. The white LED acts as a ‘plant’ onto which the species feed in order to survive.
As far as the hardware section goes, it consists of a 32×32 LED panel attached to the GPIO. The LED panel consists of different coloured LEDs. The access to the GPIOs is memory mapped. A global pointer is used for GPIO registers and the used pins are masked. Pixel data is sent to the display, row by row, via the pixel arrays. Changes on address lines are minimized by cycling through the grey code.
Each of the species has eight different variables and these variables change their behaviour. This in turn affects their chances of survival. Be careful and check which bits you are setting and clearing in the pixel data. The working of the life simulator thread is pretty easy to understand. If the age of the plant is greater than the life expectancy then the plant dies. When the age is equal to zero, no neighbour’s plant is born.
The species logic is that if there is an individual alive, it will try to eat and grow. As it grows the amount of energy will reduce. If the energy is less than zero, it will die. If there is no individual of a particular species left, it is reborn again. The colour is set as red if it is species1, blue if it is species2, green is only for plants and black for nothing.
This is a very easy DIY as it barely requires any hardware. The end result is pretty cool to watch. Here is a chance for you to build your own Lifebox. Go ahead; watch those species fight for existence as only you can control their fate!
Filed Under: Reviews