At the Faculty of Mathematics and Physics, University of Ljubljana, as part of the FMF Programming Club, we set up a programmable Christmas tree. The project was made possible with the sponsorship of Abelium and Acex.
The tree is located at the entrance of the building at Jadranska 21 and is lit from morning until the building closes.
You can check the project's source code on GitHub.
Our tree consists of multiple components that work together to create a programmable Christmas tree. The tree itself is controlled by a Raspberry Pi, which continuously communicates with the main server to get the list of patterns to run. This program is called Korenine. It cycles through the available patterns and runs them one by one in a Docker container. The patterns are containerized in the Docker container and can be written in any programming language that can write to the standard output. The program reads the output of the pattern and controls the lights on the tree accordingly using a library. The current state of the tree is also sent back to the server, where it is displayed on the simulation on the website.
The main server, called Jelkob, hosts the project website, the pattern database, and the Docker registry. The website is written in Django and uses the Django REST framework for the API. Using the website, we can control which patterns are running on the tree and manually run them. The website also shows a list of available patterns, the current state of the tree, and the live simulation.
The patterns themselves are written in various programming languages and are stored in the Storži repository. Each pattern is packaged in a Docker container. The patterns can be written in any programming language that can write to the standard output, but we provide user-friendly libraries for popular languages like Python and JavaScript. Patterns can read 3D positions of the lights on the tree and control them accordingly by sending the desired colors to the standard output.
To get the 3D positions of the lights on the tree, we recorded multiple videos of the tree from multiple angles while running a calibration pattern. We then extracted a 2D position for each light for each angle. Based on these 2D positions, we then calculated the 3D positions of the lights on the tree. This was done using our program called Jelkulator.
Another big part of the project is Jelkly, a Scratch-like visual programming tool that allows users to create their own patterns without any programming knowledge. Jelkly is written in TypeScript using the Microsoft's MakeCode (PXT) framework, which uses the Blockly library. It provides the 2D and 3D simulation of the tree which enable users to see how their pattern would look on the real tree. Patterns created in Jelkly can be directly submitted to the server, where we review them, convert them to JavaScript, and add them to the Storži repository, where they can run on the tree.
If you would like to contribute your own pattern for running on Jelka FMF and already have programming knowledge, please check out the Storži repository that contains already-existing patterns and instructions for submitting your own patterns in various programming languages.
If you would like to submit a pattern but do not have programming knowledge yet, you can check out Jelkly, a Scratch-like visual programming tool for creating and submitting your own Jelka FMF patterns. It is easy to use even for beginners and people without programming knowledge, as it allows you to easily build programs using visual blocks.