You may have seen Princess Mononoke (if not you should stop reading this and start watching it right now) some weird tree spirits, called kodamas, who appeared and moved as Mononoke walked by them.
Well we thought that the concept of spirits appearing and reacting to human presence was a great concept, and so we thought really hard about how we could use this concept in real life.
This gave life to our Spirits of the City !
What do they do ?>Our spirits are currently able to express themselves to humans with LEDs, they have a RGB one in each eye, a big UV one in there head and one in their heart. They are also able to talk between each other with radio modules.
Currently they are split into families (or tribes) of a few children and a father. When the father sees someone passing by in front of him (with a PIR) he wakes his children up (who were asleep) who will then do synchronous light patterns all together.
How do they do it ?>Let's start by the children as they are the easiest to describe.
Currently they are put in sleep (all threads are asleep) and check every 2 seconds if they have received a radio message from the father. Indeed, the radio module nRF24L01, keeps the messages it receives, so they can be checked once in a while without loosing them. This way we can save a lot of power consumption by being awake less than 1% of the time when no one passes in front of the tribe.
Once they have received a wake up message from the father, they wake up and wait for a message containing the animation to display. This way the father can wake up all the spirits and then send them the same animation so that they will display it synchronously (otherwise they would have a delay). Once they have received this animation, they display it, then go back to sleep.
The behavior of the father is also rather simple, he sleeps as long as the PIR doesn't see any one, once it does (output to 3.3V) he wakes up and sends wake up messages to all the children, displays an animation, then sends the same animation to all the other spirits.
Checking if there is someone is currently doing by polling the value of the PIR (even though it's bad) in the next version of the code it will be done with interruption (which is better for real time application and energy consumption).
What next ?
We still have a few things to improve on the current board, such as
- Setting up a watchdog timer so that we can leave them be in the streets for a long period of time without having to reboot them if they crash (which currently happens every 30 minutes).
- Using the light sensor on the board in order to detect when it is dark, so that they are only 'alive' by night, this would halve the energy consumption of the spirits. During the day they would be put into deep sleep, since their LEDs are not powerful enough to be seen in broad day.
- Add a speaker or a buzzer to the board so that they could play noises which would both make them more interesting and attract the attention of the people passing by.
We also plan on designing another board with only through hole components, so that every one could build their own spirits, and customize them by adding a few free I/Os.