Note: We’re not *really* here, we just dropped in to point you in the right direction with your new Raspberry Pi toys, then we’re disappearing again to enjoy the rest of the festive season. See you on 4 January 2021!
So… what did you get? We launched a ton of new products this year, so we’ll walk you through what to do with each of them, as well as how to get started if you received a classic Raspberry Pi.
First things first: welcome! You’re one of us now, so why not take a moment to meet your fellow Raspberry Pi folk and join our social communities?
If you got a Raspberry Pi 400 unit on its own, you’ll need to find a mouse and power supply as well as a monitor. You also won’t have received the official Raspberry Pi Beginner’s Guide that comes with the kit, so you can pick one up from the Raspberry Pi Press online store, or download a PDF for free, courtesy of The MagPi magazine.
Raspberry Pi High Quality Camera
You are going to LOVE playing around with this if you got one in your stocking. The Raspberry Pi High Quality Camera is 12.3 megapixels of fun, and the latest addition to the Raspberry Pi camera family.
Once you’ve got the hang of things, our forum will become your home from home. Gazillions of Raspberry Pi superfans hang out there and can answer pretty much any question you throw at them -- try searching first, because many questions have already been asked and answered, and perhaps yours has too.
Robots, games, digital art & more
When you’re feeling comfortable with the basics, why not head over to our projects page and pick something cool to make?
The Raspberry Pi blog is also a great place to find inspiration. We share the best projects from our global community, and things for all abilities pop up every week day. If you want us to do the heavy lifting for you, just sign up to Raspberry Pi Weekly, and we’ll send you the top blogs and Raspberry Pi-related news each week.
And if you got your very own Babbage Bear: love them, cherish them, and keep them safe. They’re of a nervous disposition so talk quietly to them for the first few days, to let them get used to you.
Just in time for the holidays, we’ve updated Raspberry Pi Imager to add some new functionality.
New submenu support: previous versions of Raspberry Pi Imager were limited to a single level of submenu. This limitation has been fixed so we can group images into different categories, such as general purpose operating systems, media players, and gaming and emulation.
New icons from our design team: easy on the eyes!
Version tracking: the menu file that Imager downloads from the Raspberry Pi website now includes an entry defining its latest version number, so in future, we can tell you when an updated Imager application is available.
Download telemetry: we’ve added some simple download telemetry to help us log how popular the various operating systems are.
You can go to our software page to download and install the new version 1.5 release of Raspberry Pi Imager and use it now.
We haven’t done telemetry in Imager before, and since people tend — rightly — to be concerned about applications gathering data, we want to explain exactly what we are doing and why: we’re logging which operating systems and categories people download, so we can make sure the most popular options are easy enough to find in Raspberry Pi Imager’s menu system.
We don’t record any personal data, such as your IP address; the information we collect allows us to see the number of downloads of each operating system over time, and nothing else. You’ll find more detailed information, including how to opt out of telemetry, in the Raspberry Pi Imager GitHub README.md.
You can see which OSes are most often downloaded too, on our stats page.
As you can see, the default recommended Raspberry Pi OS image is indeed the most downloaded option. The recently released Ubuntu Desktop for Raspberry Pi 4 and Raspberry Pi 400 is the most popular third-party operating system.
Raspberry Pi computers have always been used in a huge variety of settings, since the combination of low cost, high performance, and ease of use make it an ideal device for almost any application. We’ve seen a large proportion of sales go into the industrial market – businesses using Raspberry Pi, rather than educational settings or individual consumers. Today we’re announcing new support for this group of customers: a dedicated area of our website for industry, and our Raspberry Pi Approved Design Partners programme, connecting businesses that want to integrate Raspberry Pi into their products with hand-picked design partners who can help.
The industrial market for Raspberry Pi has grown over the years, and now represents around 44% of our annual total sales. We’ve seen this borne out with new releases of Raspberry Pi products: typically sales of a consumer product drop off once a new product is released, but we still see incredible sales of older models of Raspberry Pi. Our inference is that these are destined for embedded applications, where changing to the latest model is not practical.
A new online resource for industry
To support Raspberry Pi’s industrial customers, we have developed a new, dedicated area of our website. Our For industry pages are the best place to go for industrial applications of Raspberry Pi. They provide access to the information and support you need when using our products in an industrial setting, with links to datasheets, compliance documents, and more.
As part of our commitment to industrial customers, we guarantee product lifetimes until at least 2026 on all products. We rarely ever end a product line – in fact, you can still buy Raspberry Pi 1 Model B+ from 2014. And we’ve made it easy for you to take a product through the necessary regulatory compliance steps, with the Raspberry Pi Integrator Programme.
Raspberry Pi Approved Design Partners
Along with our online resources for industry, we’re announcing a new programme to help customers who want to integrate Raspberry Pi into their products, and to recognise companies with specialist knowledge and proven expertise in designing with Raspberry Pi. The Raspberry Pi Approved Design Partners programme is a way of connecting trusted design consultancies with customers who need support designing Raspberry Pi computing solutions into their products.
We’re launching with a select set of designers whom we already know and work with, and we hope to grow this group over the coming years. If your company provides hardware, software, or mechanical design services with Raspberry Pi, and you’d like us to promote your offering on our website, you can find out more about applying to become a Raspberry Pi Approved Design Partner.
If you have a product or a piece of work that uses Raspberry Pi, and you need technical assistance, Raspberry Pi Approved Design Partners have the capacity to provide you with effective help. All our Design Partners have been through a rigorous application process, and we will monitor them regularly for quality and ability. You can be confident that Raspberry Pi Approved Design Partners have the backing of Raspberry Pi, and have access to a deep level of technical knowledge and support within Raspberry Pi.
We’re excited to help customers build fantastic products using Raspberry Pi, and we’re looking forward to working with a diverse range of designers across the world.
To help you get the most of out of your Raspberry Pi computer, this official Handbook features 200 pages of essential information, inspiring projects, practical tutorials, and definitive reviews.
If you’re an absolute beginner, you can learn from the Handbook how to set up your Raspberry Pi and start using it. Then you can move on to the step-by-step tutorials that will teach you how to code and make with your Raspberry Pi.
Shiny new stuff
You’ll also (re)discover the new Raspberry Pi 400 and High Quality Camera, both released this year. And you’ll find out about the top kits and accessories for your projects.
And finally, we’ve also picked out some incredible Raspberry Pi projects made by people in the community to inspire you to get making and coding.
Personally, we prefer new book smell and the crackle of physical pages but, if you’re less picky and don’t mind on-screen reading, the lovely folks at The MagPi have a PDF version you can download for free.
Since lockdown started, I’ve found I often miss video meetings. It’s not intentional, I simply loose track of time. Though my phone is set to remind me of upcoming meetings ten minutes before they begin, I have a habit of trying to fill that time with something productive and before I know it, I have Eben on the phone, fifteen minutes after the meeting’s start, asking where I am.
Fixing the issue using code
Due to this, and because I was interested in playing with the Google API and learning a little more Python, I decided to write a simple application that will get your upcoming events from your Google Calendar and give you notifications as often as you want, visually on screen as well as through sound.
I call it NextEvent
Here’s the video tutorial to show you more:
And here’s the written tutorial too!
Installing NextEvent to your Raspberry Pi
To install NextEvent, open a terminal window (Ctrl-Alt-T) on Raspberry Pi and type:
This will get the files from my GitHub repository. Next you’ll need to install some dependencies, and I’ve created a script to make that easy:
The dependencies are dateutil (a library for manipulating time and dates), the Google API client libraries, and the gi-cairo library (which is for drawing the GUI).
Then fire up NextEvent:
The next thing you’ll see is NextEvent starting up, and then it’ll open Chromium. It is here that you will give Google permission to share your calendar with the application.
You’ll then need to log into your Google account and give NextEvent access to your calendar. Chromium will tell you when everything is fine and you can close the browser.
Now you can see your next five events along with the time left until each one. When the time gets down to five minutes, the application will turn red and ‘ding’ at you. It’ll ‘ding’ twice at one minute to go, and four times when your meeting is about to start!
In case you want to delve into the code, maybe to create a meeting room ‘now and next’ display, the nextevent.py source contains the GUI and event processing part of NextEvent. You should be able to go here and change the number of lines, the colours, and the notification sounds.
How does it work?
If you’re the sort that likes to know HOW the code works, here’s a follow-up to the tutorial video where I explain exactly that!
Raspberry Pi is excited to bring the Khronos OpenVX 1.3 API to our line of single-board computers. Here’s Kiriti Nagesh Gowda, AMD‘s MTS Software Development Engineer, to tell you more.
OpenVX for computer vision
OpenVX™ is an open, royalty-free API standard for cross-platform acceleration of computer vision applications developed by The Khronos Group. The Khronos Group is an open industry consortium of more than 150 leading hardware and software companies creating advanced, royalty-free acceleration standards for 3D graphics, augmented and virtual reality, vision, and machine learning. Khronos standards include Vulkan®, OpenCL™, SYCL™, OpenVX™, NNEF™, and many others.
Now with added Raspberry Pi
The Khronos Group and Raspberry Pi have come together to work on an open-source implementation of OpenVX™ 1.3, which passes the conformance on Raspberry Pi. The open-source implementation passes the Vision, Enhanced Vision, & Neural Net conformance profiles specified in OpenVX 1.3 on Raspberry Pi.
Application developers may always freely use Khronos standards when they are available on the target system. To enable companies to test their products for conformance, Khronos has established an Adopters Program for each standard. This helps to ensure that Khronos standards are consistently implemented by multiple vendors to create a reliable platform for developers. Conformant products also enjoy protection from the Khronos IP Framework, ensuring that Khronos members will not assert their IP essential to the specification against the implementation.
OpenVX enables a performance and power-optimized computer vision processing, especially important in embedded and real-time use cases such as face, body, and gesture tracking, smart video surveillance, advanced driver assistance systems (ADAS), object and scene reconstruction, augmented reality, visual inspection, robotics, and more. The developers can take advantage of using this robust API in their application and know that the application is portable across all the conformant hardware.
Below, we will go over how to build and install the open-source OpenVX 1.3 library on Raspberry Pi 4 Model B. We will run the conformance for the Vision, Enhanced Vision, & Neural Net conformance profiles and create a simple computer vision application to get started with OpenVX on Raspberry Pi.
IBM’s World Community Grid is working with scientists at Scripps Research on computational experiments to help find potential COVID-19 treatments. Anyone with a Raspberry Pi and an internet connection can help.
Why is finding potential treatments for COVID-19 so important?
Scientists all over the globe are working hard to create a vaccine that could help prevent the spread of COVID-19. However, this process is likely to take many months — or possibly even years.
In the meantime, scientists are also searching for potential treatments for the symptoms of COVID-19. A project called OpenPandemics – COVID-19 is one such effort. The project is led by researchers in the Forli Lab at Scripps Research, who are enlisting the help of World Community Grid volunteers.
What is World Community Grid and how does it work?
World Community Grid is an IBM social responsibility initiative that supports humanitarian scientific research.
As a World Community Grid volunteer, you download a secure software program to your Raspberry Pi, macOS or Windows computer, or Android device. This software program (called BOINC) is used to run World Community Grid projects, and is compatible with the Raspberry Pi OS and most other operating systems. Then, when your device is not using its full power, it automatically runs a simulated experiment in the background that will help predict the effectiveness of a particular chemical compound as a possible treatment for COVID-19. Finally, your device automatically returns the results of the completed simulation and requests the next simulation.
Over the course of the project, volunteers’ devices will run millions of simulations of small molecules interacting with portions of the virus that causes COVID-19. This is a process known as molecular docking, which is the study of how two or more molecules fit together. When a simulated chemical compound fits, or ‘docks’, with a simulation of part of the virus that causes COVID-19, that interaction may point to a potential treatment for the disease.
World Community Grid combines the results from your device along with millions of results from other volunteers all over the world and sends them to the Scripps Research team for analysis. While this process doesn’t happen overnight, it accelerates dramatically what would otherwise take many years, or might even be impossible.
OpenPandemics – COVID-19 is the first World Community Grid project to harness the power of Raspberry Pi devices, but the World Community Grid technical team is already working to make other projects available for Raspberry Pi very soon.
Getting ready for future pandemics
Scientists have learned from past outbreaks that pandemics caused by newly emerging pathogens may become more and more common. That’s why OpenPandemics – COVID-19 was designed to be rapidly deployed to fight future diseases, ideally before they reach a critical stage.
To help address future pandemics, researchers need access to swift and effective tools that can be deployed very early, as soon as a threatening disease is identified. So, the researchers behind OpenPandemics – COVID-19 are creating a software infrastructure to streamline the process of finding potential treatments for other diseases. And in keeping with World Community Grid’s open data policy, they will make their findings and these tools freely available to the scientific community.
Join a global community of science supporters
World Community Grid is thrilled to make OpenPandemics – COVID-19 available to everyone who wants to donate computing power from their Raspberry Pi. Every device can play a part in helping the search for COVID-19 treatments. Please join us!
Declutter your desk by sharing your mouse and keyboard across multiple computers at once, including your Raspberry Pis, with Barrier. Raspberry Pi Director of Software Engineering, Gordon Hollingworth, shows you how.
Subscribe to our YouTube channel: http://rpf.io/ytsub Help us reach a wider audience by translating our video content: http://rpf.io/yttranslate Buy a Raspbe…
Desk clutter is a given
My desk is a bit untidy. Talking to people in our office, you’ll find that it’s mostly because I only clear it properly once a year, or leave it entirely until the next time we move office!
It’s cluttered with Raspberry Pis of random types, with little tags saying what’s wrong or right about each one, and then there’s every manner of SD card, adapter, JTAG connector, headphones, and whiteboard marker pens you can dream of filling the gaps.
But one thing that really annoys me is that I tend to have a mouse and keyboard per computer, and I’ve got at least four computers running at my desk at any one time.
Solutions to this problem have existed for a very long time, known as KVM (keyboard, video and mouse) switches; many people use these to switch (literally with a big toggle switch) between computer 1, 2, and 3 while using a single screen.
But if that’s what you want to do, the best solution is to use VNC on each of the computers so you can use a single display, keyboard, and mouse to access each of their screens and bring them all together.
And, that’s okay, but…
But that’s not quite what I want: I like having the mass-screen real-estate around me, and I like just glancing to the left to see my Raspberry Pi on its own screen.
If only there was a way to share my mouse and keyboard across multiple computers without having to flick switches or unplug USBs.
Barrier to the rescue!
In the same way one may set up multiple monitors for one computer, and move the mouse cursor seamlessly between them, Barrier allows you to share peripherals between multiple computers, allowing you to host your keyboard and mouse on one computer. It lets you simply drag your cursor from screen to screen, from device to device, as if by magic.
Download and set up Barrier
Barrier is free to use, and simple to set up. You can either follow the video tutorial shared above, or continue reading below:
At the end of the installation, the application will run. Select the Server option (the server is the one that has the keyboard and mouse that you want to share).
Next select Configure Server. Click on the computer screen in the top-right and drag it to where you want it to appear in relation to the server. It will default to being called ‘Unnamed’.
Next, double-click the new ‘Unnamed’ screen to set it up.
The only thing you need to do here is to set the screen name. Here I’ve changed it to ‘raspberrypi’. Click OK here and on the Server configuration‘ dialogue. You’ll return to the main Barrier page. Click Reload.
Download Barrier to your Raspberry Pi computer
Now turn to your Raspberry Pi, open a terminal window (Ctrl-Alt-T if you didn’t know), and run:
sudo apt install barrier
Once installation is complete, Barrier should appear in the Accessories drop-down menu, which you can access via the main menu icon (the Raspberry Pi logo in the top right-hand corner). Select Barrier and, this time, choose Client.
If you leave Auto config selected, Barrier should just work, as long as the screen name is correct (you can change this by clicking Barrier and then Change settings) and matches the name you told the server.
And there you have it. You can now use your mouse and keyboard across both your computers. And, if you have enough desktop space for even more monitors, you can continue to add devices to Barrier until your room ends up looking something like this:
If you use Barrier to clean up your workspace, make sure to share a ‘before’ and ‘after’ photo with us on Twitter.
Enabling two-factor authentication (2FA) to boost security for your important accounts is becoming a lot more common these days. However you might be surprised to learn that you can do the same with your Raspberry Pi. You can enable 2FA on Raspberry Pi, and afterwards you’ll be challenged for a verification code when you access it remotely via Secure Shell (SSH).
Accessing your Raspberry Pi via SSH
A lot of people use a Raspberry Pi at home as a file, or media, server. This is has become rather common with the launch of Raspberry Pi 4, which has both USB 3 and Gigabit Ethernet. However, when you’re setting up this sort of server you often want to run it “headless”; without a monitor, keyboard, or mouse. This is especially true if you intend tuck your Raspberry Pi away behind your television, or somewhere else out of the way. In any case, it means that you are going to need to enable Secure Shell (SSH) for remote access.
However, it’s also pretty common to set up your server so that you can access your files when you’re away from home, making your Raspberry Pi accessible from the Internet.
Most of us aren’t going to be out of the house much for a while yet, but if you’re taking the time right now to build a file server, you might want to think about adding some extra security. Especially if you intend to make the server accessible from the Internet, you probably want to enable two-factor authentication (2FA) using Time-based One-Time Password (TOTP).
What is two-factor authentication?
Two-factor authentication is an extra layer of protection. As well as a password, “something you know,” you’ll need another piece of information to log in. This second factor will be based either on “something you have,” like a smart phone, or on “something you are,” like biometric information.
We’re going to go ahead and set up “something you have,” and use your smart phone as the second factor to protect your Raspberry Pi.
Updating the operating system
The first thing you should do is make sure your Raspberry Pi is up to date with the latest version of Raspbian. If you’re running a relatively recent version of the operating system you can do that from the command line:
$ sudo apt-get update
$ sudo apt-get full-upgrade
If you’re pulling your Raspberry Pi out of a drawer for the first time in a while, though, you might want to go as far as to install a new copy of Raspbian using the new Raspberry Pi Imager, so you know you’re working from a good image.
Enabling Secure Shell
The Raspbian operating system has the SSH server disabled on boot. However, since we’re intending to run the board without a monitor or keyboard, we need to enable it if we want to be able to SSH into our Raspberry Pi.
The easiest way to enable SSH is from the desktop. Go to the Raspbian menu and select “Preferences > Raspberry Pi Configuration”. Next, select the “Interfaces” tab and click on the radio button to enable SSH, then hit “OK.”
You can also enable it from the command line using systemctl:
Alternatively, you can enable SSH using raspi-config, or, if you’re installing the operating system for the first time, you can enable SSH as you burn your SD Card.
Next, we need to tell the SSH daemon to enable “challenge-response” passwords. Go ahead and open the SSH config file:
$ sudo nano /etc/ssh/sshd_config
Enable challenge response by changing ChallengeResponseAuthentication from the default no to yes.
Then restart the SSH daemon:
$ sudo systemctl restart ssh
It’s good idea to open up a terminal on your laptop and make sure you can still SSH into your Raspberry Pi at this point — although you won’t be prompted for a 2FA code quite yet. It’s sensible to check that everything still works at this stage.
Installing two-factor authentication
The first thing you need to do is download an app to your phone that will generate the TOTP. One of the most commonly used is Google Authenticator. It’s available for Android, iOS, and Blackberry, and there is even an open source version of the app available on GitHub.
Now we have 2FA installed on both our phone, and our Raspberry Pi, we’re ready to get things configured.
Configuring two-factor authentication
You should now run Google Authenticator from the command line — without using sudo — on your Raspberry Pi in order to generate a QR code:
Afterwards you’re probably going to have to resize the Terminal window so that the QR code is rendered correctly. Unfortunately, it’s just slightly wider than the standard 80 characters across.
The QR code generated by google-authenticator. Don’t worry, this isn’t the QR code for my key; I generated one just for this post that I didn’t use.
Don’t move forward quite yet! Before you do anything else you should copy the emergency codes and put them somewhere safe.
These codes will let you access your Raspberry Pi — and turn off 2FA — if you lose your phone. Without them, you won’t be able to SSH into your Raspberry Pi if you lose or break the device you’re using to authenticate.
Next, before we continue with Google Authenticator on the Raspberry Pi, open the Google Authenticator app on your phone and tap the plus sign (+) at the top right, then tap on “Scan barcode.”
Your phone will ask you whether you want to allow the app access to your camera; you should say “Yes.” The camera view will open. Position the barcode squarely in the green box on the screen.
Scanning the QR code with the Google Authenticator app.
As soon as your phone app recognises the QR code it will add your new account, and it will start generating TOTP codes automatically.
The TOTP in Google Authenticator app.
Your phone will generate a new one-time password every thirty seconds. However, this code isn’t going to be all that useful until we finish what we were doing on your Raspberry Pi. Switch back to your terminal window and answer “Y” when asked whether Google Authenticator should update your .google_authenticator file.
Then answer “Y” to disallow multiple uses of the same authentication token, “N” to increasing the time skew window, and “Y” to rate limiting in order to protect against brute-force attacks.
You’re done here. Now all we have to do is enable 2FA.
Enabling two-factor authentication
We’re going to use Linux Pluggable Authentication Modules (PAM), which provides dynamic authentication support for applications and services, to add 2FA to SSH on Raspberry Pi.
Now we need to configure PAM to add 2FA:
$ sudo nano /etc/pam.d/sshd
Add auth required pam_google_authenticator.so to the top of the file. You can do this either above or below the line that says @include common-auth.
As I prefer to be prompted for my verification code after entering my password, I’ve added this line after the @include line. If you want to be prompted for the code before entering your password you should add it before the @include line.
Now restart the SSH daemon:
$ sudo systemctl restart ssh
Next, open up a terminal window on your laptop and try and SSH into your Raspberry Pi.
Wrapping things up
If everything has gone to plan, when you SSH into the Raspberry Pi, you should be prompted for a TOTP after being prompted for your password.
SSH’ing into my Raspberry Pi.
You should go ahead and open Google Authenticator on your phone, and enter the six-digit code when prompted. Then you should be logged into your Raspberry Pi as normal.
You’ll now need your phone, and a TOTP, every time you ssh into, or scp to and from, your Raspberry Pi. But because of that, you’ve just given a huge boost to the security of your device.
Now you have the Google Authenticator app on your phone, you should probably start enabling 2FA for your important services and sites — like Google, Twitter, Amazon, and others — since most bigger sites, and many smaller ones, now support two-factor authentication.
If you find yourself working or learning, or simply socialising from home, Raspberry Pi can help with everything from collaborative productivity to video conferencing. Read more in issue #92 of The MagPi, out now.
01 Install the camera
If you’re using a USB webcam, you can simply insert it into a USB port on Raspberry Pi. If you’re using a Raspberry Pi Camera Module, you’ll need to unpack it, then find the ‘CAMERA’ port on the top of Raspberry Pi – it’s just between the second micro-HDMI port and the 3.5mm AV port. Pinch the shorter sides of the port’s tab with your nails and pull it gently upwards. With Raspberry Pi positioned so the HDMI ports are at the bottom, insert one end of the camera’s ribbon cable into the port so the shiny metal contacts are facing the HDMI port. Hold the cable in place, and gently push the tab back home again.
If the Camera Module doesn’t have the ribbon cable connected, repeat the process for the connector on its underside, making sure the contacts are facing downwards towards the module. Finally, remove the blue plastic film from the camera lens.
02 Enable Camera Module access
Before you can use your Raspberry Pi Camera Module, you need to enable it in Raspbian. If you’re using a USB webcam, you can skip this step. Otherwise, click on the raspberry menu icon in Raspbian, choose Preferences, then click on Raspberry Pi Configuration.
When the tool loads, click on the Interfaces tab, then click on the ‘Enabled’ radio button next to Camera. Click OK, and let Raspberry Pi reboot to load your new settings. If you forget this step, Raspberry Pi won’t be able to communicate with the Camera Module.
03 Set up your microphone
If you’re using a USB webcam, it may come with a microphone built-in; otherwise, you’ll need to connect a USB headset, a USB microphone and separate speakers, or a USB sound card with analogue microphone and speakers to Raspberry Pi. Plug the webcam into one of Raspberry Pi’s USB 2.0 ports, furthest away from the Ethernet connector and marked with black plastic inners.
Right-click on the speaker icon at the top-right of the Raspbian desktop and choose Audio Inputs. Find your microphone or headset in the list, then click it to set it as the default input. If you’re using your TV or monitor’s speakers, you’re done; if you’re using a headset or separate speakers, right-click on the speaker icon and choose your device from the Audio Outputs menu as well.
04 Set access permissions
Click on the Internet icon next to the raspberry menu to load the Chromium web browser. Click in the address box and type hangouts.google.com. When the page loads, click ‘Sign In’ and enter your Google account details; if you don’t already have a Google account, you can sign up for one free of charge.
When you’ve signed in, click Video Call. You’ll be prompted to allow Google Hangouts to access both your microphone and your camera. Click Allow on the prompt that appears. If you Deny access, nobody in the video chat will be able to see or hear you!
05 Invite friends or join a chat
You can invite friends to your video chat by writing their email address in the Invite People box, or copying the link and sending it via another messaging service. They don’t need their own Raspberry Pi to participate – you can use Google Hangouts from a laptop, desktop, smartphone, or tablet. If someone has sent you a link to their video chat, open the message on Raspberry Pi and simply click the link to join automatically.
You can click the microphone or video icons at the bottom of the window to temporarily disable the microphone or camera; click the red handset icon to leave the call. You can click the three dots at the top-right to access more features, including switching the chat to full-screen view and sharing your screen – which will allow guests to see what you’re doing on Raspberry Pi, including any applications or documents you have open.
06 Adjust microphone volume
If your microphone is too quiet, you’ll need to adjust the volume. Click the Terminal icon at the upper-left of the screen, then type alsamixer followed by the ENTER key. This loads an audio mixing tool; when it opens, press F4 to switch to the Capture tab and use the up-arrow and down-arrow keys on the keyboard to increase or decrease the volume. Try small adjustments at first; setting the capture volume too high can cause the audio to ‘clip’, making you harder to hear. When finished, press CTRL+C to exit AlsaMixer, then click the X at the top-right of the Terminal to close it.
Adjust your audio volume settings with the AlsaMixer tool
Work online with your team
Just because you’re not shoulder-to-shoulder with colleagues doesn’t mean you can’t collaborate, thanks to these online tools.
Google Docs is a suite of online productivity tools linked to the Google Drive cloud storage platform, all accessible directly from your browser. Open the browser and go to drive.google.com, then sign in with your Google account – or sign up for a new account if you don’t already have one – for 15GB of free storage plus access to the word processor Google Docs, spreadsheet Google Sheets, presentation tool Google Slides, and more. Connect with colleagues and friends to share files or entire folders, and collaborate within documents with simultaneous multi-user editing, comments, and change suggestions.
Designed for business, Slack is a text-based instant messaging tool with support for file transfer, rich text, images, video, and more. Slack allows for easy collaboration in Teams, which are then split into multiple channels or rooms – some for casual conversation, others for more focused discussion. If your colleagues or friends already have a Slack team set up, ask them to send you an invite; if not, you can head to app.slack.com and set one up yourself for free.
Built more for casual use, Discord offers live chat functionality. While the dedicated Discord app includes voice chat support, this is not yet supported on Raspberry Pi – but you can still use text chat by opening the browser, going to discord.com, and choosing the ‘Open Discord in your browser’ option. Choose a username, read and agree to the terms of service, then enter an email address and password to set up your own free Discord server. Alternatively, if you know someone on Discord already, ask them to send you an invitation to access their server.
If you need to send a document, image, or any other type of file to someone who isn’t on Google Drive, you can use Firefox Send – even if you’re not using the Firefox browser. All files transferred via Firefox Send are encrypted, and can be protected with an optional password, and are automatically deleted after a set number of downloads or length of time. Simply open the browser and go to send.firefox.com; you can send files up to 1GB without an account, or sign up for a free Firefox account to increase the limit to 2.5GB.
For programmers, GitHub is a lifesaver. Based around the Git version control system, GitHub lets teams work on a project regardless of distance using repositories of source code and supporting files. Each programmer can have a local copy of the program files, work on them independently, then submit the changes for inclusion in the master copy – complete with the ability to handle conflicting changes. Better still, GitHub offers additional collaboration tools including issue tracking. Open the browser and go to github.com to sign up, or sign in if you have an existing account, and follow the getting started guide on the site.
Read The MagPi for free!
Find more fantastic projects, tutorials, and reviews in The MagPi #93, out now! You can get The MagPi #92 online at our store, or in print from all good newsagents and supermarkets. You can also access The MagPi magazine via our Android and iOS apps.
Don’t forget our super subscription offers, which include a free gift of a Raspberry Pi Zero W when you subscribe for twelve months.
Since we released the first Raspberry Pi camera module back in 2013, users have been clamouring for better access to the internals of the camera system, and even to be able to attach camera sensors of their own to the Raspberry Pi board. Today we’re releasing our first version of a new open source camera stack which makes these wishes a reality.
(Note: in what follows, you may wish to refer to the glossary at the end of this post.)
We’ve had the building blocks for connecting other sensors and providing lower-level access to the image processing for a while, but Linux has been missing a convenient way for applications to take advantage of this. In late 2018 a group of Linux developers started a project called libcamera to address that. We’ve been working with them since then, and we’re pleased now to announce a camera stack that operates within this new framework.
Here’s how our work fits into the libcamera project.
We’ve supplied a Pipeline Handler that glues together our drivers and control algorithms, and presents them to libcamera with the API it expects.
Here’s a little more on what this has entailed.
V4L2 (Video for Linux 2) is the Linux kernel driver framework for devices that manipulate images and video. It provides a standardised mechanism for passing video buffers to, and/or receiving them from, different hardware devices. Whilst it has proved somewhat awkward as a means of driving entire complex camera systems, it can nonetheless provide the basis of the hardware drivers that libcamera needs to use.
Consequently, we’ve upgraded both the version 1 (Omnivision OV5647) and version 2 (Sony IMX219) camera drivers so that they feature a variety of modes and resolutions, operating in the standard V4L2 manner. Support for the new Raspberry Pi High Quality Camera (using the Sony IMX477) will be following shortly. The Broadcom Unicam driver – also V4L2‑based – has been enhanced too, signalling the start of each camera frame to the camera stack.
Finally, dumping raw camera frames (in Bayer format) into memory is of limited value, so the V4L2 Broadcom ISP driver provides all the controls needed to turn raw images into beautiful pictures!
Configuration and control algorithms
Of course, being able to configure Broadcom’s ISP doesn’t help you to know what parameters to supply. For this reason, Raspberry Pi has developed from scratch its own suite of ISP control algorithms (sometimes referred to generically as 3A Algorithms), and these are made available to our users as well. Some of the most well known control algorithms include:
AEC/AGC (Auto Exposure Control/Auto Gain Control): this monitors image statistics into order to drive the camera exposure to an appropriate level.
AWB (Auto White Balance): this corrects for the ambient light that is illuminating a scene, and makes objects that appear grey to our eyes come out actually grey in the final image.
But there are many others too, such as ALSC (Auto Lens Shading Correction, which corrects vignetting and colour variation across an image), and control for noise, sharpness, contrast, and all other aspects of image processing. Here’s how they work together.
The control algorithms all receive statistics information from the ISP, and cooperate in filling in metadata for each image passing through the pipeline. At the end, the metadata is used to update control parameters in both the image sensor and the ISP.
Previously these functions were proprietary and closed source, and ran on the Broadcom GPU. Now, the GPU just shovels pixels through the ISP hardware block and notifies us when it’s done; practically all the configuration is computed and supplied from open source Raspberry Pi code on the ARM processor. A shim layer still exists on the GPU, and turns Raspberry Pi’s own image processing configuration into the proprietary functions of the Broadcom SoC.
To help you configure Raspberry Pi’s control algorithms correctly for a new camera, we include a Camera Tuning Tool. Or if you’d rather do your own thing, it’s easy to modify the supplied algorithms, or indeed to replace them entirely with your own.
Whilst ISP vendors are in some cases contributing open source V4L2 drivers, the reality is that all ISPs are very different. Advertising these differences through kernel APIs is fine – but it creates an almighty headache for anyone trying to write a portable camera application. Fortunately, this is exactly the problem that libcamera solves.
We provide all the pieces for Raspberry Pi-based libcamera systems to work simply “out of the box”. libcamera remains a work in progress, but we look forward to continuing to help this effort, and to contributing an open and accessible development platform that is available to everyone.
Summing it all up
So far as we know, there are no similar camera systems where large parts, including at least the control (3A) algorithms and possibly driver code, are not closed and proprietary. Indeed, for anyone wishing to customise a camera system – perhaps with their own choice of sensor – or to develop their own algorithms, there would seem to be very few options – unless perhaps you happen to be an extremely large corporation.
In this respect, the new Raspberry Pi Open Source Camera System is providing something distinctly novel. For some users and applications, we expect its accessible and non-secretive nature may even prove quite game-changing.
What about existing camera applications?
The new open source camera system does not replace any existing camera functionality, and for the foreseeable future the two will continue to co-exist. In due course we expect to provide additional libcamera-based versions of raspistill, raspivid and PiCamera – so stay tuned!
If you’d like to know more, and can’t find an answer in our documentation, please go to the Camera Board forum. We’ll be sure to keep our eyes open there to pick up any of your questions.
Thanks to Naushir Patuck and Dave Stevenson for doing all the really tricky bits (lots of V4L2-wrangling).
Thanks also to the libcamera team (Laurent Pinchart, Kieran Bingham, Jacopo Mondi and Niklas Söderlund) for all their help in making this project possible.
3A, 3A Algorithms: refers to AEC/AGC (Auto Exposure Control/Auto Gain Control), AWB (Auto White Balance) and AF (Auto Focus) algorithms, but may implicitly cover other ISP control algorithms. Note that Raspberry Pi does not implement AF (Auto Focus), as none of our supported camera modules requires it AEC: Auto Exposure Control AF: Auto Focus AGC: Auto Gain Control ALSC: Auto Lens Shading Correction, which corrects vignetting and colour variations across an image. These are normally caused by the type of lens being used and can vary in different lighting conditions AWB: Auto White Balance Bayer: an image format where each pixel has only one colour component (one of R, G or B), creating a sort of “colour mosaic”. All the missing colour values must subsequently be interpolated. This is a raw image format meaning that no noise, sharpness, gamma, or any other processing has yet been applied to the image CSI-2: Camera Serial Interface (version) 2. This is the interface format between a camera sensor and Raspberry Pi GPU: Graphics Processing Unit. But in this case it refers specifically to the multimedia coprocessor on the Broadcom SoC. This multimedia processor is proprietary and closed source, and cannot directly be programmed by Raspberry Pi users ISP: Image Signal Processor. A hardware block that turns raw (Bayer) camera images into full colour images (either RGB or YUV) Raw: see Bayer SoC: System on Chip. The Broadcom processor at the heart of all Raspberry Pis Unicam: the CSI-2 receiver on the Broadcom SoC on the Raspberry Pi. Unicam receives pixels being streamed out by the image sensor V4L2: Video for Linux 2. The Linux kernel driver framework for devices that process video images. This includes image sensors, CSI-2 receivers, and ISPs
To coincide with yesterday’s launch of the Raspberry Pi High Quality Camera, Raspberry Pi Press has created a new Official Camera Guide to help you get started and inspire your future projects.
The Raspberry Pi High Quality Camera
Connecting a High Quality Camera turns your Raspberry Pi into a powerful digital camera. This 132-page book tells you everything you need to know to set up the camera, attach a lens, and start capturing high-resolution photos and video footage.
Make those photos snazzy
The book tells you everything you need to know in order to use the camera by issuing commands in a terminal window or via SSH. It also demonstrates how to control the camera with Python using the excellent picamera library.
You’ll discover the many image modes and effects available – our favourite is ‘posterise’.
Build some amazing camera-based projects
Once you’ve got the basics down, you can start using your camera for a variety of exciting Raspberry Pi projects showcased across the book’s 17 packed chapters. Want to make a camera trap to monitor the wildlife in your garden? Build a smart door with a video doorbell? Try out high-speed and time-lapse photography? Or even find out which car is parked in your driveway using automatic number-plate recognition? The book has all this covered, and a whole lot more.
Don’t have a High Quality Camera yet? No problem. All the commands in the book are exactly the same for the standard Raspberry Pi Camera Module, so you can also use this model with the help of our Official Camera Guide.
Snap it up!
The Official Raspberry Pi Camera Guide is available now from the Raspberry Pi Press online store for £10. And, as always, we have also released the book as a free PDF. But the physical book feels so good to hold and looks so handsome on your bookshelf, we don’t think you’ll regret getting your hands on the print edition.
Whichever format you choose, have fun shooting amazing photos and videos with the new High Quality Camera. And do share what you capture with us on social media using #ShotOnRaspberryPi.
We’re pleased to announce a new member of the Raspberry Pi camera family: the 12.3-megapixel High Quality Camera, available today for just $50, alongside a range of interchangeable lenses starting at $25.
Subscribe to our YouTube channel: http://rpf.io/ytsub Help us reach a wider audience by translating our video content: http://rpf.io/yttranslate Buy a Raspbe…
It’s really rather good, as you can see from this shot of Cambridge’s finest bit of perpendicular architecture.
At 69 years, King’s College Chapel took only slightly longer to finish than the High Quality Camera.
And this similarly pleasing bit of chip architecture.
Ready for your closeup.
Raspberry Pi and the camera community
There has always been a big overlap between Raspberry Pi hackers and camera hackers. Even back in 2012, people (okay, substantially Dave Hunt) were findinginterestingways to squeeze more functionality out of DSLR cameras using their Raspberry Pi computers.
Dave’s water droplet photography. Still, beautiful.
The OG Raspberry Pi camera module
In 2013, we launched our first camera board, built around the OmniVision OV5647 5‑megapixel sensor, followed rapidly by the original Pi NoIR board, with infrared sensitivity and a little magic square of blue plastic. Before long, people were attaching them to telescopes and using them to monitor plant health from drones (using the aforementioned little square of plastic).
We like the Moon.
Sadly, OV5647 went end-of-life in 2015, and the 5-megapixel camera has the distinction of being one of only three products (along with the original Raspberry Pi 1 and the official WiFi dongle) that we’ve ever discontinued. Its replacement, built around the 8-megapixel Sony IMX219 sensor, launched in April 2016; it has found a home in all sorts of cool projects, from line-followers to cucumber sorters, ever since. Going through our sales figures while writing this post, we were amazed to discover we’ve sold over 1.7 million of these to date.
The limitations of fixed-focus
Versatile though they are, there are limitations to mobile phone-type fixed-focus modules. The sensors themselves are relatively small, which translates into a lower signal-to-noise ratio and poorer low-light performance; and of course there is no option to replace the lens assembly with a more expensive one, or one with different optical properties. These are the shortcomings that the High Quality Camera is designed to address.
Raspberry Pi High Quality Camera
Raspberry Pi High Quality Camera, without a lens attached
12.3 megapixel Sony IMX477 sensor
1.55μm × 1.55μm pixel size – double the pixel area of IMX219
Back-illuminated sensor architecture for improved sensitivity
Support for off-the-shelf C- and CS-mount lenses
Integrated back-focus adjustment ring and tripod mount
We expect that over time people will use quite a wide variety of lenses, but for starters our Approved Resellers will be offering a couple of options: a 6 mm CS‑mount lens at $25, and a very shiny 16 mm C-mount lens priced at $50.
Our launch-day lens selection.
Read all about it
Also out today is our new Official Raspberry Pi Camera Guide, covering both the familiar Raspberry Pi Camera Module and the new Raspberry Pi High Quality Camera.
We’ll never not be in love with Jack’s amazing design work.
Our new guide, published by Raspberry Pi Press, walks you through setting up and using your camera with your Raspberry Pi computer. You’ll also learn how to use filters and effects to enhance your photos and videos, and how to set up creative projects such as stop-motion animation stations, wildlife cameras, smart doorbells, and much more.
As with every product we build, the High Quality Camera has taught us interesting new things, in this case about producing precision-machined aluminium components at scale (and to think we thought injection moulding was hard!). Getting this right has been something of a labour of love for me over the past three years, designing the hardware and getting it to production. Naush Patuck tuned the VideoCore IV ISP for this sensor; David Plowman helped with lens evaluation; Phil King produced the book; Austin Su provided manufacturing support.
We’d like to acknowledge Phil Holden at Sony in San Jose, the manufacturing team at Sony UK Tec in Pencoed for their camera test and assembly expertise, and Shenzhen O-HN Optoelectronic for solving our precision engineering challenges.
Which Raspberry Pi models support the High Quality Camera?
The High Quality Camera is compatible with almost all Raspberry Pi models, from the original Raspberry Pi 1 Model B onward. Some very early Raspberry Pi Zero boards from the start of 2016 lack a camera connector, and other Zero users will need the same adapter FPC that is used with Camera Module v2.
What about Camera Module v2?
The regular and infrared versions of Camera Module v2 will still be available. The High Quality Camera does not supersede it. Instead, it provides a different tradeoff between price, performance, and size.
What lenses can I use with the High Quality Camera?
You can use C- and CS-mount lenses out of the box (C-mount lenses use the included C-CS adapter). Third-party adapters are available from a wide variety of lens standards to CS-mount, so it is possible to connect any lens that meets the back‑focus requirements.
We’re looking forward to seeing the oldest and/or weirdest lenses anyone can get working, but here’s one for starters, courtesy of Fiacre.
Yesterday I wrote about working from home with your Raspberry Pi, and talked about things like how to connect to your company VPN, and how to get video conferencing up and working. However, one thing I didn’t talk about – and that many of you have asked for some guidance on – was printing.
To get printing up and working on your Raspberry Pi the first thing you need to do is install CUPS. CUPS is an open source printing system developed by Apple that uses the Internet Printing Protocol (IPP) to support printing to both local and network printers.
Go ahead and open a terminal window, and install CUPS.
$ sudo apt-get install cups
CUPS has a lot of dependencies, so depending on your broadband connection installation, it could take a while. If you have any left in the house, now might be a good time for a cup of coffee ☕.
After installation you’ll need to give the pi user administrative rights on CUPS. To do this, go back to your console and type
$ sudo usermod -a -G lpadmin pi
to make the pi user part of the lpadmin group.
Adding a printer
Now open up your browser and navigate to https://localhost:631 . You’ll receive a security warning from your browser. Hit the ‘Advanced’ button and then ‘Proceed to localhost (unsafe)’.
Accepting the locally generated certificate
You’ll be presented with the CUPS interface. Click on ‘Administration’ in the top bar, and a drop-down will appear. Authorise yourself to CUPS as the pi user, which we’d added to the administrator group earlier.
Authorising yourself with CUPS as an administrator
After you authorise yourself, click on the ‘Add Printer’ button. CUPS will then look for locally connected (via USB) printers as well as any networked printers it can see on your home network.
For a lot of printers you’ll be presented with a number of possible options, as most modern printers offer a number of ways to connect. So depending on which printer you have, you might need to go through the process of adding a printer a couple of times to figure out the best method to connect.
Picking this option, I was presented with a list of drivers for the printer. I picked IPP Everywhere from the list, and hit the ‘Add Printer’ button.
Successfully added the printer
After a few seconds CUPS should present you with the ‘Printers’ tab, which should show you your connected printer. If everything is okay it should show that the printer is ‘Accepting Jobs’.
Testing the printer
Now we have our printer set up we need to test it. Go ahead and open LibreOffice Writer from the start menu, and enter some test text.
Writing a test document
Then click on ‘File > Print’ in the LibreOffice Writer menu.
Printing our test document from LibreOffice Writer
If everything has gone smoothly your printer should start making appropriate printing noises and should print your test document.
Our test documents
I actually went ahead and printed two test documents just to be sure colour printing was working okay, and happily it was working just fine!
The exact process you’re going to go through to get your printer working will depend heavily on which printer you own. The trickiest bit is always going to be drivers. Thankfully, these days things are a lot easier than they used to be, as most printers – especially networked printers that live on your wireless network – offer standard ways to print and you don’t necessarily have to rely on a native (manufacturer-provided) driver any more.
It is time. Time to go to that little stack of gifts from well-wishers who have badged you as “techie” or noted that you “play computer games”. Armed with this information, they decided you’d like to receive one of our small and perfectly formed Raspberry Pis. You were thrilled. You could actually make a thing.
Except you haven’t. You had to go to that job thingy, and talk to that partner thingy, and wash and feed those children thingies. Don’t worry, we’re not offended. We know that embarking on your first coding project is daunting and that the community has taken off like a rocket so there are eight bajillion ideas floating around. Good job we’re here to help, then, isn’t?
First-timer project 01
Some of us have found ourselves spending more time with our online communities recently. Those whose digital family of choice is to be found on Reddit should see an uptick in their personal ‘Karma’ if they’re spending more time digging into “the front page of the internet”. If you’d like to see a real-world indicator of the fruits of your commenting/sharing/Let-Me-Google-That-For-You labour, a super-easy Raspberry Pi first-timer project is building a Karma counter, like this one we found on Reddit.
Now, Squiddles1227 is one of those flash 3D printer-owning types, but you could copy the premise and build your own crafty Karma-themed housing around your counter.
On a similar note (and featuring a comprehensive ‘How To’), GiovanniBauer on instructables.com used his Raspberry Pi to create an Instagram follower counter. Developed on Raspbian with Node.js, this project walk-through should get you started on whichever social media counter project you’d like to have a bash at.
First-timer project 02
We know this is a real-life Raspberry Pi first-timer project because the Reddit post title says so. Ninjalionman1 made an e-ink calendar using a Raspberry Pi Zero so they can see their daily appointments, weather report, and useful updates.
Raspberry Pi 3 and 4, as well as Raspberry Pi Zero W, come with built-in Bluetooth connectivity. This means you can build something to let your lockdown-weary self take your emotional-health-preserving music/podcasts/traditional chant soundtrack with you as you migrate around your living space. “Mornings in the lounge… mid-afternoons at the kitchen table…” – we feel you.
Circuitdigest.com posted this comprehensive walk-through to show you how a Raspberry Pi can convert an ordinary speaker with a 3.5mm jack into a wireless Bluetooth speaker.
First-timer project 04
PCWorld.com shared 10 Raspberry Pi projects they bet anyone can do, and we really like the look of this one. It shows you how to give a “dumb” TV extra smarts, like web browsing, which could be especially useful if screen availability is limited in a multi-user household.
The PCWorld article recommends using a Raspberry Pi 2, 3 or 4, and points out that this is a much cheaper option than things like Chromebits and Compute Sticks.
First-timer project 05
Lastly, electromaker.io have hidden the coding education vegetables in the Minecraft tomato sauce using Raspberry Pi. The third post down on this thread features a video explaining how you can hack your kids’ favourite game to get them learning to code.
The video blurb also helpfully points out that Minecraft comes pre-installed on Raspbian, making it “one of the greatest Pi projects for kids.”
If you’re not quite ready to jump in and try any of the above, try working your way through these really simple steps to set up your Raspberry Pi and see what it can do. Then come back here and try one of these first-timer projects, share the results of your efforts, tag us, and receive a virtual round of applause!
Connect your gaming PC to your TV with ease, thanks to Steam Link and Raspberry Pi.
A Steam Link to the past
Back in 2018, we asked Simon, our Asset Management AssistantKeeper of the Swag, Organiser of the Stuff, Lord Commander of the Things to give Steam Link on Raspberry Pi a try for us, as he likes that sort of thing and was probably going to do it anyway.
Valve’s Steam Link, in case you don’t know, allows users of the gaming distribution platform Steam to stream video games from their PC to a display of their choice via their home network, with no need for cumbersome wires and whatnot.
Originally produced as a stand-alone box in 2018, Valve released this tool as a free download to all Raspberry Pi users, making it accessible via a single line of code. Nice!
The result of Simon’s experiment was positive: he reported that setting up Steam Link was easy, and the final product was a simple and affordable means of playing PC games on his TV, away from his PC in another room.
Well, it’s 2020 and since many of us are staying home lately, so we figured it would be nice to remind you all that this streaming service is still available.
To set up Steam Link on your Raspberry Pi, simply enter the following into a terminal window:
In HackSpace magazine issue 28 we had a look at how to create an ultrasonic controller for a version of Pong called Boing!. This month, we’re going to take a step further forward through video game history and look at the game Frogger. In this classic game, you control a frog as it makes its way across logs, roads, and train tracks, avoiding falling in the water or getting hit.
Jump along the logs, dodge the traffic, avoid the trains, and keep your bunny alive for as long as possible
All this hopping got us thinking about a controller. Our initial idea was that since the animals jump, so should the controller. An accelerometer can detect freefall, so it shouldn’t be too hard to convert that into button presses. However, it turns out that computer-controlled frogs and rabbits can jump much, much faster than humans can, and we really struggled to get a working game mechanic, so we compromised a little and worked with ‘flicks’.
The flick controller
The basic idea is that you tilt the controller left or right to move left or right, but you have to flick it up to register a jump (simply holding it upright won’t work).
We’ve used a Circuit Playground Bluefruit as our hardware, but it would work equally well with a Circuit Playground Express. There are two key parts to the software. The first is reading in accelerometer values and use these to know what orientation the board is in, and the second is the board mimicing a USB keyboard and sending keystrokes to any software running on it.
Playing Infinite Bunner
The first step is to get Infinite Bunner working on your machine.
You’ll need Python 3 with Pygame Zero installed. The process for this differs a little between different computers, but there’s a good overview of all the different options on page 186 of Code the Classics.
Subscribe to HackSpace magazine for twelve months and you get a Circuit Playground Express for free! Then you can make your very own Infinite Bunner controller
Once everything’s set up, open a terminal and navigate to the directory you unzipped the code in. Then, inside that, you should find a folder called bunner-master and move into that. You can then run:
Have a few goes playing the game, and you’ll find that you need the left, right, and up arrow keys to play (there is also the down arrow, but we’ve ignored this since we’ve never actually used it in gameplay – if you’re a Frogger/Bunner aficionado, you may wish to implement this as well).
Reading the accelerometer is as easy as importing the appropriate module and running one line:
from adafruit_circuitplayground import cpx, y, z = cp.acceleration
Sending key presses is similarly easy. You can set up a keyboard with the following:
from adafruit_hid.keyboard import Keyboard
from adafruit_hid.keyboard_layout_us import KeyboardLayoutUS
from adafruit_hid.keycode import Keycode
keyboard = Keyboard(usb_hid.devices)
The only thing left is to slot in our mechanics. The X-axis on the accelerometer can determine if the controller is tilted left or right. The output is between 10 (all the way left) and -10 (all the way right). We chose to threshold it at 7 and -7 to require the user to tilt it most of the way. There’s a little bit of fuzz in the readings, especially as the user flicks the controller up, so having a high threshold helps avoid erroneous readings.
The Y-axis is for jumping. In this case, we require a ‘flap’ where the user first lifts it up (over a threshold of 5), then back down again.
The full code for our controller is:
from adafruit_circuitplayground import cp
from adafruit_hid.keyboard import Keyboard
from adafruit_hid.keyboard_layout_us import KeyboardLayoutUS
from adafruit_hid.keycode import Keycode
keyboard = Keyboard(usb_hid.devices)
jumping = 0
x, y, z = cp.acceleration
if abs(y) > 5:
if y < 5 and up:
if x < -7 :
if x < 7 : keyboard.press(Keycode.RIGHT_ARROW)
if jumping > 0:
It doesn’t take much CircuitPython to convert a microcontroller into a games controller
The final challenge we had was that there’s a bit of wobble when moving the controller around – especially when trying to jump repeatedly and quickly. After fiddling with thresholds for a while, we found that there’s a much simpler solution: increase the weight of the controller. The easiest way to do this is to place it inside a book. If you’ve ever held a copy of Code the Classics, you’ll know that it’s a fairly weighty tome. Just place the board inside and close the book around it, and all the jitter disappears.
That’s all there is to the controller. You can use it to play the game, just as you would any joypad. Start the game as usual, then start flapping the book around to get hopping.
The humble jump got a kick in 1984 with the introduction of the double jump, a physicist’s worst nightmare and one of video gaming’s most iconic moves. Subsc…
Are you looking to upgrade your computer monitor? Last week, Custom PC magazine, a publication of Raspberry Pi Press, released their latest video discussing HDR monitors. Are you ready to upgrade, and more importantly, should you?
Learn how to use a tactile button with your Raspberry Pi. They’re a great addition to any digital making project! Subscribe to our YouTube channel: http://rp…
Connect a button to Raspberry Pi
Attaching a button to your Raspberry Pi is a great way of introducing digital making into your coding experience. Use it to play music, turn lights on and off, or even shut down your device.
Follow our other How to use videos to learn how to use a servo motor, LED, and Raspberry Pi camera module with your Raspberry Pi. Try linking them together to build something grander, such as a digital camera, a robot, or a music box.
We’ve made a simpler way to image your microSD card with Raspbian, the official Raspberry Pi operating system, and other operating systems. Introducing our new imaging utility, Raspberry Pi Imager.
Simplifying the Raspberry Pi experience
For me, one of the most important aspects of the Raspberry Pi experience is trying to make it as easy as possible to get started. To this end, since launching the first Raspberry Pi, we’ve added a GUI to our operating system, a wizard to help you set up your Raspberry Pi the first time you boot it, and lots of books and magazines to get people up and running. We’ve even developed the Raspberry Pi Desktop Kit to put all the things you need (yes, Alex, I know – except for a monitor) into a single box to make it as easy as possible!
SD cards can be a bit tricky
Despite all these moves towards more simplicity, when it comes to microSD cards, programming them with your favourite Raspberry Pi operating system has always been a little bit tricky.
The main problem comes from the differences between the operating systems that people’s main computers are likely to use: Windows, macOS, and Linux all use different methods of accessing the SD card, which doesn’t help matters. And, for some new Raspberry Pi users, understanding where to find the latest up-to-date image and how to get it onto the microSD card can be a bit confusing, unless you’ve had prior experience with image-flashing tools such as Etcher.
For that reason, we’ve always suggested that you should buy a pre-loaded NOOBS SD card from your Raspberry Pi Approved Reseller.
But what if you want to re-image an existing card?
From today, Raspberry Pi users will be able to download and use the new Raspberry Pi Imager, available for Windows, macOS and Ubuntu.
The utility is simple to use and super speedy, thanks to some shortcuts we’ve introduced into the mechanics.
Firstly, Raspberry Pi Imager downloads a .JSON file from our website with a list of all current download options, ensuring you are always installing the most up-to-date version.
Once you’ve selected an operating system from the available options, the utility reads the relevant file directly from our website and writes it straight to the SD card. This speeds up the process quite considerably compared to the standard process of reading it from the website, writing it to a file on your hard drive, and then, as a separate step, reading it back from the hard drive and writing it to the SD card.
During this process, Raspberry Pi Imager also caches the downloaded operating system image – that is to say, it saves a local copy on your computer, so you can program additional SD cards without having to download the file again.
Raspberry Pi Imager is fully open source and was originally written as a modification of the PiBakery tool, later modified and finished by Floris Bos (the original writer of the NOOBS tool and the PiServer tool). You can see Floris’ other software, for data centres, here.
The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.