Sunday, November 12, 2017

The life and death of the @llweather weather station

It seems that my personal weather station is going to be off line for several months (or maybe forever), so I thought I ought to write a short blog post to explain the history of the station and why I have to take it off line. It is a good example of how much work can be involved in keeping a service running despite the fact that the service is supposed to be completely automatic.

Here is the history:
  • My story started during the cold winter of  2010 in Ireland. The weather was so severe that this cold snap has it's own wikipedia page. As a result, I became very interested in weather and I dropped a strong hint that I wanted a weather station kit from Maplin as my Christmas present.
  • This kit included some software to upload my weather data to the internet. This seemed like a cool idea to me, but the software only worked on Windows and I didn't like the idea of leaving a windows PC running 24/7.
  • I used Google to look if there was other software I could use and found several open source options. Eventually I picked a python library pywws and I staredt publishing to my personal weather underground site in March 2011 with a Tonido Plug  (an Ubuntu Linux based plug computer) doing the hard work.
  • In April/May 2015 my plug computer died a natural death due to overheating. Instead of buying a new plug I replaced it with a Raspberry Pi because that had been released in the meantime and it was the new cool thing to use for hobby projects (it was also smaller and cheaper than a new Tonido plug).
  • As part of setting up the Raspberry Pi, I downloaded a new version of pywws. I noticed that  it now had support for uploading to a number of new services including Twitter and so I established the @llweather account to store my tweets. 
  • I though other geeks might be interested in what I did an so I spoke at 3Dcamp Limerick in May 2015  At this talk, an audience member warned me  that I was lucky to have a station still working because the normal lifespan is 2-3 years. This prediction was proven true when shortly afterwards the indoor weather hub smashed to pieces in an accident Apparently it is normally the outdoor equipment that dies due to the severity of the weather it is monitoring, but due to my own clumsiness my home office was a more severe environment than any Irish storm. It wasn't possible to buy a new hub unit so I bought a completely new kit. Luckily my old software configuration worked fine with the new hardware and service was quickly restored.
  • The software was completely automatic, but I found that sometimes my site stopped sending updates and although it was normally easy to fix the problem, it took me some time to notice that there was an issue. Therefore I implemented a monitoring service based upon tweets or lack of same. Since my employer IBM had recently launched the Bluemix service I implemented this in NodeRed running on Bluemix.
  • The monitoring software would send me a Twitter DM whenever it noticed that the weather station had stopped sending tweets or if it started sending blank tweets. There were several possible causes but I noticed that they were normally solved by tightening the USB cable and/or rebooting the Raspberry Pi. After a while I stopped investigating the cause and just tried simple solution. I only investigated the issue when this failed to solve the issue.
  • In early 2017, the station started warning much more often often. Since these problems often solved themselves, I loosened the rules about when to issue a warning (e.g. 40 minutes without a tweet instead of 25 and ignore the first 2 blank tweets). However. the problem got even worse and I couldn't ignore it anymore. I suspected that the raspberry pi was at fault because it was getting old, but a new replacement was not significantly better. I eventually thought to replace the power supply and problem went away for 1 month.
  • When I investigated. I noticed that the indoor hub was getting either no data or crazy data e.g. 51 degrees centigrade in Ireland. If this was Dubai it could mean hot weather, but in Dublin could only mean equipment malfunction. A quick Google said it was most likely a problem with dampness in transmitter unit. When I disassembled the unit there was indeed signs of water damage. Unfortunately, the recommended solution of leaving it in the hot press for a few days didn't solve the problem so I decided to buy a replacement transmitter.
  • The only supplier of spares is Maplin (or amazon/ebay) but all said that they were sold out. I then went to local Maplin store and they said none anywhere in Ireland. 5 available in English Maplin stores but they couldn't tell which store and it might be a computer error. Their web store won't have any in stock until Feb 2018 and I couldn't place an order now even if I was willing to wait
  • The Maplin guy said that it might be possible to buy a spare from another supplier, but he couldn't tell me which brands were compatible with Maplin N96GY. I found some websites selling sparese for the Nevada WH1080PC weather statio which is allegedly co,patible, but when I found one online their picture looked slightl different to mine so I was reluctant to buy

I eventually decided to retire the station for now and reconsider in Feb if I buy a spare when they become available. Overall I must admit I was surprised at how much work was involved in keeping a relatively simple service online.

Tuesday, September 12, 2017

MQTT presentation for IOT meetup

Tomorrow evening I will be giving a presentation about MQTT at the IOT Dublin meetup. Click here if for further details if you want to attend (several other interesting speakers also).

Monday, September 4, 2017

You are entering the Damastown sector

The area where I m now working has recently been christened "The Dublin Enterprise Zone", which sounds quite impressive. Since there is quite a large area given this designation, they have given various areas within it a different sector name and IBM is in the "Damastown Sector".

When I see these signs I can't help getting worried because I think of the time when I was quite young and we visited West Berlin. My father pointed at the sign saying "you are leaving the American sector" and he warned me never to wander past that sign or I might never be allowed back. I guess it was "thar be communists" rather than "thar be bears". I still get a chill upon seeing those old signs.

Thankfully there are no restrictions on who can enter or leave the Damastown sector.

Thursday, August 31, 2017

Moving to the Watson Lab Services team

I have recently changed jobs. I still work for IBM, but now I am part of the lab services team for the Watson family of products.

The Watson offerings are essentially a productised version of all of the Artificial Intelligence (AI) abilities which were developed as part of the initiative to teach a computer to play the Jeopardy game show. This game show is not popular on this side of the Atlantic, but fans of the program assure me that it is an amazing achievement and so I am very excited to be working with such leading edge technology.

As you would expect, customers sometimes have trouble understanding how to best use these advanced technologies. My team's mission is to help customers get over any initial hurdles and get maximum benefit from these amazing new services.

As part of this role, I will be posting a few articles on this newly established Blog with technical tips and tricks. I hope they prove useful!

Monday, July 10, 2017

What do these road signs mean?

Over recent years I have started to notice road signs like these around Dublin. I have been fascinated to find out what the signs are pointing to, but it is hard to guess their meaning since the signs only contain an abstract shape in either black on a yellow background or visa-versa.
Sometimes the signs will appear on their own (like the first example), or else they will be a small addition to an existing sign with many directions as you can see in the example below.

Occasionally I have tried to follow the signs to see where they lead to, but always I have given up after several left/right turns that don't seem to be leading to any particular direction.

Can anyone take me out of my misery and tell me what the signs mean?

Are they a Dublin phenomenon or do they appear in other parts of Ireland? Can the y be found in other countries?

Thursday, June 29, 2017

Adapting to a new MAC

Recently I got an email at work saying that my laptop was due for replacement. The email asked me to choose whether to get a Lenovo laptop or an Apple MAC,. I am not really a fan of Apple products due to their habit of ignoring standard interface conventions. Nevertheless I was persuaded by some co-workers that clicking the apple button was the right choice. The new laptop was delivered very promptly after I clicked on the button and suddenly I had a shiny new MacBook Pro sitting on my desk and I had no choice but to become friends with it.
  • On the positive side
    • The hardware is impressive  The laptop is slim and light and the screen is crystal clear with a very high resolution. It can even be read outdoors on a sunny day.
    • It comes with a solid state disk drive which means that it is lightning fast.
    • The CIO office in IBM has set up a process which  makes it trivially easy to setup all of the essential applications most people need in IBM in one go. This meant I was productive very quickly.
  • On the negative side:
    • As many of you know, MAC uses the command key for most  situations where most normal computers expect  you to press the control key. This is quite annoying at first, but I am surprised how quickly I managed to learn the new key sequences. This inventing of their own UI conventions is not ideal, especially for people like me who have to regularly use a variety of different operating systems. However, I think I will learn to live with it.
    • What is really annoying is that Apple is into minimal design and hence they decided to remove any keyboard keys that they think are rarely used. One of these is the break key. Many users rarely if ever use this key, but in Lotus Notes there is a convention that you can use ctrl-break to abort any operation which is taking too long. Unfortunately this is a key combination that I find myself wanting to use frequently. A Google search threw up a few suggestions for MAC compatible alternatives, but none of them seem to work.
    • Another missing key is the escape key, but this is compensated by the Touch Bar.  This is a cool strip which contains virtual keys that change depending upon what app is running. For example, whenever an application is running that can accept the escape key, a small esc appears in the touch bar. Likewise whenever Spotify is playing the touch bar has virtual keys for play, skip etc.  (even if it is running in the background).  This is a nifty idea, but most applications don't take advantage of it yet (probably because it is only available on newer MACs). You can also customise the touch bar so it works the way you like.
    • I am a big fan of Bluetooth and I (wrongly) assumed that a modern laptop like a MacBook Pro would have excellent Bluetooth support. To be honest I find the poor Bluetooth performance to be the most frustrating thing about the new laptop. Initially, I connected a Bluetooth mouse and it worked except that I need to turn the mouse on and off every few hours to make my laptop realise that it was still there. Then I connected a Bluetooth keyboard and things got even worse, the laptop looses connection to either the mouse or the keyboard about once per hour (it can be even more often). Finally I added a Bluetooth headset and this seemed to overload the laptop's Bluetooth sub-system completely. The different devices seem to conflict with each other. For example, if I turn off the Bluetooth keyboard (which I often have to do),  the sound on my headset is likely to go up or down. Overall it makes me want to go back to wired devices (if the laptop had proper sockets to plug them into).
Overall I have to say I am still undecided about my decision to go down the Apple route. I am not (yet) looking to take my old Lenovo Linux laptop out of retirement, but I am a still a long way from being converted into an Apple fanboy.

Saturday, June 3, 2017

My neighbour becomes youngest ever Irish leader

There was great excitement yesterday when Leo Varadkar was announced as the new leader of the Fine Gael party. This means that he will almost certainly  be elected Taoiseach at the next meeting of the Dáil.

Much of the press coverage focused on his attributes which would in the past have been a barrier to high office in Ireland.

  • He is on;y 38 which will make him the youngest ever Taoiseach
  • He is openly gay
  • His father is an immigrant from India
Around where I live there is additional excitement since he is a local boy having grown up quite close to where I live and even still lives in the area.

Leo has many positive attributes:
  • He is clever and well educated (he is a medical doctor)
  • I don't think he will be an embarrassment to us in public (unlike other leaders I won't mention)
  • In all previous ministries, he seems ti have been a very competent administrator
  • He is a good communicator and is loved by the media due to his habit of giving a straight answer when asked a question (this sets him apart from most other politicians).
However, I can't be totally enthusiastic about his election. Fine Gael is definitely on the right in Irish politics, but Leo's politics are on the right wing of the party. Many people think that his recent campaign against social welfare cheats didn't set a very good tone. I also didn't like the slogan of his leadership campaign which was that he would represent "the people who get up early in the morning" - this doesn't show much sympathy with people unlucky enough to be unemployed.

I am not too worried however, because Fine Gael need support from other parties and independents and hence his right wing tendencies will be help in check.

Wednesday, May 31, 2017

Windows and Linux command recall compared

I prefer to use Linux, but sometimes I need to use Windows. What is frustrating is that sometimes the operating systems have essentially the same feature, but there are differences in implementation that can trip you up if you forget about them.

Often when you are working at the command line you will need to issue the same command  you used before.(or a similar command). With either Windows or Linux you can easily recall the last command by typing up arrow once or recall the command before that by typing up arrow twice. So far so good, but if you read at the finer details of command recall on Linux or Mac you can see there are quite a few differences to the way the feature is implemented on Windows.

Mostly the differences are different key combinations used which can be difficult to remember when you switch between both systems. However, there are a few things that are significant:
  1. The way recalling commands affects your place in history:

    Linux takes a simple view of command history, while Windows adjusts your perception of history depending upon whether you typed a command directly or recalled it from history. This is a tricky concept, so lets look at example. Suppose you had typed the following commands:

     > command a
     > command b
     > command c

    If you type up-arrow twice and then return, both Windows and Linux would execute 'command b' because this is the second last command, However, the two systems have a subtly different view of your command history after this. Linux takes the view that you typed command a/b/c/b and so if you type up-arrow twice you should get 'command c'. Windows agrees that 'command b' was the last command executed, but if you type up-arrow twice it gives you 'command a' because that was the command executed before 'command b'. If you want to recall 'command c' on Windows, you should type down-arrow.

    The Windows approach is probably superior because it makes it easier to recall a series of commands you executed some time ago, but it can be confusing and it is easy to trip up (especially when you switch between both systems).
  2. The way you search for previous commands:

    If you executed a command involving 'blog.txt' some time ago it might be tedious to have to keep typing up arrow to find it. Luckily both Windows and Linux provide a quick way to find the command in question.

    In Windows you would type the string 'blog.txt' and then hit the F8 key to see the last command containing that text. In Linux you first type CTRL-r and then start typing the text you want to match. As you are typing Linux will show you the command it would match for the text you have typed. The Linux way is clearly better because you can see how much text you need to type to match the command you want or you might decide to match on a different part of the command if you see lots of commands in your history containing the word 'blog.txt'.
  3. History persisting between sessions:

    In Linux your command history is stored in a file, which means that when you start a new session it automatically know your command history from a previous session. In contrast, Windows stores the command history in volatile memory so each new session starts with a clear slate, In general the Linux approach is much more useful, but there can be problems when you have two command windows open at the same time - the command history is effectively a combination of the commands typed in both windows which can be confusing.

Wednesday, March 15, 2017

Personalised weather warnings

One of the benefits of having a personal weather station in your back garden is that you should know about local bad weather events quite quickly after they happen. However, the reality is that I don't constantly check the weather data published by my station, so I decided to implement a personal alert system driven off the data.

The obvious protocol for such an alert system is MQTT. However, the MQTT interface module  of the pywws software that I am using to manage my weather station doesn't seem to want to upload any data. After spending time debugging Python (confirming my dislike of the language), I gave up and decided to pursue an alternative strategy based upon the Twitter updates from the station. I implemented a NodeRed  flow on the IBM BlueMix service which monitored the twitter feed and took various actions depending upon what it saw.

The warning rules I decided to implement were:
  • The station is supposed to tweet a weather status every 10 minutes. If 15 minutes or more have passed since the last tweet something has malfunctioned, so the weather station twitter account (@llweather) sends a direct message to my personal account (@bodonovan).
  • When it starts to rain (an all too frequent event in Ireland), the weather station sends me an @reply message to advise me to bring in any washing hanging on the line.
  • The dashboard in my car warns of possible icy roads when the temperature drops below 3 degrees centigrade. Therefore I decided to get my weather station to also send me an @reply message when this happens (luckily this alert gets triggered less frequently in Ireland, but if I moved to Alaska I would need to tweak the threshold).
  • I don't want to be annoyed by repeated tweets about the same weather event, so I put in some code that alerts of the same type won't be repeated more often than once every 6 hours. 
  • The application is configured not to send any warnings between midnight and 7am. I am interested in weather, but not interested enough to lose sleep over it.
It is quite unusual for the temperature in Ireland to drop below 3 degrees at this time of year. Rather than wait for several months to find out if the temperature warning was working I temporarily set the limit to 10 degrees and this is an example of what I got:
Unfortunately, I didn't have to wait too long to get a real rain warning e.g.:

At some stage in the future I will put some more effort into fixing the MQTT problems (partly as a way to learn Python better). But, for now the system seems to be working fine.

Monday, February 13, 2017

My Personal Weather Station comes back on line

Back in March 2011I set up a personal weather station reporting to Weather Underground. Thus continued to report until September 2014 when the hardware I was using died. I recently acquired  replacement hardware and I now have my site on Weather Underground up and working with data being updated every 10 minutes. I am now using a Raspberry Pi rather than a Tonido plug which I was using last time. But, this useful guide on how to get working on a Raspberry Pi helped make it very easy.

I am still using the pywws library, but I am glad to report that it has become even better since the last time.  Using the new functionality, the site is also twittering regularly and also send updates to the UK Met Office and OpenWeatherMap. The software also supports a number of more obscure web sites so it is really easy to widely share the data being collected.

When I first set up the weather station, there were around 4 or 5 stations reporting from Dublin. However, when I checked recently I see that the number of stations reporting from Dublin has grown to over 50 (possibly helped by the fact that Maplin are selling the hardware in kit form quite cheaply).

Previously I could claim to be the only wunderground weather station in Castleknock, but now there are 4 quite close to me. One is about 750 meters south west of me. Another is 1km east of me, while a fourth station is about 1km further east. When I have sufficient data collected I might do a little analysis about how close are the data point reported by the 4 stations in almost the same place.

Last time I mounted the sensors on the boundary wall. Unfortunately this meant that the wind sensors were blocked by overgrown vegetation in neighbouring gardens. This time I decided the put the hardware on the side of shed where I hope it is less likely to become entagngled.

Tuesday, January 10, 2017

How accurate are wind forecasts for Dublin?

In my last post I analysed temperature forecasts for Dublin and today I will turn my attention to wind.

At first glance, the wind readings seemed less consistent with each other than the temperature readings. In particular, the readings from OpenWeatherMap and WeatherUnderground (WU) were consistently lower than the others. However, when I investigated, I found:
  1. I had been interpreting the readings from OpenWeatherMap as kilometres per hour while in fact they were in meters per second. Once I corrected this error, their readings lined up well with other services.
  2. There was no similar simple explanation for the wind speed readings from WU not matching the other services. It was just a problem with their actual data from Dublin - the forecast data for Dublin and the actual readings from other cities lined up with other services. Since weather underground is built upon data from amateur weather stations, I suspect that the weather station they were using for wind speed readings from Dublin was badly positioned e.g. see  the picture of a weather station of mine which used to report to WU before it broke - initially the readings were reasonable, but then the neighbour's hedge grew taller and began to block wind from reaching the station. As a result, I chose to exclude the WU from the calculation of averages and to compare the WU forecasts with the actual reading from other stations rather than their own readings.
The raw data about wind forecasts is available here and a summary table is given below.

ProviderDecimal PlacesAve ErrFcst1 ErrFcst3 ErrFcst7 Err
Average excl WU4.755.596.567.70
Average incl WU6.595.366.137.29

A few observations about this table:

  • In general, the accuracy of the wind forecasts is worse than the accuracy of the temperature forecasts. Although you can't compare Celsius readings with km/h readings, if I transformed the data into % error the same conclusion would be reached. This is probably a reflection of the fact that the wind speed in Dublin varies more from day to day than the temperature.
  • On balance DarkSky is probably the overall winner for accuracy, but BlueMix and are both very close.
  • Surprisingly the wind forecasts from weather underground are almost as accurate as the best services, but their historical reports are so inaccurate that they could not be considered good.
  • In contrast, the wind forecasts from open weather map are noticeably worse than the other services (and weather online is not much better).

While I was writing this post, I found out about an organisation called Forecast Watch who did a much more detailed analysis of weather forecast accuracy. You can read their conclusions here but the quick summary is that most years the winner for the most accurate forecasts was The Weather Channel (which is now an IBM subsidiary and I refer to a BlueMix), but in a few cases the winner was the Weather Underground (also an IBM company) or MeteoGroup (which was not one of the services I analysed). They analysed forecasts for several cities and they found that the best performing service varies significantly from city to city.