Computeractive, Issue 390

Computeractive, Issue 390With 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.

Computeractive, Issue 383

Computeractive, Issue 383The 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.

Computeractive, Issue 382

Computeractive, Issue 382Continuing 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!

Computeractive Issue 382 is available in all good newsagents, most bad ones, and via the Computeractive Direct website.

Computeractive, Issue 381

Computeractive, Issue 381It’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.