Blog - Sketching with Hardware

Team 4 – GlowBus

Published on: | Author: Annika Busch | Categories: 2015b, Best Projects, Projects

The Idea: 

pic_00
The GlowBus is a globe that displays meteorologic information through coloured light. This light is given by RGB-LEDs placed at strategic locations near 34 big or well-known cities. There are three settings to choose from: temperature, weather and day/night.
Temperature is indicated by red (hot), yellow (warm) and blue (cold) light.
The setting “weather” has blue for rain, yellow for sunny, yellow/blue flickers for thunder, continuous white for cloudy and pulsating white for snow.
Day and night is displayed by the LEDs glowing white with different intensities based on the current time in that area.

The Model:
The basis for the model is a blue painted, hollow polystyrene ball. The continents are made of fabric, which was pasted on the polystyrene ball with wallpaper adhesive to retain a slightly rounded form. The continents were then attached to the ball with needles.

pic_01

The globe stands on a laser-cut wooden stand which serves as a switch for the different settings. There are four holes in the base – one for each setting and one for ‘off’ – and a wooden cylinder with a copper bottom. The copper from the cylinder can connect three different circuits inside the base of the stand.
pic_02

We poked small holes through the polystyrene for the RGB-LEDs, which we then connected inside the ball. For each half we connected all plus and minus poles on a small breadboard, so it would be easier to reopen the ball.
Additionally, thanks to using breadboards we had to solder a lot less. To our astonishment and relief, we connected all the cables correctly on the first try.
Lastly, we interposed a capacitor between the Arduino’s plus pole and all of the LEDs’ plus poles.
pic_03

 

RGB-LEDs:
We chose WS2812 LEDs mainly because they were the only ones offered on the website we bought them from.
However, a few minutes after we wrote down their numbers, an excited Bernhard came to us and enthused about the LEDs. These LEDs only have one plus pole. You connect each LED with a plus and a minus pole. Then you connect the LEDs via a Din and a Dout pin. Thus, you can address individual LEDs via an array. This was perfect for our project, since we needed to control each LED seperately.

 

Implementation:
The idea here was pretty simple: connect to the internet via the provided ESP8266 wifi module, extract all the required weather information and parse them into values that can be used to control the LEDs. This, however, turned out to be a litte more complicated than expected and barely having experience with C didn’t really help either. Since the Arduino has very limited resources, we decided to fetch all the data on a seperate server. We used he OpenWeatherMap API for that, from which we can download the data as a JSON object. The server is written in Python and it produces an already parsed string with all the information we need, which is then saved in a file that can be accessed trough a URL. This means that the Arduino only has to get the data with a GET request (go figure) and process it. Processing it is really easy now, since we already formated the string in a way that it was easily convertible into usable values.
After writing all the code for this, we realized something: it didn’t work. We did get some of the data to parse correctly, but huge chunks of it appeared to be faulty or missing. It took quite a while until we realized that the whole string wasn’t downloaded in one go, but rather step by step, even though there was a loop that basically said “while data is available, read it”. That loop never fetched the entire data at once though and it kept aborting mid string and then restarting when the Arduino calls the loop method again. This was because of the way TCP works. Packets are sent, received, and then an “ACKNOWLEDGE” is expected before the next packet is sent. This means that, for that moment, no data is available, causing our loop to abort.
This was a problem because our parser worked with substrings of the input and finding indices of things, but this can’t work if the entire data is not there yet. So we needed to somehow make sure to only start parsing when all the information was there. Since we can manipulate the string anyway we want on the server, we simply decided to put an “ending mark” at the end. So now the condition wasn’t “while data is available, read it” but “while the ending mark isn’t there, read it”.
It turned out that a couple of other teams had the exact same problem, which they then solved very similarly. After parsing all the data into values, applying it to the LEDs was a piece of cake. We used the NeoPixel library to control the color and intensity of the diodes based on the values we got from the server.
Fancy stuff!

 

Final Words:
10/10 – Would attend again.

linked categories 2015b, Best Projects, Projects

|

Write a comment

Comment