This month’s issue of The MagPi Magazine includes another of my tutorials for those looking to get started with the MicroPython platform on the Raspberry Pi Pico microcontroller: a Pico-powered burglar alarm driven by one or more passive infrared sensors.
Originally written as part of Get Started with MicroPython on Raspberry Pi Pico: The Official Guide, my guide to physical computing on Raspberry Pi’s first-ever microcontroller development board, the burglar alarm tutorial builds up step-by-step from introducing a single passive infrared motion sensor to interfacing with multiple sensors, printing status reports over the serial console, and triggering a piezoelectric buzzer in place of a real alarm’s rather louder horn.
As with other tutorials written for the book, full source code – in MicroPython – is provided, along with wiring references designed to make it as easy as possible to add the components to a Raspberry Pi Pico installed on a solderless breadboard. There’s scope for further extension, too: adding break-beam sensors, glass-break sensors, or a code pad for disabling and enabling the alarm on-demand.
All the projects in the book, the traffic light simulator being no exception, work step-by-step in building the simplest possible incarnation of each then adding increasing complexity – and in doing so introducing new concepts. In the case of the traffic light simulator, it starts off as a simple set of three LEDs which are under timed control.
As the project progresses, the reader adds a button to act as a trigger for a pedestrian crossing – which adds the concept of threading, taking advantage of the second CPU core on the Raspberry Pi Pico’s RP2040 microcontroller – before finishing the project with a buzzer providing audible feedback for when it’s safe to cross.
This month’s The MagPi Magazine carries my six-page guide to getting started with physical computing projects using the newly-launched Raspberry Pi Pico, the first microcontroller in the Raspberry Pi family.
Taken from my book, Get Started with MicroPython on Raspberry Pi Pico: The Official Guide, the tutorial walks the reader through programming the Raspberry Pi Pico using MicroPython – starting with the physical computing equivalent of “hello, world,” lighting up an LED. No additional hardware is needed for this part: the Raspberry Pi Pico includes a surface-mount user-addressable LED at the top of the board.
The reader is then shown how solderless breadboards work, introduced to importing MicroPython libraries and handling delays, how external LEDs require resistors, how to read a button input, and finally how to put it al together into a simple circuit which can toggle the LED based on the user’s button presses.
Today’s launch of the Raspberry Pi Pico, an affordable breadboard-friendly development board accessible enough for education and powerful enough for industrial use, comes alongside the launch of my latest book: Get Started with MicroPython on Raspberry Pi Pico: The Official Raspberry Pi Pico Guide.
Building on my earlier title The Official Raspberry Pi Beginner’s Guide, Get Started with MicroPython on Raspberry Pi Pico offers newcomers to both the Raspberry Pi Pico and the MicroPython programming language an easy way to get started. Building up from an introduction to the board, electronic circuit concepts, MicroPython in general, and MicroPython on the Raspberry Pi Pico specifically, the book walks through a series of physical computing projects – some requiring only the Raspberry Pi Pico, others using low-cost and readily-available additional hardware components.
Each successive project introduces a new concept, from simply lighting an LED and reading a button input to using hardware interrupts, running code on the second CPU core, and making use of the on-board non-volatile flash memory to store logged data. By the end of the book, the reader should know how to use all the most important features of the Raspberry Pi Pico in MicroPython – even if they started knowing nothing about electronics or programming at all.
As always, thanks must be given to those who helped during the production of the book. Particular thanks must go to Ben Everard, who acted as co-editor and also contributed a chapter on using I2C and an appendix on using the programmable input/output (PIO) functionality; Sam Adler, too, returned to provide eye-catching illustrations without which the book would be a considerably duller read.
Also to be thanked are those who provided technical assistance: Alasdair Allan, Aivar Annamaa, Damien George, Gordon Hollingworth, Graham Sanderson, and Andrew Scheller, along with all those who proofed the book ahead of publication. Not forgetting, of course, others at Raspberry Pi Press who work to bring these books to life and to shelves across the world.
I’ve been doing a lot of work with MicroPython of late, so it made sense to cover the software for Hobby Tech. Developed by Damien George as part of a crowdfunding campaign launched in 2013, MicroPython takes the popular Python programming language and ports it to microcontrollers – both dedicated PyBoard ranges and third-party hardware. It’s also the inspiration for CircuitPython, a port developed by Adafruit and designed with educational use in mind.
The RasPad 3, meanwhile, is a device I wanted to love. Built in an intriguing wedge shape, the kit takes a Raspberry Pi 4 single-board computer and turns it into a touch-screen tablet. The third in the series, and the first supporting the Raspberry Pi 4, the RasPad 3 is a great idea let down by poor execution – everything from a low-quality display and buggy software to dismal battery life and an incredibly noisy fan.
Finally, The Games That Weren’t is the latest coffee table book from Bitmap Books, based on the website of the same name by Frank Gasking. Built around the same core concept as Phil Atkinson’s Delete, The Games That Weren’t looks at video games – and a small number of related hardware projects, like the Commodore 65 – that never made it to market. At 643 pages it’s a hefty tome, but sadly let down by some high-profile absences – the ‘Van Buren’ build of Fallout 3 is present, but Fallout Online is nowhere to be found as just one example – and a woolly approach to research and citation which leans heavily on weasel-words like “it’s thought,” “some sources say,” and “it’s believed.”
My introductory Raspberry Pi book, The Official Raspberry Pi Beginner’s Guide, has now been released in a fourth edition, bringing updates for the Raspberry Pi 4 8GB, Raspberry Pi 400, and new software revisions.
Bundled with every Raspberry Pi Desktop Kit sold, and available in paperback and free-as-in-speech Creative Commons-licensed DRM-free PDF, The Official Raspberry Pi Beginner’s Guide has proven incredibly popular. The latest release includes updates to reflect changes in the Raspberry Pi OS and bundled software, alongside coverage of the all-in-one Raspberry Pi 400 and higher-specification Raspberry Pi 4 8GB.
The new edition is also now available in translation for the first time: As well as the original English edition, The Official Raspberry Pi Beginner’s Guide can now be read in French, German, Italian, and Spanish, with additional translations in the works. As always, my thanks go out to the translation team at Raspberry Pi Press for making that happen.
The Official Raspberry Pi Beginner’s Guide 4th Edition is available to buy now in all the above languages with global delivery from the official website; it can also be downloaded under free-as-in-speech terms as a Creative Commons-licensed PDF file, unencumbered by DRM. For anyone considering picking up a Raspberry Pi 400, a print copy of the book is also bundled in the Raspberry Pi 400 Desktop Kit as well as in the Raspberry Pi 4 Desktop Kit.
First, the Argon 1 Pi 4 case. Externally, this looks a lot like the Argon One reviewed back in Issue 188; internally, though, things have been shifted around to provide support for the latest Raspberry Pi 4 single-board computer – and the brown-outs caused by the smart power and cooling board drawing too much power are now a thing of the past.
As with its predecessor, the Argon 1 Pi 4 is impressively solid and does a great job at cooling the Raspberry Pi 4 by using the aluminium housing as a heatsink – even running a heavy synthetic workload, the temperature didn’t reach the minimum required to activate the built-in PWM-controlled cooling fan. It also adds some neat features, such as a labelled and colour-coded GPIO header, neater cabling through the shifting of audio and video ports to the rear, and a smart power button.
Shortly after the review was completed, but thankfully before the magazine went to press, the power board on the Argon 1 Pi 4 died – thankfully without taking the Raspberry Pi 4 with it. The review was updated accordingly, and since then Argon 40 has been stellar in attempting to resolve the problem – paying to have the faulty board returned for analysis and replacing both the faulty board and the entire unit in order to get things back up and running. While it will be a short while before it’s clear whether the failure was a one-off or not, it’s certainly impossible to fault the company’s customer service ethos.
The Sipeed Longan Nano, supplied by Seeed Studio, is an interesting beast: costing less than $5, the board is based on a low-power RISC-V microcontroller with a breadboard-friendly board design and a built-in low-resolution colour LCD display. For the money, the hardware is absolutely incredible – especially as Seeed has even designed a rough but serviceable acrylic case for the board, bundled at no additional cost.
The software and documentation, however, is definitely an issue. The libraries provided failed in a variety of ways – including an inability to use printf() or open a serial port – and the English documentation is extremely sparse. Particularly lacking is anything to demonstrate the use of the LCD – bar a single example program documented using Chinese in-line comments.
Finally, Arcade Game Typography. I’ve reviewed a lot of retro-computing coffee-table books over the years, but Omagari’s book is the first to concentrate solely on fonts and typography as used in classic arcade games – and given Omagari’s work as a designer for Monotype UK, it’s fair to say he knows his stuff. The result is a fascinating book, and one which is currently available in a limited 1,000-copy hardback print run from Read-Only Memory if the standard paperback isn’t shiny enough for you.
Custom PC Issue 197 is available on supermarket and newsagent shelves now, or can be ordered for global delivery from the official website.
The latest issue of The MagPi Magazine includes a whopping 12-page feature investigating the thermal performance of the Raspberry Pi 4 Model B single-board computer as it is affected by a series of firmware updates released since its launch earlier this year.
When I reviewed the Raspberry Pi 4 at launch, I highlighted its dramatically increased power draw and heat output compared with its predecessor the Raspberry Pi 3 Model B+. In the months since, the Raspberry Pi Foundation has been working to address the issue through a series of firmware updates – and, with assistance from Eben Upton and Tim Gover, my feature runs through each release and sees what difference it actually makes.
For the feature, I had to develop a method of benchmarking the Raspberry Pi. Power draw was relatively straightforward: the built-in current meter in a bench-top power supply is used to measure the minimal draw at idle and peak draw at load. For thermal performance, I wrote a custom benchmark which uses two open-source utilities – glxgears and stress-ng – to place a heavy load on both the CPU and the GPU while measuring the resulting temperature rise and the speed of the CPU, which throttles at 80°C to protect the silicon.
These measurements provided a graph of temperature rise and fall, the latter thanks to a five-minute cool-down period built into the benchmark, but for a more visual approach I also took thermal imagery of the board at idle and load to demonstrate which components are responsible for the heat output and better highlight the improvements made at each firmware revision. This was no small undertaking: the benchmarking and thermal imagery was completed for five firmware revisions, the last of which was not publicly available at the time of testing, plus a baseline Raspberry Pi 3B+ for comparison.
The feature also takes a look at a real-world workload, in which temperature and clock speed is measured while a four-worker compile of the Linux kernel is carried out. This revealed something which may come as a surprise to critics of the board: Using the latest firmware, the Raspberry Pi 4 did not throttle at all during the compilation – something that can’t be said for the Raspberry Pi 3B+, which throttled to 1.2GHz from 1.4GHz almost immediately. For the final bit of testing, there’s even a comparison of the Raspberry Pi 4 running sat flat on a desk and balanced vertically – at Upton’s suggestion – with a resulting dramatic impact on the throttle point and operating temperature.
Finally, firmware developer Tim Gover was kind enough to answer my questions on what the Raspberry Pi 4 firmware actually does, how it is developed, and how it can have such a dramatic impact on power usage – along with the confirmation that USB mass-storage booting and IPv6 network booting are on the to-do list for future releases.
The full feature, and plenty more beside, can be found at your local newsagent, supermarket, or downloaded at no cost in digital form under a Creative Commons licence from the official website.
My Hobby Tech column this month opens with a look at a surprisingly swish programming environment for the Nintendo Switch, of all things, walks through the creation of a power-saving networked display using the Pimoroni Inky wHAT and a Raspberry Pi, and looks at a book which purports to chart the history of Apple Macintosh gaming.
First, the programming environment. Fuze4 Nintendo Switch, available now on the Nintendo eShop, builds on the Fuze BASIC programming language originally developed for the Raspberry Pi and reviewed – alongside its BBC Micro-inspired housings – in Issue 124 and Issue 136. This time around, though, the language is considerably less BASIC and more like a hybrid between BASIC, Python, and a bit of C thrown in for good measure. It’s also less focused on things like sensor reading and GPIO control – for obvious reason – and instead designed specifically for a single task: making games.
There are aspects that need polish – in particular the sharing of created projects, which at present can only be done via Nintendo’s clunky friends-list system – but overall Fuze4 Nintendo Switch is impressive. You’ll want a keyboard, but once you get started it’s easy to build some impressive projects – one demo supplied with the game showcases a fluid 3D engine with dynamic lighting, created in a remarkably short number of lines.
The Inky wHAT project, meanwhile, was largely a means of documenting something I created for my own use: an electrophoretic display that would display the output of the schedule printer I detailed in Issue 183 without needing to print on physical paper. There’s a twist, too: after finding that the only box-frame available that would fit the project depth-wise was too large, I created a mock-up of an Amiga Workbench desktop to frame the smaller Inky wHAT display – and the effect is surprisingly convincing.
Finally, Richard Moss’ The Secret History of Mac Gaming was a pleasure to read, though a few aspects of Apple’s history are presented from the eyes of a fanboy rather than a historian. Switching between recollection, research, interview content, and contributed material, the book does a great job of documenting the largely-forgotten history of gaming on Apple Macs – though it could have benefited from another editing and layout pass, in particular to avoid the recurring issue where screenshots either appear out-of-order or without any reference in the text.
As always, the latest Custom PC Magazine is available from all good newsagents and supermarkets, or can be ordered for worldwide delivery from Raspberry Pi Press.
Following on from releasing the world’s first magazine with a computer on the cover, for which I provided the launch documentation that made up the historic MagPi Magazine Issue 40, Raspberry Pi Press has done it again: Its new publication, Get Started with Raspberry Pi, once again includes a cover-mounted computer – this time the more powerful Raspberry Pi 3 Model A+ – along with a case and pre-loaded microSD card with adapter.
The book, as its name suggests, is designed for absolute beginners to the Rasbperry Pi – but it’s not a replacement for my Official Raspberry Pi Beginner’s Guide, now in its third edition. Instead, it offers a broader but shallower overview of what the Raspberry Pi can do – starting with setting it up and moving on to both hands-on projects and an overview of community projects and third-party add-on hardware.
Inside Get Started with Raspberry Pi you’ll find a range of contributors’ work, including of course my own: The set-up guide and instructions on using the Raspbian desktop and other software, much taken from the Official Raspberry Pi Beginner’s Guide, bear my hallmark; the book also republishes the Raspberry Pi 3 Model A+ launch feature I wrote for The MagPi Magazine Issue 76, which includes an overview of the device, detailed benchmarking including how it relates to ever other model in the Raspberry Pi range, and an interview with its creators.
Those looking to get the bundled Raspberry Pi 3 Model A+ will need to head to their nearest supermarket, newsagent, or order a copy with free worldwide delivery from the Raspberry Pi Press Store; as with most Raspberry Pi Press publications, Get Started with Raspberry Pi is also available for free download under a Creative Commons licence – though, obviously, the download doesn’t include the cover-mounted computer!