Maria Vigilante – Sam’s point of view
“Reportada contaminação na água potável no distrito de Faro. Até novas informações apenas beba água engarrafada”
Those were the words of Maria Vigilante, in her Brazilian Portuguese, speaking to the audience of Shift Faro. Don’t worry though, there was no contaminated water since this was just a test message!
It all started in Manuel Seromenho’s IT-store in Quarteira. We were talking about the three day hackathon called Shift Faro happening on the 23rd of March and started to brainstorm some ideas. I told him about another hackathon I participated in back home in Stockholm were we created a talking Raspberry Pi that warns people of extreme weather. We started iterating that idea and I asked him if there was a service in Portugal that warns people if there’s any danger nearby. He showed me the website of “Proteção Civil” (www.prociv.pt). My nerdy reflexes checked the requests sent by the website and we soon realized that we don’t have to scrape the website, the API is not secured at all and anyone can ask their server for the latest events. The idea started to form.
That same day Manuel, full of excitement, sat up all night playing around with his Raspberry Pi and connecting it to his wifi. Internet was our biggest concern but it turned out to be the least of our problems since the Quarteira apartment I stayed came with a 4g internet dongle. Some days later we bought a power bank to make the whole thing more mobile. We also bought and a small red lamp for bicycles to make the box warn visually as well because why not?
API for events nearby, Raspberry Pi, internet via 4g-dongle, a small speaker, a powerbank, a red lamp. We were all set to start the project during the hackathon. But what about housing? The box has to look nice! We started looking around in his shop. A cd holder? Too round. Some old box laying around? Too small. What about a 1.5L water bottle? Perfect! We cut it just before the neck and shoved everything inside, it was trickier than playing Tetris but we finally managed. Manuel took a photo to remember the setup, and without him knowing I took a photo of him taking that photo.
During all this time we thought and thought and thought about the perfect name. I wanted it to be very personal to the audience and preferred a Portuguese name. We threw out name after name of what this box should be called. I honestly don’t even remember a quarter of all the names we said but at some point Manuel said the word vigilante which we both liked. The vigilant box? Yeah why not? But we were still not satisfied. Then he said that we shouldn’t see this as a box but rather as a person, just like Alexa it’s much more personal. I agreed. Mrs Vigilante? Maria?
“Why the name Maria, Manuel?”
“It’s a very common name here, we should call her Maria Vigilante, people will like it!”
The name made her alive all of a sudden.
March 23rd is here, the hackathon has begun and we’re ready to start programming. Unfortunately Manuel had to work during the days and at night he was a volunteer for the event sitting at the reception so I was partly sitting next to him coding and partly coding upstairs next to the other hackers. Since we both are Python lovers we decided that everything should be programmed in Python, including the backend which was written in Django. It was also decided that the backend will be hosted on Heroku since it’s pretty much straight forward to push a Django app(using a Postgres database) to it.
The workflow of the code is the following:
- The Django backend asks the API every 10 minutes if there are any new events
- It extracts the following attributes: id, latitude, longitude, position, text, municipality, district and parish.
- After extraction it saves the events to the database, if the id already exists then we’ve already handled this event and it is ignored
- The Raspberry Pi asks the Django backend every 5 seconds(with it’s MAC-address in the request) if there are any new messages for it.
- The backend uses the ip-address to determine the position of the client(in this case the Raspberry Pi)
- The backend will then filter the database within the client’s geographical area of events that it hasn’t been sent to it before(using the MAC-address we know what Raspberry Pi has got what message). Side note: this project was built to handle multiple Raspberry Pis. I don’t know why we did that.
- Once it has a new event for that particular Raspberry Pi, it will send it the message to speak
- If a Raspberry Pi have an incoming event it will:
- Firstly send the text to Google Translate. Wait what? Why? Well, because you can trick Google Translate that you’re a web browser(using request headers) and get an mp3 file with the text spoken in your preferred language, in this case Portuguese.
- Secondly blink the red light while playing a warning sound and the actual message:
<warning sound> “atenção” <warning sound> <the actual message>
The events from Proteção Civil were not meant to be read as normal sentences as we’d want them to be. They instead had types and were meant to be plotted on a map or listed in a table as the prociv.pt website suggests. To solve this I extracted all the different types of events from the API and listed them in a text file and Manuel who was sitting in the reception during the last night transformed all the 140+ different type of events into natural sentences. The sentences had a special character of where the location should be inserted in the sentence. For example “A fire has started in $” will for instance be changed to “A fire has started in Portimão” if the fire happened in Portimão.
We were exhausted, tired, sleepy and there were just a couple of hours left until we had to present our project. Maria was still just a bottle, but she was talking. So much that she annoyed the others in the room (we didn’t restrict her to only extreme events so she was basically warning us to minor stuff happening in the area). To solve the ugliness, we gave her a quick makeover. Paper around the bottle, a paper hat created by an origami master Miguel Costa, a logo and the all seeing eye. The end result was this:
The logo is her initials; an M and a V, merged into one symbol. The speaker by the way had a blue light which accidentally lid through just behind the eye. At the back side of the hat there’s easy access for the powerbank’s charging port and the volume control for the speaker. The red light was at the bottom making a 360 light effect.
Presentation time and we were first to showcase what we’ve been working on. I didn’t think much about the presentation and just wanted to explain what we did but was instead presented an idea by Inês Boski to perform a play of some sort.
“A play you say?”
“Yes and let’s have a grandmother being Maria Vigilante and then you present Maria Vigilante 2.0, the modern one”
Me, Manuel and Inês rushed into crafting an amazing presentation just minutes before showtime! We had a lot of fun on stage with our spontaneous show 🙂 Unfortunately, we didn’t time it very well so I didn’t get the chance to talk about the technology and where the data was coming from but I was more than satisfied, it was a lot better than what I had in mind. And the audience got to hear her speak!!!
Here’s a photo of grandma Maria(Inês) looking at her successor during the presentation:
Oh, another thing, WE GOT THIRD PLACE! 😀