#RaspberryPi measures visibility in Central London / @Raspberry_Pi

shard

The Shard is located in London and, at 310 metres (95 storeys), is the tallest building in the European Union. The price of apartments and condos in the building reflect the views they give across the UK capital and are rumoured to crest at $80 million for a two-floor penthouse.

A tourist trip to the top of the Shard costs £24.95.

In order to tell whether the price of the trip is worth it, and to quantify whether the owner of such a penthouse is getting their money’s worth, Willem at The Secret Batcave has created a project to measure how cloudy the view is.

The project is called the Shard Rain Cam. It combines a Logitech 9000 webcam with a Raspberry Pi and a USB thumb drive (for storage) and uses Motion, Python and OpenCV to take pictures and then do analysis to determine how cloudy the day is. The Rain Cam captures a time-lapse set of images which are then analysed by OpenCV which works out the cloudiness.

Anyone can see the results by going to the hyper-catchy website www.whatcaniseefromtheshard.com. This website gives a qualitative statement of whether the tourist fee of £25 is worth it. Right now, it says “Quite far, but not 25 quid far” which I had to chuckle at.

A look at #RaspberryPi to #Arduino communication libraries / @Raspberry_Pi

Code and Life – PiSerial Arduino Communication Library

I’ve been using pyFirmata to power my PiPodCorder project that uses a RaspberryPi and an Arduino to read a load of sensors and display them to an LCD screen. However, I’ve been noticing that there are a few alternatives. I’m going to try and do a little on-paper evaluation of the three I’ve found so far.

Warning: This might be a little rambling.

First of all, there is pyFirmata which relies on the StandardFirmata sketch (or other sketch) being uploaded to the Arduino. pyFirmata is easy enough to use as it’s a Python library on the Pi. It also has the advantage of being a standard sketch issued with the Arduino IDE. The one issue I find with the Firmata sketch on the Arduino is that it does some weird-arse conversions between digital and analog readings. Take a sensor reading. As I understand it, normally on the Arduino a reading is taken from 0-1023. However, Firmata then converts this to a figure from 0-1. Which means that you then have to re-convert it on the Pi if you want the original reading. Obviously, 0-1 gives you a handy percentage reading, but I’d much rather do that conversion myself on the Pi.

Secondly, there’s nanpy. I covered it previously but have not yet used it. There is a firmware side and a client-side for the Pi, but it is not fully developed yet and it’s slightly unclear as to what it offers apart from the basics. Of course, the “basics” are what I will be using, so I’m going to give it a go!

And now, there’s PiSerial. PiSerial is interesting because it’s not a fully-fledged library. There’s no client-side at the moment (although the author is working on a Python implementation) and it’s basically a parser that sits on the Arduino waiting for commands over the serial line. Now, I’m not sure how efficient this is. The author of PiSerial says that Firmata communicates using binary, whereas PiSerial is (as the name infers) strictly text-based over the Serial line. I’m not so sure this is a big problem in terms of performance. The pyFirmata library must communicate over serial, as there is no other way of communicating between the Pi and the Arduino, it’s just the format of the commands that differs, I would have thought. In fact, thinking about it, if Firmata does use binary, there must be a fair amount of packing and unpacking of the commands on both sides… which surely must introduce overhead. Anyway, I haven’t got the tools and ability to test out that overhead yet, so I’m hoping Code and Life will do this in time.
The most important difference between Firmata and PiSerial, however, is that you control the code on the Arduino. That’s right: the PiSerial is merely a framework on which you hang your own command parser. I don’t want to replicate all the text from Code and Life here, so I suggest you read it yourself to find out how the communication is achieved.

In summary, Firmata is quite a beast for what I want it to do for the PiPodCorder project. Essentially, all I want it to do is to do sensor readings and I’m not sure that it’s the best solution for that, what with the 0-1023 conversion it does. So, I think I will try to convert my PiPodCorder Python code to use nanpy and then, when the client-side is written on PiSerial, try that as well. Hopefully that will give me an insight into which one is ‘best’ for my needs and which one is more educational/interesting to use.

Guide to #RaspberryPi revisions / @Raspberry_Pi

Thanks to Dom over at the Raspberry Pi Foundation discussion forums, we now have a comprehensive list of all the different versions and revisions of the Pi.

You can find out your revision number by going to the command prompt on your Pi and running the following command:

cat /proc/sysinfo

The following is a list of revisions, what model and version they refer to and which manufacturer made the board.

  • 0002 – Model B Revision 1.0 – Manufactured by Egoman (probably)
  • 0003 – Model B Revision 1.0 + fuses mod and D14 removed – Manufactured by Egoman (probably)
  • 0004 – Model B Revision 2.0 256MB – Manufactured by Sony
  • 0005 – Model B Revision 2.0 256MB – Manufactured by Qisda
  • 0006 – Model B Revision 2.0 256MB – Manufactured by Egoman
  • 0007 – Model A Revision 2.0 256MB – Manufactured by Egoman
  • 0008 – Model A Revision 2.0 256MB – Manufactured by Sony
  • 0009 – Model A Revision 2.0 256MB – Manufactured by Qisda
  • 000d – Model B Revision 2.0 512MB – Manufactured by Egoman
  • 000e – Model B Revision 2.0 512MB – Manufactured by Sony
  • 000f – Model B Revision 2.0 512MB – Manufactured by Qisda

This discussion was started by Daniel Bull over on the Milton Keynes Raspberry Jam discussion forum and I then found a blog post by Frank Carver which describes physical and technical differences between the revisions. He also provides examples in multiple languages as to how to find the revision programmatically. Following some digging around, I decided to ask the Foundation and Dom provided this response.

Many thanks to Daniel Bull, Frank Carver and the Foundation’s Dom for providing all the “meat” to this.