Posted in: IBM Research-Ireland, Internet of Things

Building my own weather app with Watson and Bluemix

I am from Moyvore, Westmeath in Ireland – about 100 kilometers from IBM’s research lab in Dublin, where I work. In the winter, when it’s particularly cold (around 5 degrees Celsius) at home, I need to leave the lab a bit early, before the roads ice over. As often happens, the temperature in Dublin is usually around 6 degrees higher than at home, so the roads could be completely frozen over by the time I get there.

usbwirelessweatherstationTo get a heads up on the Moyvore temperature before leaving the office, I set up a basic weather station attached to the fence in my garden. It tracks the outside temperature, rain level, wind speed, and humidity among a few other data points. The station has a USB output port that I originally connected to my laptop which reads a log of the data from the station and stores in an internal memory. I keep the LCD display in my living room that shows all the current data coming from the station.

But I wanted something more automatic to tell me the weather conditions – and not have to check a separate laptop every afternoon. So, when Raspberry Pi 3 launched, I decide to take the plunge and connect my weather station to the cloud.

Sunny outlook with Watson IoT on Bluemix & Twitter

To give my weather station some intelligence, I investigated how to use the IBM Watson IoT Platform on Bluemix to store my station data in the cloud, and tweet regular weather reports. Even though I had never used the platform before, I had the system up and running in a week!

Today, my weather station tweets a summarised report from @moyvore_weather

I spend my day building systems to see how thMoyvoreTwitterLatestAccountDetailsings work. For example, my team built a cognitive system called DALI (Data Access Linking and Integration) that semi-automatically accesses, catalogues, links, and lifts information from multiple sources (including enterprise and open tabular data) into a meaningful knowledge graph. We use it to quickly ingest and understand data from cities, governments and enterprises. We can then use all this data as a single data source to get a holistic view of the data and to build cognitive applications on top op if.

And now that I’m tinkering with Watson IoT and Bluemix for my weather station, I’m looking for ways to integrate it into DALI, and remove the “semi” from semi-automatic, eliminating manual steps that may be needed in order to understand IoT data.

How to build an IoT weather station

To build my IoT weather station, I first hooked up my weather station to a Raspberry Pi, which reads the data in real time using a Python script. Then the Raspberry Pi pushes the data to the Bluemix IoT Platform. After a bit of web searching, I found an excellent pywws “get started” script that was written specifically to pull data from this type of weather station, via USB, using Python. Pywws could also tweet the current weather, but I wanted more control of the data, and to also have access to a database of all the data for some future work I’m planning to do. So, for my station, I decided to use pywws to pull the data as it was logged (called Live logging) and then push it, via the MQTT service in pwyys, to the Bluemix IoT platform.

Specifically, I used:

  • Bluemix IoT Platform to receive the data and make it available on Bluemix
  • Bluemix SQL Database to store the data and create a summary table of the data
  • Bluemix Node-RED to process the data and tweet it
  • Bluemix Tomcat Container running a quick web app I wrote, to show historical graphs of the data

Weather Architecture

Node-RED was the key to processing the data and tweeting it, and also sending it to Weather Underground (I use the Node-RED available in Bluemix). Soon, I had a flow designed to log the weather data and tweet it hourly.

Node-RED

Connecting to the Weather Underground

Pushing my data to the Weather Underground (WU), part of the Weather Company acquired by IBM, allows me to see my weather station data through WU. And I also contribute to the WU station network. In a way, WU is crowdsourcing weather forecasts from a network of weather stations like mine to improve weather forecasting, globally.

I currently archive my station data in my Bluemix Cloud DB for future analysis. But as mentioned above, I also share it with Weather Underground.

Set up your own cloud-connected weather station

WU Mobile App

WU also has a great mobile app that allows me to see the data, and the forecast for my area.

If you are interested in building your own IoT station, you’ll need a weather station, Rasberry Pi, and an IBM Bluemix account for access to the IBM Bluemix Internet of Things Platform. I have a free account and it’s more than enough processing power and storage to run my weather application and storage. The platform is a fully managed, cloud-hosted service which provides capabilities including device registration, connectivity, control, rapid visualization and storage of data derived from the IoT. As it explains on the Bluemix website, the IBM Internet of Things service lets your apps communicate with and consume data collected by your connected devices, sensors, and gateways.

IBM’s recipes make it easy to connect devices to our Internet of Things cloud. Your apps can then use our real-time and REST APIs to communicate with your devices and consume the data you’ve set them up to collect.

I now understand weather patterns much better than I did before this project. It’s been useful for my commute, as I now have good sense of “my” weather, based on the temperature and air pressure trends from the app. I also use it to schedule my robomow to cut the grass. Who knows, maybe my next project will be to connect the robomow to the IoT Platform!

Comments

  1. Christian Brandlehner says:

    I would like to learn how you set schedule on your robomow? I own a RC306 and the App talks to the robomow using BLE smart. I was not able to find a way to communicate without using the app.

  2. Tom Shaw IBM Research says:

    I have the Rasberry pie reading my weather station part and was starting to look at how to get the data out on the internet. This looks like a great way to get this done without to much overhead. As I am not a professional programmer more of a maker/hacker any example code would be most welcome.

  3. Edwin Nienhuis says:

    loved reading your article Martin. Will sign up for a free account on Bluemix myself today to get started

  4. Deirdre Kennedy says:

    That is pretty cool Martin, seriously though, a robomow?! What about all the exercise you are missing from not doing the grass yourself!

  5. Cormac McKenna says:

    With this you won’t need a weatherman to know which way the wind blows …

Add Comment

Your email address will not be published. Required fields are marked *

Martin Stephenson, olutions Architect and Software Engineer, IBM Research – Ireland

Martin Stephenson

Solutions Architect and Software Engineer, IBM Research – Ireland