I often found myself checking the weather forecast on my phone before leaving the house to choose the appropriate clothing. This may not seem a time-consuming habit, but because everyone in my family looks up the weather, this adds up quickly. The idea was to create a gadget, that shows the current weather and the forecast for the next few days. The requirements: easy to use, easy to understand, always working device with reliable information. I used Weather Undeground's web API to periodically query the weather forecast and the current weather conditions.
The brains of the project is an Arduino Mega microcontroller board, its task is to download the forecast from the internet, process it, and display it, then wait some time, and start again. There are a quite a few challanges to overcome:
The Arduino Mega can't connect to the internet by itself, unless an additional module is connected to it (Ethernet module or WiFi module), I chose the ESP-01 board, which has an ESP8266 microprocessor on it, and the communication is done via a serial port. It was easy to integrate this module into the project.
I use the 10-day hourly forecast API, which returns a ~300 KB (!) response, the format is JSON (key-value pairs in Javascript style). The microcontroller only has 8 kilobytes of memory, so either it has to be processed (that means to extract the numerical values of the temperature, humidity etc.) in seperate chunks (each hourly data point is around 1 KB), or it has to be pre-processed elsewhere beforehand. It is also possible to program the ESP8266 to do this task, but it has also doesn't have enough memory to do it in one step. Therefore I uploaded a PHP script to a server to compress it by removing a lot of unnecessary or unused parts. The compressed response takes less than 3 KB of space that fits easily in the memory of the Arduino Mega.
During testing I found, that very rarely the data download fails (around 2% of the time). Because the forecast is updated rarely, this equates to around one failure per day. When this happens, the code can't progress further, and the device will freeze and has to be reset manually. I didn't investigate the exact cause of it yet (may be a timeout problem, or weak signal). For a workaround, I implemented a 15 second watchdog timer, which will reset the device automatically, when a failure is encountered.
The user is able to select an hour in the future, to display its temperature, humidity, wind speed, cloud coverage, rain probability, a textual description, and a picture; this is done with the two large red buttons. After a few seconds the selection will disappear, and the current weather data will be displayed. There is also a light sensor (a photoresistor) to change the screen brightness; this makes it readable in daylight, but also comfortably readable in total darkness - it is not blinding to look at during the night.
The screen is also touch-sensitive, this is used to turn off/on the backlight completely. Here you can see a demonstration:
When both buttons are pressed and held, a debug screen will be shown with information about how many times a button was pressed, how many times the device started up, and so on. This is stored in the EEPROM non-volatile memory.
The device was on display at my university, because I entered it into a competetion for gadgets built by the students.