Since the beginning of my stay here I was trying to build something like this. And I did.
When I first came to Valencia I spent the entire first week basically going out everyday. It was in one of those nights when the Idea of a proper clock showing the Valenbici status for my closest station came to me.
I had several Espressif wifi chips and a ws2812 ledstrip with me so I got to work.
After some research I found out about the citybik api. This is basically a conglomeration of many citybike apis all over Spain and even more countries. The author has the app deployed on his server and filled with all the needed API keys, which means that I don't have to figure out how to get one for Valenbici.
Check it out here: https://api.citybik.es/v2/
Although this is a very cool project it has some implementation problems. It is for example possible to filter by network (eg: Valenbici) but not by station. That means that my small microprocessors have to process a 80kb gzipped JSON file, which is everything but efficient.
To make it work at all I first wrote a little JSON streaming parser so that I did not have to save this vast amount of unnecessary data. This was working, but still was far from perfect. For now I only displayed the numbers on a tiny OLED display, as processor I was using an ESP32.
So to improve this silly situation I wrote a simple nodejs script and put it in a docker container to run on my server (overkill I know... 😜). This does nothing else than requesting the file from the citibik.es api and then let me filter it by an HTTP GET argument. (Write me an email if you are interested in the code, it is pretty straight forward though)
With this solution in place I changed back to the ESP8266 as the main processor. After fiddling around with the LED strip for more than two weeks I managed to solder it properly (using the soldering iron at university made this possible, it was really hard with my crappy 7€ iron here...)
So here it is:
It has a motion detection sensor at the top. After about two minutes it plays an animation and disappears. When you move in front of it it turns back on.
There are two modes: one shows the time in white and the other one shows the valenbici status in green and red
In the Valenbici mode green means the available slots and red means the available bikes (slots with bikes). I am right now just querying the station in front of my door, but I also thought about a selection mechanism... Anyway I hope you like my little project, If you are interested in the code or have questions just drop me an email.
Subscribe to A Semester in Valencia
Get the latest posts delivered right to your inbox