Tweeting the weather with a WS2350, Open2300 and Raspberry Pi

13 06 2012

Well the last day or two have brought another USB/Serial adapter and some success, the weather station (Ws2350) is now communicating with the Raspberry Pi via USB. So what was the problem and what was the solution?

The weather station is well know for being a picky little device (read non standard) about its serial comunications, you’ll find many horror stories from people who have had to link it via a USB adapter. It’s worth noting that even though I now have communications there may be further problems to come, so the side project of adding a serial port to the GPIO of the Raspberry Pi is only on hold.

Anyway the problem was having a USB/Serial adapter that both the Raspberry Pi and the weather station were happy with. Other people with similar issues have thought it may be power related as the Raspberry Pi doesn’t have a lot of power to pass to the USB, but these adapters draw less than 25mA and I tried via a powered USB hub too, it wasn’t a power issue.

Original (supplied with the weather station) FTDI adapter (FT232BM), worked with the weather station and using Ubuntu on a PC, hung the Raspberry Pi when accessed but was recognised by the Raspberry Pi when plugged in.

PL2323 Adapater, bought to try a different chipset. Raspberry Pi was quite happy with it, even hooked up a PSION Series 5 as a terminal (see this) but the weather station via Raspberry Pi or via Ubuntu on a PC did not want to play. This failure was almost certainly down to the WS2350 being picky about its adapters or possibly a non standard pin out on the adapter.

FTDI Adapter (FT232RL) I had a post about the problem at and someone confirmed that they had an FTDI device working with Raspberry Pi, a device using a newer chipset. I did some research at the chip manufacturer and decided to track down an adapter using the newer FT232RL chip, thinking that as the weather station was happy with the old FTDI adapter maybe it would be with the new one too. I found one at and ordered it on Sunday evening, it arrived Tuesday am. It worked.

Now that communications were in full swing I started to hack a little bit of python code to read the Open2300 log file and tweet it, my current Cumulus software tweets the weather every hour or so and its pretty easy to tweet from code.


The code

#tweet2300 Steve Wardell 2012
from subprocess import call
import twitter
#auth twitter
auth = twitter.OAuth("your", "twitter", "oauth", "keys")
t = twitter.Twitter(auth=auth)
#run log2300
call(["rm", "log2300.txt"])
call(["log2300", "log2300.txt"])
#open and read the tweet.txt file produced by log2300
file = open("log2300.txt","r")
log2300 =
#chop up the string to get only the basics we are interested in
words = log2300.split()
tweet = "Forecast " + words[17] + " : Wind " + words[8] + "mph " + words[10] + " : Baro " + words[15] + "hpa " + words[16] + " : Temp " + words[4] + "c" + " : Rain " + words[13] + "mm " + " : Humidity " + words[7] + "%"
#tweet the content of tweet.txt
#the end

Its not very elegant but as a quick hack it did the job.

Open2300 is a suite of programs to read data from the Ws2350 by Kenneth Lavrsen (his web site). For this quick hack we first get authorised with twitter then the Log2300 program writes (appends in fact) to a file a short data stream from the Ws2350. As I just want a file with a single data set the code above first deletes any existing log then writes a new one. The log is then read into a python variable and split into an array, the array is then mashed up into a suitable order with some additional text to form a tweet.

All very basic stuff and quite a bodge but we get a tweet

This simple script could be added to a CRON job to run every hour and keep on tweeting. Now that I’m happy with basic communications and have a little bit of code and a tweet to show for my efforts I can focus on developing some python routines to make use of Open2300’s fetch2300 program to write feeds for my web site and the live gauges.

More posts as progress is made

The Weather with Raspberry Pi – unsettled but brightening up later

9 06 2012

Well, my Raspberry Pi weather station project has been stumbling along. So, first, a little update on where I am at with it.

pywws doesn’t work with my weather station, ws2350, not unexpected and a quick chat with its author confirmed it. There are a few other weather enthusiasts out thee who are trying to get it working on the RPi so check on the forums. I will be keeping an eye on progress as getting basic comms working is a common problem, as you will see….

Open2300 has been most successful at this point, its a simple set of programs that will obtain and decode the weather station data and help you use it, there is even a program that will update Weather Underground for you. Compilation on RPi did kick out some warnigns, but I had similar warnings when I compiled it on Ubuntu. The bad news, I am still not able to confirm this works on RPI, because…

Serial/USB converters – as you would expect, take two well defined standards, the latter of which was ushered in as the replacement for the former and connect them together, yeah, it was never going to just work was it! Lets be clear this is NOT a RPi issue, it’s bigger than that.

So my weather station, an entry level consumer product, about a hundred quid, has a serial link. It also comes with a serial to USB adapter as very few modern computers come with an old RS232 serial port. The USB adapter is well known as a source of endless data trouble with even the most reliable connections producing corrupt data from time to time.

Plugging this adapter, which identifies itself as FTDI, seems fine, its recognised but trying to run Open2300 with it hangs the RPi. hard to know which bit is at fault or if all of it is contributing. Running the same adapter and Open2300 under Ubuntu (on a PC not RPi) works fine though, the weather station data is retrieved and decoded.. Using a powered USB hub makes no difference in this case, the adapter is drawing around 25ma at most so power shouldn’t be the issue anyway.

To see if it was the weather station on the end of the wire causing the problem I dusted off a Psion Series 5 and serial cable, plugged it in to the RPi via said adapter and tried the terminal program, nothing, dead, hung RPi.

A second adapter arrived this morning, this time using the Prolifc PL2303 chipset (or rip off of), first off, as it was still sat on the desk, I plugged in the Psion Series 5 and, LIFE! The terminal app on the Psion communicated with the RPi.

Encouraged by some communications success I plugged in the weather station and tried Open2300, nothing for a few minutes then a time out of sorts. Moving the test to an Ubuntu PC produced the same disappointing result, it seems that although RPi is happy with the PL2303 the weather station is not.

So two different types (chipset) of Serial/USB converters and different failures. At this point I started to look for any other adapter types but on such cheap items expecting a datasheet is a little too much.

Clearly the combination of things is a key and finding an adapter that both the RPi and the WS2350 are happy with is critical, it could also be like looking for a very specific bit of hay in a haystack (I always thought that looking for a needle in a haystack sounded quite do abel to me, big magnet, little needle, problem solved)

It was time to start exploring alternative options and RPi is not without some, namely the GPIO header.

Next step, obtain or build an RS232 interface for the GPIO header, the good news is others are way ahead of me and it looks like it should be fairly straight forward, though I cant find anything pre-made for the RPi, yet.

After some hours trying to find out more about the issue via the RPi forums, lots of folks with similar issues, and more generally looking for Debian, Arm, FTDI and so on it would seem that the FTDI drivers are not ARM compatible, so if this is correct the FTDI based adapters are not going to work. I think them being identified by RPi when plugged in and checked means nothing at this point as that’s not using the driver it’s just listing the USB data, but I don’t know.

Ubuntu 11.04 Gnome and Unity

1 11 2010

I’ve been wondering about the news today that Ubuntu 11.04, the next big release, scheduled for April 2011, is to ship with the new Unity user interface as the default, replacing Gnome. Gnome will still ship and users can switch to it but what strikes me is this is either exactly what the Linux desktop needs or exactly what it does not need.

For years the Linux desktop has been dogged with the simple fact thats its UI and hence UX is, charitably, not as slick as OSx or Windows, but more accurately its a pig. Given enough time and knowledge it can be much better than either of them, the problem is the popular desktop environment is not populated with Linux hackers, so those brave enough to try it see its looks crap and go back to something they know.

I’ve generally thought that between KDE and Gnome, plus a handful of also rans and slightly more specialized offerings the Linux desktop is a complete failure. Sure choice is king and being able to do what you want id fantastic, but not at the expense of being able to use the thing to get a job done. Gnome is usable, just. KDE recently isn’t even that. Both are amazing when you spend time getting them just right. But who has that sort of time? and in an environment of any size who wants that sort of maintenance headache?

Then comes the apps, tools, widgets, thingies and whatsits. The essential collection of things you actually need to use to get something done. Try finding a comprehensive set of anything that adopts any thing approaching common ground to either the desktop manager or anything else, its not a pretty picture most of the time, literally. This all severely hurts, it hurts the Linux desktop and it hurts adoption because it hurts productivity, it doesn’t help that it looks like something thrown together in a kiddies art class either.

Ubuntu has popularized the Linux desktop, growing its reach hugely and despite my misgivings about its somewhat slapdash approach to releases it proves to be ‘The Linux Desktop’.

So, one might think that Ubuntu could lead the charge and sort out the desktop UI/UX in fact I was beginning to think it might happen until the slippage of Gnome Shell and the emergence of Ubuntu Unity in its netbook remix. Unity is another desktop manger, its not Gnome, its not KDE, its Unity. Quite frankly it sucks, Ive been putting up with it on my netbook for a while and as its a device I use when I have to rather than when I want to its not such a big deal, probably more so as the application I use on it is a terminal 99% of the time.

So I was quite surprised to read that 11.04 will use Unity and not Gnome. I would have been comforted to read that Ubuntu was going to be working very close with Gnome to sort out the desktop, but that seems to not be the case. There have been a few blogs today about what this means for Gnome, well quite simply it doesn’t mean anything much. Ubuntu has barely contributed anything to Gnome, Gnome will live on and prosper based on it being largely contributed to by Red Hat et al. For sure not being the default in Ubuntu is going to hurt, but Gnome is’nt going to suffer much. Ubuntu might though…

I don’t know how many desktops use Ubuntu right now, but how many of them are going to be using it after the upgrade to 11.04 and the switch to Unity? Lets consider Unity is new, right now its not pretty, its slow, buggy and in my opinion not ready for release. But they have got time, not much though.  I wonder how many people will stick with Ubuntu when the UI changes, its going to have to be something of an amazingly successful upgrade isn’t it? Any problems could have people reaching for any of the other popular Linux distro’s and the familiar Gnome desktop.

I think its an interesting move, for sure its vital they get the news out now and start to wade through the reaction to it. Right now I think Unity for me will be on my desktop for as long as it takes to switch to Gnome and if that isn’t less than 10 minutes the switch will be to to Fedora, Debian or any one of a dozen other perfectly viable desktop Linux distributions. Unity needs some very positive media in the next month and some well led promotion, making it work well might be a good first step too.

My final thought, for now, is why didn’t Ubuntu try to adopt the Google ChromeOS type of browser based desktop, isn’t Unity actually about anything but?

Ubuntu 10.04 Desktop and Netbook

1 05 2010

With the arrival of the Ubuntu 10.04 Release Candidate I took the plunge and did fresh installations on both my Desktop and Netbook. I’ve previously tried the Alpha and Beta and was generally impressed with the evolution of Ubuntu. My netbook is a ‘never leaves my side’ kind of thing and has to be 100% reliable and operational. My desktop is a compliment to my main desktop, which out of necessity, runs windows. The linux desktop provides my media, social networking, chat/IM, browsing/monitoring and secure access to numerous systems.

10.04 is an evolution but one in an evolutionary process that has visibly slowed down recently.That’s not to say there has not been a lot of work going on or that 10.04 is not impressive, there has and it is. When I say visibly I do mean visibly. Yes its a prettier place to live but, for example, its not got the next generation of Gnome. For that we will wait, hopefully for the next version of Ubuntu, however I do wonder how many who have opted for this latest LTS will not upgrade until the next LTS?

So, what was the install like? Well, it was pretty painless. The Operating System installed quickly, booted with no trouble (and booted fast but don’t believe the hype, its not that fast!). Sound, graphics, media cards all played nicely out of the box. It only took a short while to replace the now, quite frankly, hopeless FireFox with Opera, install the other usual suspects of my daily desktop life and be operational. I’ve always preferred a simple dock to desktop shortcuts or quick launch icons so I installed (as usual) Avant Window Navigator (0.4.0) and replaced the lower panel. I have to say AWN has improved, it feels a little more together than it used to and its not like it was bad before.

My only gripe with the new look and feel is that on a multi desktop system the close, min, max buttons are missing a menu drop down to send the window to another desktop. A right click on the title bar takes care of it but this is something that needs to be covered in the next release when, hopefully, we will see the reason why controls are on the left (ala Mac) and not the right (ala Windows), that space thats opened up on the right is going to have purpose soon we are told.

Media playback is sadly still not there out of the box, licensing and re-distribution can be blamed for this I think. Happily its not difficult to quickly have your MP3’s and DVD’s spinning away. I had one issue with Handbrake, but this was resolved by using the latest snapshot and should be resolved now that 10.04 is on general release. GIMP had to be pulled out of the repo’s as its not part of the standard install, no big deal really but silly in my opinion

BBC iPlayer, Tweetdeck, Filezilla, Dropbox and Skype all worked fine. I installed Sunbird, a screenlet I use to provide weather updates from Weather Underground and my own weather station and that was more or less that, desktop done.

Ubuntu 10.04 Desktop

Ubuntu 10.04 Desktop

The story was barely any different installing the Netbook Remix onto my EeePC901, though the desktop is, of course, the UNR standard.

Ubuntu 10.04 Netbook

Ubuntu 10.04 Netbook

One of the new features in 10.04 is better integration between the desktop and the various social networking offerings, twitter and facebook really. This takes the form of two tools, yes two, why use one when you can make everyone do everything twice? Emapthy (which replaced Pidgin as the standard IM client back in 9) handles chat and Gwibber takes care of social broadcasting to twitter and facebook.

I have to say its good to have the ability to have a single chat client, Empathy, to work with Yahoo, MSN and Facebook but it does not handle Skype – I’m not blaming anyone but this is really a huge shortcoming now for me. Skype remains outside but has become almost ubiquitous for voice and IM communication. Not having integration into a single messaging client is something that needs to be addressed. Always preferring the open route I would prefer to see Empathy (or other) include at the very least Skype IM if not voice, however, I wonder why Skype has not built the IM ability for the other popular clients?

The ‘broadcast’ client, gwibber (come on guys, time to pay someone to come up with better names) is pretty weak and not without its problems. but it works in a pretty neatly integrated fashion and lets be fair and say that with some TLC it will do the job, but it needs some love pretty soon. No one who uses facebook or twitter much already will bother with it, they will install tweetdeck or whatever. But it might help tempt newer users into the social media and networking club. Its  quick to get something out in a hurry but links, pictures, etc, forget it!

Its pretty ironic to think, again as with all things in computing tech, that we have advanced so far only to be no further forward in real terms. In much the same way that cloud was my old mainframe, the latest fancy Excel spreadsheet fails to better my old Lotus 1-2-3, now the new gwibber and empathy and skype still need as many clients as MSN, Yahoo and AIM did before. Anyway, enough of that….

There is a lot more, people are raving about the Ubuntu One Music store, sorry but I cant think of anything less exciting. I dont use iTunes and I cant see me using this. I would like to see a native Spotify client though.

I mentioned above that I installed Dropbox, Ubuntu One has been around for a while but to be quite honest it still feels unreliable, slow and badly made. However the killer is its not got a Windows client (or anything else for that matter) so its useless for me and I suspect many many others. It does however, if you can use it, allow you to synch ANY folder not just a single specified one like Dropbox. Thats a very nice feature.

Performance wise I would say its too close to call. My desktop is nothing special, its getting on and doesn’t have a spec to die for. 9 was fine, 10 doesn’t feel faster in any tangible way but it does feel a little more together and it does boot that little bit faster too. On my netbook, again not the latest hardware, I would say its the same story. In short it all runs fine and I suspect on more modern tin its going to be a real delight. The bottom line here is that I can continue to take advantage of new features, better looking desktops, without having to shell out on new hardware. Thats a big plus with linux and Ubuntu.

There is no question 10.04 is a good operating system, if you already use Ubuntu its a no brainer upgrade. I usually find problems in a week of use and I’ve not had anything so far. Its been stable and reliable and everything works as it would.

Upgrade now, you wont regret it (however if you do don’t come crying to me!)