Share your computing power with BOINC on the Raspberry Pi

The Berkeley Open Infrastructure for Network Computing (or BOINC) is a way for you to get involved on global research projects. You install a client and then the slack time of your particular machine is used in the networked task of crunching numbers. You may have heard of SETI@home which is a collaborative effort to analyse radio telescope data in the search for extra-terrestrial life.

Gus over at PiMyLifeUp has written a great, current tutorial on installing and configuring the BOINC client. You can read it here or view a video below:

It’s a great chance to get involved in science. So, if you’ve got a spare Pi, why not leave it plugged in and collaborating with the other 400,000 BOINC users?

Getting Started with Python and Raspberry Pi – book review

David Whale sent me a couple of books to look at recently. The first, Getting Started with Raspberry Pi Zero, I reviewed a few weeks ago. I now come onto the second one: Getting Started with Python and Raspberry Pi by Dan Nixon.

I feel I have to start by giving an indication of whom I believe the book is aimed at. It is in my opinion, surprisingly, not suitable for beginners. Even though it has the ‘Getting Started’ title, it is very much suited to people who are programmers already, rather than absolute beginners. The structure of the book, and some of the concepts covered, is more at an intermediate or advanced level – suitable for those comfortable with programming concepts, but unfamiliar with the way Python “does it”. With that in mind, I did start to wonder, halfway through, as to whether the ‘Getting Started’ moniker actually did the book a disservice.

The book starts off optimistically enough with a chapter on installing Raspbian and configuring it. Now, the book was published in September last year and Raspbian has since come on a long way, particularly in the area of wifi configuration, so there are a number of things in the chapter that don’t apply any more. This isn’t the fault of the author, of course: Raspbian is a bit of a moveable feast when it comes to interfaces and features. However, it does make me wonder: Are we now past the point where an installation and configuration chapter is advisable or even needed? This chapter also explains that we are going to be using Python 2.7 rather than Python 3. This was a bit disappointing as version 3 is clearly the way forward, but I can understand the argument that there are more libraries available for 2.7. I would think, though, that even if you are using Python 2.7, you would use, for example, the print(” “) syntax rather than the print ” ” syntax, just so that when you move to Python 3 it ‘just works’. Unfortunately, the old way of doing certain things, regardless of any upwards compatibility, is very much adhered to in this book.

The next chapter concerns control flows and data types. This is when I realised that the book must be aimed at existing programmers. Rather than teaching by example, which is the way most beginners books go nowadays, this book instead goes for a bottom-up approach. It does mean that absolute beginners will flounder at this early stage. Indeed, they may be asking “What the heck is a ‘control flow’?” Again, it’s not the content of the book that is in question – in fact, it’s very well-written and the content is terrific for existing programmers – it’s just that the title of the book doesn’t help very much to indicate who it is aimed at.

The next couple of chapters go into data structures, I/O, object-oriented programming and threading. These are very advanced topics, particular OO and threading, and I was surprised to find them in a Getting Started book. They are very welcome from my point of view – being able to do more than one thing at once is key to modern programming – but still… The book hasn’t really taught very much before getting to this point, and I wonder if a regular reader is ready for such advanced concepts.

The next chapter, likewise, seems very advanced for a Getting Started book – it’s all about packaging up your code. Very useful, but perhaps it should have been included at the end so that when you’ve created something substantial then you can learn how to package it.

Next up is a chapter on using the GPIO pins of the Raspberry Pi via the RPi.GPIO library. With the advent of GPIO Zero, this seems to be a little ‘old-hat’ but of course with a September 2015 publication date, the new library wasn’t really around to be used. What is in the chapter, however, is excellent as it deals with using LEDs, switches and also PWM. I do note that the author is still using ‘sudo’ to execute the Python commands. This won’t do you any harm, of course, but it is now not necessary.

The camera module is the subject of the next chapter and I’m pleased that the author chose to go along the picamera library route as it is an excellent library. He goes very quickly through basic use and then goes into using threading with the camera. This surprised me as I would have thought a Getting Started guide would go more into the functionality of the picamera library. As it is, the more advanced features of the library are glossed over or, in a lot of cases, skipped entirely. This may be because the author wished to get back into strict Python quickly, but it is a missed opportunity in my opinion.

The next chapter is extremely interesting and well thought-out. It deals with consuming APIs over the Internet in a variety of data formats such as XML, JSON and even how to parse HTML using BeautifulSoup. A great chapter, but, perhaps, a list of more APIs that can be accessed would have been welcome.

Creating command-line interfaces is to do with creating ‘executable’ programs using Python. Interesting, but again slightly beyond the remit of a Getting Started guide.

Debugging using PDB and log files is tackled next. Very useful for more advanced programming when you need a lot more tracing. I’m just not sure that the book has got the reader far enough along to merit introducing the topic.

Finally, there is a good chapter devoted to designing GUIs with Qt. This is very interesting and useful and covers using Qt Designer to design forms and screens as well as interacting with them at code level. The form designer reminds me of Visual Basic and even Microsoft Access! This chapter is of particular use to those who want to be able to program for the desktop environment.

Summing up

This book is very well-written. It teaches people who are already familiar with programming how to do things the Pythonic way, covering the details of Python code structure and taking a broader approach to other topics. However, despite this I feel that the title of the book is misleading. “Getting Started” clearly points toward the book being suitable for beginners. Beginners, however, would be lost by chapter 2. I think the best way I can say it is that the book is great if you are used to a from-the-ground-up approach. However, if you’re looking for a book with lots of worked examples that take you through programming in a logical, friendly way, then this one is probably not for you.

I commend the author and editors for trying to cover a lot of ground with the book. However, based on the title, it is not quite what I was expecting!

MotoZero – a motor controller board for the Raspberry Pi – review

On Wednesday, The Pi Hut launched two new products, which I covered here. The first of these, the MotoZero, is a new Zero-form-factor motor controller board that fits on top of any 40-pin Raspberry Pi. I’ve now had a chance to try it out and evaluate it’s potential, so here we go.

Aesthetics and hardware

First of all, it’s a very attractive board. The graphics on it give it a nice look and the white-on-black aesthetic is very pleasing to the eye. This is, obviously, not the be-all and end-all of a motor board, but it does show that Richard Saville (aka Average Man), the designer of the board, has clearly put a lot of thought and effort into it.

The board comes as a kit that you need to solder together yourself. This might put some people off, but honestly, there’s never been a better time to learn how to do it and this makes a good first timers’ project. It is simple enough to put together and the extensive assembly instructions included in the user guide are excellent, with photographs and detailed instructions of what order to do things in.

The L293D chips that come with the kit are an old technology, but very reliable. Each motor takes up three GPIO pins and there are terminal blocks supplied for up to four motors to be run from this single board. There aren’t very many boards out there that allow you to control 4 DC motors, and that makes the board very powerful.

One thing I did notice on the instructions is that there is no protection for the chips if you plug the battery power wires into the wrong holes. This shouldn’t happen, because the terminal block is labelled very well, but it is a consideration if the user of the board isn’t used to using batteries or isn’t very good at following instructions! This limitation is spelt out quite clearly in the user guide, but I would like to see (in a future board revision) some protection built in – accidents do happen after all.

Using the board

I soldered the board together (which took about 30-40 minutes, I wasn’t rushing) in the order recommended by the user guide, which I found to be very sensible and very detailed. I connected up four micro metal gear motors to the screw terminals and a four AA battery pack to the power terminal.

motozero-wiredup

I used some code that Ben Nuttall had written using GPIO Zero to test the motors out. They worked perfectly. The motors were a bit slow, but I think that’s just the limitation of the motors rather than the controller board. I need to get hold of some wheels to fit the smaller motor axles to continue my robot-building project, but that’s just a simple matter of finding a source online.

Conclusion

For £10, this is a great, cheap little motor controller board. The ability to control four motors independently will no doubt appeal to those people who want the extra power and functionality for their robots. It’s designed well, has good backup documentation and I commend Richard for his work, and Jamie at The Pi Hut for offering to stock it.

You can get hold of one of the boards from The Pi Hut.

Eben Upton CBE – Raspberry Pi pioneer receives Birthday honour

cbe

Eben Upton, Chief Exec of Raspberry Pi Trading, driving force behind the Raspberry Pi and one of the nicest people I know has been named a CBE in the Queen’s Birthday Honours list. He was said to be “shell-shocked” at the news. I’m sure the entire Raspberry Pi community will join with me in congratulating him and his family! Here’s how the BBC covered the story.

Wake up to Spotify with your Raspberry Pi

George Cushen has written a rather good tutorial on creating an alarm clock using a Spotify playlist. It works on the Raspberry Pi (though any Linux-based computer running something like Ubuntu will also suffice) and involves installing several different packages and then linking an alarm scheduler to a Spotify plugin. Ingenious stuff and well worth checking out if your tastes are musical. Read more here.