Those of you who follow my every move may remember a few projects I created for Dennis Publishing’s Computeractive publication, centring around the Raspberry Pi and Arduino single-board systems – in particular the three-part series walking newcomers through creating software and hardware accessories for the Pi, which proved extremely popular with readers. So popular, in fact, that Dennis has extracted the tutorial on building a switch-based game controller and republished it in the MagBook Raspberry Pi for Kids.
If you missed it the first time around, the tutorial was designed as the follow-up to an earlier guide on writing a simple snake game in Python. Using microswitches, resistors, a segment of stripboard and a soldering iron, readers are shown how to add a dedicated game controller – connected through the Pi’s general-purpose input-output (GPIO) header – to the system and modify the game’s source code accordingly. Reader feedback was good, and the relatively simple circuit makes it a logical choice for the MagBook’s target audience – although younger kids should, naturally, be supervised when using a soldering iron.
The MagBook also makes heavy use of my photography, both in my tutorial and throughout the rest of the publication where various images of my Pis can be found gracing its pages. Sadly, in an editorial oversight, my name appears to have been missed off the list of contributors – but I’m sure that will be quickly corrected in a future edition.
The Raspberry Pi for Kids MagBook is available in newsagents and supermarkets now, or via Amazon.
With my previous three-part Raspberry Pi feature for Incisive Media’s Computeractive having driven significant sales, features editor Scott Colvey was eager for me to do something similar – and this time we hit upon the idea of using the open source Arduino Microcontroller. The task: to build a digital weather station.
At the inception of the piece, various ideas were bandied around including the possibility of making a rainfall sensor that would use a constantly filling and emptying bucket linked to a switch. Sadly, making one of these from scratch within the confines of a few pages isn’t straightforward. Instead, the finished build uses three main components: an Arduino microcontroller, a DHT22/RHT03 temperature and humidity sensor, and a BMP085 temperature and pressure sensor.
Linking them all together with a short bit of code outputting comma separated values over a USB serial connection, the result is a hackable weather monitor that can be easily covered with an upturned bowl for outdoor use.
Keeping things as simple as possible, in deference to Computeractive’s target market of those interested in computing but put off the more technical nature of most mainstream magazines, the build won’t be putting Maplins’ finest to shame any time soon – but it works, and leaves the path open for a Part 2 where the Arduino is connected to a Raspberry Pi. Doing away with the PC, this would create a truly stand-alone weather station.
The code for the piece is available on my GitHub repository, while a full walk-through build with pictures can be found in the pages of Computeractive.
The latest issue of Computeractive magazine features the last portion of my three-part series looking at practical projects for the Raspberry Pi, and this one is a doozy: it involves getting your soldering iron out.
Going beyond the material originally prepared for my book, the Raspberry Pi User Guide, this latest feature takes some stripboard, switches, wiring and resistors and creates a fully-functional four-way game controller which connects directly to the Raspberry Pi’s general purpose input output (GPIO) header.
The Snake game, created for the book and featured in last issue’s tutorial on writing games using Python and the pygame library, is modified to understand both keyboard and GPIO-driven gamepad input. It’s a lot to ask of Computeractive’s readership, most of whom have probably never picked up a soldering iron before, but I’m hopeful that a few will be tempted to try it out – and made sure there were plenty of diagrams available to make things as clear as possible.
For those who want to take the project further, there are still spare GPIO pins on the Pi – meaning it’s perfectly possible to add a fire button or two for controlling a more complex game. If programming is more your thing, the fact that the code is modified to monitor both keyboard and GPIO input means it’s fairly straightforward to add a second player to the game – creating a simple version of the Tron lightcycle game.
Computeractive Issue 383 is available pretty much anywhere magazines are normally found, or online through Computeractive Direct.
Continuing my three-part series for Computeractive, in this issue you’ll find a guide to writing a simple arcade game for the Raspberry Pi using Python and the pygame library. It’s rather more in-depth than the magazine would normally cover, but that’s the whole purpose of the Raspberry Pi project after all: to get more people programming, and to dispel the myth that it’s something only a select few can ever attempt.
Those of you with eagle eyes may spot similarities between this issue’s tutorial and the pygame chapter of my book, the Raspberry Pi User Guide. There’s a good reason for that: the programs are the same. The Snake game is a great way to demonstrate game programming: it requires only four inputs – one for each cardinal direction – has a simple scoring mechanism and doesn’t require AI for the enemies. It also teaches a surprising chunk of the Python language, including the concept of stacks – used to store the location of each snake segment.
Next issue, the final part will be branching off from the book in a dramatic way: introducing the idea of building a custom game controller – to control the snake with, naturally – from scratch and connecting it to the Raspberry Pi’s General Purpose Input/Output (GPIO) port. Even if you’ve read the book – and I hope you have – I’d recommend picking up a copy!
It’s always nice to write for a new magazine, and especially when it’s something a little outside your comfort zone – and with its focus on those starting out with computing, Computeractive is certainly a fair distance away from the likes of Custom PC or Linux User & Developer.
I was approached by commissioning editor Scott Colvey to whip up a three-part series about the Raspberry Pi, starting with an “I’ve just bought it, what the hell now” introduction. As it’s remarkably similar to work I’ve already done on the Raspberry Pi User Guide, I checked with Wiley first who were only too happy for me to reprise some of that content in the magazine.
Starting at first principles – and echoing much of the first chapter of the book, albeit in a significantly condensed form – the first of the three-part series walks users through connecting the Pi to a keyboard, mouse, monitor and network, installing the Raspbian Linux distribution and loading up a graphical user interface. Throughout, I tried to match the easy-reading house style of Computeractive, and with Scott’s help created something I think I can be particularly proud of.
Initial feedback on the piece has been promising, with one reader writing in to say “thank you for what I believe is the best introductory article that I have read on setting up the basic motherboard and system software.” Which is nice.
Next issue’s feature will look at using Python and the pygame module to write a Snake game – another modified extract from the book, you may note – while the third treads new ground by creating a custom-built games controller that connects to the Raspberry Pi’s GPIO port.
Computeractive Issue 381 is available in newsagents now for £1.99 – a bargain if ever there was one – or through the Computeractive Direct website.
"Not only should it be an essential purchase with the micro:bit, I would recommend getting the book before getting the micro:bit. Definitely recommended." "This is an amazing educational tool." "For a newcomer I would recommend this book and the BBC micro:bit. Together, they will make an excellent coder/DIY enthusiast out of you or your child." "This is definitely the book to get you started." "The best book on micro:bit I've found so far." "A wealth of information on micro:bit and it's easy to read." "Just started reading your book, and it's exactly what I was looking for."
"I'm constantly reading tech manuals. This book is above and beyond ANY tech manual I have ever read! It is readable, understandable and a fine companion for the Pi." "I have been using computer manuals for 40 years and this is one of the best I have ever read." "All I was looking for is combined in this fantastic book." "I bought this book on my Kindle and it has transformed my understanding." "A brilliant book to help you out." "This book is a must have and works very well on my Kindle - thank you so much for writing it."