A couple of weeks back I spent the entire weekend working with embedded systems. Having got to the attention my of my boss, I want to share some experiences I had at a recent event, at which I was volunteering. I learned about weather forecasting and spent a lot of time talking about programming a weather station …
The event that I attended was called “Make It Digital” and was run by the BBC. It is all part of the drive by the UK government to get a new generation of kids interested in programming. I, of course, wholly support this idea and, when I heard about the opportunity to participate in my capacity of a STEM Ambassador, I signed up straight away.
I was told that I would be required to help man some exhibition stands and do demonstrations. To find out more, we were asked to arrive at good time, ahead of the official opening, at the BBC facility in the center of the nearby city of Birmingham. I knew where their building was, so got there with no problem, signed in and was shown to the meeting room where we would have a briefing. On the way, I met a Dalek – the scary alien mechanoids that appear in the TV show Dr Who [which I have been watching since I was a small child and of which the BBC is rather proud]. They are not quite so scary in real life.
All the volunteers were briefed about what they were to do. I was assigned to the Meteorology tent. The event was taking place across a number of locations, all in the immediate area of the BBC building and addressed various applications of software in domains in which the BBC is active. Many people turn to BBC TV and radio for weather forecasts, so covering meteorology made sense. I made my way to the tent, where I was introduced to the exhibits.
The primary exhibit in the tent was a simple weather station. These are designed for use in schools where the students can log the data and it can be uploaded to the British Meteorological Office to aid weather forecasting. The device is based on a Raspberry Pi computer and gathers information about wind speed, rainfall, temperature and barometric pressure. We had a Mac with a big screen showing the historical information in graphical form. To explain how the weather station worked in more detail, there were two further exhibits dedicated to wind speed and rainfall.
The wind speed computer was a Raspberry Pi running a simple Python program. The code was available to explain how it worked. The sensor rotated in the wind and sent two pulses on each complete rotation. All the software needed to do was count pulses over time, then use the knowledge of the diameter of the sensor to calculate wind speed. To encourage the children to interact, it was set up so that they could blow on the sensor and a league table was maintained of who could make most wind.
The other exhibit addressed rainfall in a similar way. Common ways to measure rainfall involve collection over a period of time, then measuring the quantity of water and disposing of the sample. A different approach is needed for computer monitoring. The is a small grey box with a funnelled opening on top.
This collects rain water, which flows into a small bucket, that has a capacity corresponding to 0.2794mm of rainfall.
When the bucket is full, it topples over, empties and lines up another bucket. A pulse is sent to the Raspberry Pi computer, which is also running a simple Python program to accumulate rainfall data. Again the system was set up so that children could simulate rainfall with a spray and a league table tracked who could make most rain.
I was pleased that these exhibits were very popular – children were interested in how they worked as well as having fun. Many of them had some familiarity with Raspberry Pi computers and I hope that they went away with ideas.
In the “real” world, if you were building a weather station, you would probably want to build in some greater precision. This might involve more sophisticated sensors and it would definitely need a different approach to the software. As nothing is happening too quickly, using Linux is not too unreasonable, but it is unlikely that Python would be the language of choice. A professional grade embedded implementation of the OS, like Mentor Embedded Linux would be more suitable. More likely, the small footprint and responsiveness of a real time OS, Like Nucleus, would make it good choice.