This project section is not about bell-ringing: it is about projects using the Raspberry Pi microcomputer.  So far I haven’t finished any projects using the Arduino microcontrollers.

This blog is unashamedly self-indulgent, but I hope that it might help or even inspire others who’ve bought such devices and want to do soemthing worthwhile with them. I’ve tagged it onto my handbell website because I don’t want the cost and hassle of operating too many different web-sites.

The origin of my project

So far I have described two projects, both linked to clocks.  I have always been interested in clocks and was pleased to be given the responsibility for the clock at Epsom church, as part of my duties of looking after the bells.   I became interested in the problem of how the ‘old ringers’ made sure their clock showed the right time (most often, they never showed the ‘right time’, but there again, it wasn’t quite clear what the ‘right time’ was.

I was going to make a clock that showed mean time, sundial time, celestial time, moon time, sunrise/sunset etc, using an Arduino which I bought on impulse at Maplin’s.

But I couldn’t help wondering how much use it would be. After chatting with my partner, we agreed that a ‘forecasting barometer’ would be much more useful for us.  The problem is that this needs to connect to the internet to download an rss feed, so the plain Arduino isn’t suitable – you need something with an internet connection.

An Arduino with WiFi

The obvious solution seemed to be an Arduino with wifi. This turned out to be a mistake. The Arduino, being a microcontroller, doesn’t have an operating system as such. It’s a bit like going back to the old assembler language, although in the Arduino it’s C/C++.  All the groping with the registers has to be done by the programmer, although clever people have provided libraries of code that do the intimate stuff.

But I found that it was badly documented.  Documentation takes an awful lot of time and effort, so it is often neglected. And I started to glean various warning signals, in particular it seemed that I might need to use many libraries to accomplish my objective.  Each library can take up a lot of memory even if you’re only using a bit of the code. I would need wifi, serial port, motor drivers and other libraries, before I could even get on with coding the functionality.  Advanced operating systems just load the functions you need, but the Arduino only has a simple IDE, as far as I can see.   In any case, dynamic linked libraries need external storage, which the Arduino doesn’t have – I imagine there are ways round this but again it looked as though a great deal of hand-crafting would be involved.

The Raspberry Pi

And then I realised that I had a Raspberry Pi on top of my wardrobe. I got it in 2012, but when I realised that I would have to learn Python in order to program it, I shoved it back into the box, unused.

Why are there so many programming languages? I don’t think there is any justification for this. I grew up with Fortran and I absolutely love it. Fortran 90 has all the functionality of modern languages, but its real strength is the simplicity of mathematical processing. I mean the heavy-duty stuff needed to solve complex engineering problems.  In fact, with any decent operating system, you can now do mixed-language programming, so you can mix Fortran and C++, for example, to get the most out of each.

And the Raspberry Pi does have a decent operating system – Raspbian – which is a version of Unix/Linux.  There are some complaints that Raspbian is not a real-time operating system, which means that time-critical tasks can be delayed when the OS is busy.  However, your app can intercept interrupts from the IO pins: these are queued by the OS, so should not be lost or received out of sequence.  Since my app will not need microsecond response times, this should be fine. [Real-time interrupt programming is a devilish business which only the most desperate will indulge in.]

So I have bitten the bullet and learned Python.  I like the fact that as an interpreted language, you execute functions from the command prompt.  And clever people have not only written libraries that interface with the hardware, but they have documented them as well.  Indeed, the quality of the documentation is streets ahead of the Arduino’s – in all innocence I asked a question in an Arduino  forum (and to be fair I got an answer) but also a bit of a slap on the wrist because I’d written to whereas my device was from

Yes, there are currently two rival Arduino companies, both claiming legal rights!  Desperately unfortunate.

After the success of the Barometer project, I felt I could make a simple project to display moon rise and set times, and its phase, now described here in detail.  It turned out to be nothing like as simple as I’d imagined, but the end result was well worth the effort in my view.  In the process, I have learned more about the Pi, and much more about the moon!