Raspberry Pi Blog

This is the official Raspberry Pi blog for news and updates from the Raspberry Pi Foundation, education initiatives, community projects and more!

What was your first Raspberry Pi project?

Quick and simple blog post today: what was your first Raspberry Pi project? Or, if you’ve yet to enter the world of Raspberry Pi ownership, what would you like to do with your Raspberry Pi once you get one?

Answer in the comments below, or on Twitter using #MyFirstRaspberryPi. Photos aren’t necessary, but always welcome (of the project, not of, like, you and your mates in Ibiza circa 2001).

Share your story to receive ten imaginary house points (of absolutely no practical use, but immense emotional value) and a great sense of achievement looking at how far you’ve come.

60 Comments

HackSpace’s 25 ways to use a Raspberry Pi

The latest issue of HackSpace magazine is out today, and it features a rather recognisable piece of tech on the front cover.

25 ways of using this tiny computer

From personal computing and electronic fashion to robotics and automatic fabrication, Raspberry Pi is a rather adaptable piece of kit. And whether you choose to use the new Raspberry Pi 4, or the smaller, $5 Raspberry Pi Zero, there are plenty of projects out there for even the most novice of hobbyists to get their teeth into.

This month’s HackSpace magazine, a product of Raspberry Pi Press, is packed full of some rather lovely Raspberry Pi projects, as well as the magazine’s usual features from across the maker community. So, instead of us sharing one of the features with you, as we usually do on release day, we wanted to share them all with you.

Free PDF download

Today’s new issue of HackSpace is available  as a free PDF download, and, since you’re reading this post, I imagine you’re already a Raspberry Pi fan, so it makes sense you’ll also like this magazine.

So download the free PDF (the download button is below the cover image) and let us know what you think of HackSpace magazine in the comments below.

More from HackSpace magazine

If you enjoy it and want to read more, you can get a HackSpace magazine subscription or purchase copies from Raspberry Pi Press online store, from the Raspberry Pi store, Cambridge, or from your local newsagent.

As with all our magazines, books, and hardware, every purchase of HackSpace magazine funds the charitable work of the Raspberry Pi Foundation. So if you enjoy this free PDF, please consider purchasing future issues. We’d really appreciate it.

No Comments

Citizen science traffic monitoring with Raspberry Pi

Homes in Madrid, Dublin, Cardiff, Ljubljana, and Leuven are participating in the Citizens Observing UrbaN Transport (WeCount) project, a European Commission–funded research project investigating sustainable economic growth.

1,500 Raspberry Pi traffic sensors will be distributed to homes in the five cities to gather data on traffic conditions. Every hour, the devices will upload information to publically accessible cloud storage. The team behind WeCount says:

Following this approach, we will be able to quantify local road transport (cars, heavy goods vehicles, active travel modes, and speed), produce scientific knowledge in the field of mobility and environmental pollution, and co-design informed solutions to tackle a variety of road transport challenges.

“With air pollution being blamed for 500,000 premature deaths across the continent in 2018,” states a BBC News article about the project, “the experts running the survey hope their results can be used to make cities healthier places to live.” Says the WeCount team:

[T]he project will provide cost-effective data for local authorities, at a far greater temporal and spatial scale than what would be possible in classic traffic counting campaigns, thereby opening up new opportunities for transportation policy making and research.

Find more information about the WeCount project on the BBC News website and on the the CORDIS website.

Raspberry Pi makes the ideal brain

The small form factor and low cost of Raspberry Pi mean it’s the ideal brain for citizen science projects across the globe, including our own Raspberry Pi Oracle Weather Station.

Build Your Own weather station kit assembled

While the original Oracle Weather Station programme involved only school groups from across the world, we’ve published freely accessible online guides to building your own Raspberry Pi weather station, and to uploading weather data to the Initial State platform.

Penguin Watch

Another wonderful Raspberry Pi–powered citizen science project is Penguin Watch, which asks the public to, you guessed it, watch penguins. Time-lapse footage — obtained in the Antarctic by Raspberry Pi Camera Modules connected to Raspberry Pi Zeros — is uploaded to the Penguin Watch website, and anyone in the world can go online to highlight penguins in the footage, helping the research team to monitor the penguin population in these locations.

Setting up. Credit: Alasdair Davies, ZSL

Penguin Watch is highly addictive and it’s for a great cause, so be sure to check it out.

5 Comments

TechWiser’s giant Raspberry Pi AirPod speaker (and more)

YouTube is a haven for awesome Raspberry Pi projects, and we often spend time scanning through the platform’s wares for hidden gems. One such hidden gem is this video from TechWiser, in which they showcase some of their favourite Raspberry Pi projects:

Cool Raspberry Pi 4 Projects We Use At TechWiser

Here are some of the best projects we use at TechWiser office.

From installing PiHole in the office, to upgrading a cupboard with RFID recognition for keyless entry, TechWiser has the whole ‘incorporating Raspberry Pi into everything’ thing down to a fine art.

But it’s not all just about practicality. Does anyone really need a giant Apple AirPod? No. But, does the idea of a giant Apple AirPod sound cool? You betcha!

And their YouTube button that flashes whenever they earn a new subscriber is rather lovely too. I wonder if they noticed it flash when Raspberry Pi subscribed to their channel?

TechWiser’s YouTube channel contains a plethora of Raspberry Pi and tech tutorials and reviews, and you should definitely check them out.

1 Comment

Connect your Raspberry Pi 4 to an iPad Pro

Have you ever considered attaching your Raspberry Pi 4 to an Apple iPad Pro? How would you do it, and why would you want to? Here’s YouTuber Tech Craft to explain why Raspberry Pi 4 is their favourite iPad Pro accessory, and why you may want to consider using yours in the same way.

We’ve set the video to start at Tech Craft’s explanation.

My Favourite iPad Pro Accessory: The Raspberry Pi 4

The Raspberry Pi 4 is my favourite accessory to use with the iPad Pro. In this video, learn more about what the Pi can do, what gear you need to get running with one, how to connect it to your iPad and what you’ll find it useful for.

 

Having installed Raspbian on Raspberry Pi and configured the computer to use USB-C as an Ethernet connection (read Ben Hardill’s guide to find out how to do this), Tech Craft could select it as an Ethernet device in the iPad’s Settings menu.

So why would you want to connect your Raspberry Pi 4 to your iPad? For starters, using your iPad instead of a conventional HDMI monitor will free up desk space, and also allow you to edit your code on the move. And when you’ve connected the two devices like this, you don’t need a separate power lead for Raspberry Pi, because the iPad powers the computer. So this setup is perfect for train or plane journeys, or for that moment when your robot stops working at a Raspberry Jam, or for maker conventions.

You can also use Raspberry Pi as a bridge between your iPad and portable hard drive, for disk management.

Tech Craft uses the SSH client Blink to easily connect to their Raspberry Pi via its fixed IP address, and with Juno Connect, they connect to a running Jupyter instance on their Raspberry Pi to do data science work.

For more information on using Raspberry Pi with an iPad, make sure you watch the whole video. And, because you’re a lovely person, be sure to subscribe to Tech Craft for more videos, such as this one on how to connect wirelessly to your Raspberry Pi from any computer or tablet:

Mobile Raspberry Pi with ANY iPad. No USB-C needed.

Following on my from earlier video about pairing the Raspberry Pi 4 with the iPad Pro over USB-C, this video show how to pair any iPad (or iPhone, or Android tablet) with a Pi4 or a Pi3 over WiFi.

6 Comments

Fake cases — make sure yours is the real deal

We’ve had some reports of people finding cases that pretend to be official Raspberry Pi products online — these are fakes, they’re violating our trademark, they’re not made very well, and they’re costing you and us money that would otherwise go to fund the Raspberry Pi Foundation’s charitable work. (Reminder, for those who are new to this stuff: we’re a not-for-profit, which means that every penny we makes goes to support our work in education, and that none of us gets to own a yacht.)

Making sure your accessories are legit

If you want to be certain that the Raspberry Pi accessories you buy are the real thing, make sure you’re purchasing from one of our Authorised Resellers: if you buy via our website, you’ll automatically be directed to the Authorised Resellers in your region. Lots of other vendors also sell the official case, so if you’re wondering whether yours is the real thing, we’ve found there are some easy ways to tell the difference.

A wellwisher sent us one of the fake cases (elegantly photographed by Fiacre above), which we passed around the office with a great deal of wincing, imagining what you guys might say if you got your hands on one and thought we’d made it. They’re really not very nice; the moulding’s awful, the fit’s bad, the colour’s off, and we’d be embarrassed if we had made something like this ourselves.

Asking the experts

We thought we’d ask the good people at T-Zero, who did all the work on the tooling and injection moulding for the real case (which is a considerably harder job than we’d imagined at first — you can read about the very bumpy road we had before finding T-Zero, who are amazing partners, in this post from days of yore), why the fake cases look so hideous. Simon Oliver, Grand Poobah of Plastics, wrote back:

Basically, what you are witnessing is very cheaply and quickly made tooling. The flash is just poor toolmaking. The rounded edges are due to the toolmaking method of milling everything, which is quick and cheap, but you can’t get definition of sharp corners because you have to have a radius in places. I have tried to explain it below, and you have to think in reverse for the tool.

Milling artifacts

Can you imagine how many electrodes are needed for the logo? The leaves around the top have to be laser-cut into an electrode to get the definition. See screen grabs of the tool and moulding — look how many sharp corners there are!

CAD representations of logo and tool

To properly make a tool for something this complicated, you need more electrodes than someone quickly copying a case like this would find economical. The official Raspberry Pi case needed 140 electrodes to produce the tool.

Electrodes

A few of the electrodes that went to make the injection moulding tool for the official case

 

Reverse-engineering by digitising existing components in a CAD will also loose definition, particularly in sharp corners, as the moulding process will form a small radius even if the tool is a sharp corner.

Plastic shrinks away from a 90 degree corner, leaving a smallish radius in any case. So your data from digitising will have a radius, and then [the producers] compound it by milling the lot.

Finally, the colour is off! It took ages to get your Raspberry Pi red correct. A lot of suppliers can’t repeat it; the current supplier had five attempts!

Thanks, Simon; and to everybody reading this, we hope it arms you with the confidence to make sure you’re buying a genuine product!

FYI

Before panic ensues, please note: we love third-party cases designed for Raspberry Pi. So much so that we sell a few of them in our store here in Cambridge.

The internet is full of innovative cases you can purchase, as well as wonderful 3D-printable alternatives you can make yourself, and as long as they aren’t breaking any trademark rules — using our logo, copying the work of others, pretending to be official when they’re not — that’s great!

If you’ve designed a case for any of the Raspberry Pi models, share it with us in the comments below, as we’d love to see your work. And if you see a case, or any other Raspberry Pi accessory, for sale that you think is breaking trademark rules or attempting to imitate our official products, please let us know.

32 Comments

Code a Boulder Dash mining game | Wireframe #30

Learn how to code a simple Boulder Dash homage in Python and Pygame. Mark Vanstone shows you how. 

The original Boulder Dash was marked out by some devious level design, which threatened to squash the player at every turn.

Boulder Dash

Boulder Dash first appeared in 1984 for the Commodore 64, Apple II, and the Atari 400/800. It featured an energetic gem collector called Rockford who, thanks to some rather low-resolution graphics, looked a bit like an alien. His mission was to tunnel his way through a series of caves to find gems while avoiding falling rocks dislodged by his digging. Deadly creatures also inhabited the caves which, if destroyed by dropping rocks on them, turned into gems for Rockford to collect.

The ingenious level designs were what made Boulder Dash so addictive. Gems had to be collected within a time limit to unlock the exit, but some were positioned in places that would need planning to get to, often using the physics of falling boulders to block or clear areas. Of course, the puzzles got increasingly tough as the levels progressed.

Written by Peter Liepa and Chris Gray, Boulder Dash was published by First Star Software, which still puts out new versions of the game to this day. Due to its original success, Boulder Dash was ported to all kinds of platforms, and the years since have seen no fewer than 20 new iterations of Boulder Dash, and a fair few clones, too.

Our homage to Boulder Dash running in Pygame Zero. Dig through the caves to find gems – while avoiding death from above.

Making Boulder Dash in Python

We’re going to have a look at the boulder physics aspect of the game, and make a simple level where Rockford can dig out some gems and hopefully not get flattened under an avalanche of rocks. Writing our code in Pygame Zero, we’ll automatically create an 800 by 600-size window to work with. We can make our game screen by defining a two-dimensional list, which, in this case, we will fill with soil squares and randomly position the rocks and gems.

Each location in the list matrix will have a name: either wall for the outside boundary, soil for the diggable stuff, rock for a round, moveable boulder, gem for a collectable item, and finally, rockford to symbolise our hero. We can also define an Actor for Rockford, as this will make things like switching images and tracking other properties easier.

Here’s Mark’s code, which gets an homage to Boulder Dash running in Python. To get it working on your system, you’ll first need to install Pygame Zero. And to download the full code, go here.

Our draw() function is just a nested loop to iterate through the list matrix and blit to the screen whatever is indicated in each square. The Rockford Actor is then drawn over the top. We can also keep a count of how many gems have been collected and provide a congratulatory message if all of them are found. In the update() function, there are only two things we really need to worry about: the first being to check for keypresses from the player and move Rockford accordingly, and the second to check rocks to see if they need to move.

Rockford is quite easy to test for movement, as he can only move onto an empty square – a soil square or a gem square. It’s also possible for him to push a boulder if there’s an empty space on the other side. For the boulders, we need to first test if there’s an empty space below it, and if so, the boulder must move downwards. We also test to see if a boulder is on top of another boulder – if it is, the top boulder can roll off and down onto a space either to the left or the right of the one beneath.
There’s not much to add to this snippet of code to turn it into a playable game of Boulder Dash. See if you can add a timer, some monsters, and, of course, some puzzles for players to solve on each level.

Testing for movement

An important thing to notice about the process of scanning through the list matrix to test for boulder movement is that we need to read the list from the bottom upwards; otherwise, because the boulders move downwards, we may end up testing a boulder multiple times if we test from the beginning to the end of the list. Similarly, if we read the list matrix from the top down, we may end up moving a boulder down and then when reading the next row, coming across the same one again, and moving it a second time.

Get your copy of Wireframe issue 30

You can read more features like this one in Wireframe issue 30, available now at Tesco, WHSmith, all good independent UK newsagents, and the Raspberry Pi Store, Cambridge.

Or you can buy Wireframe directly from Raspberry Pi Press — delivery is available worldwide. And if you’d like a handy digital version of the magazine, you can also download issue 30 for free in PDF format.

Make sure to follow Wireframe on Twitter and Facebook for updates and exclusive offers and giveaways. Subscribe on the Wireframe website to save up to 49% compared to newsstand pricing!

2 Comments

Protect your veggies from hail with a Raspberry Pi Zero W

Tired of losing vegetable crops to frequent summertime hail storms, Nick Rogness decided to build something to protect them. And the result is brilliant!

Digital Garden with hail protection

Tired of getting your garden destroyed by hail storms? I was, so I did something about it…maker style!

“I live in a part of the country where hail and severe weather are commonplace during the summer months,” Nick explains in his Hackster tutorial. “I was getting frustrated every year when my wife’s garden was get demolished by the nightly hail storms losing our entire haul of vegetable goodies!”

Nick drew up plans for a solution to his hail problem, incorporating liner actuators bolted to a 12ft × 12ft frame that surrounds the vegetable patch. When a storm is on the horizon, the actuators pull a heavy-duty tarp over the garden.

Nick connected two motor controllers to a Raspberry Pi Zero W. The Raspberry Pi then controls the actuators to pull the tarp, either when a manual rocker switch is flipped or when it’s told to do so via weather-controlled software.

“Software control of the garden was accomplished by using a Raspberry Pi and MQTT to communicate via Adafruit IO to reach the mobile app on my phone,” Nick explains. The whole build is powered by a 12V Marine deep-cycle battery that’s charged using a solar panel.

You can view the full tutorial on Hackster, including the code for the project.

3 Comments

Can algorithms be unethical?

At Raspberry Pi, we’re interested in all things to do with technology, from building new tools and helping people teach computing, to researching how young people learn to create with technology and thinking about the role tech plays in our lives and society. One of the aspects of technology I myself have been thinking about recently is algorithms.

An illustration of a desktop computer above which 5 icons are shown for privacy, culture, law, environment, and ethics

Technology impacts our lives at the level of privacy, culture, law, environment, and ethics.

All kinds of algorithms — set series of repeatable steps that computers follow to perform a task — are running in the background of our lives. Some we recognise and interact with every day, such as online search engines or navigation systems; others operate unseen and are rarely directly experienced. We let algorithms make decisions that impact our lives in both large and small ways. As such, I think we need to consider the ethics behind them.

We need to talk about ethics

Ethics are rules of conduct that are recognised as acceptable or good by society. It’s easier to discuss the ethics of a specific algorithm than to talk about ethics of algorithms as a whole. Nevertheless, it is important that we have these conversations, especially because people often see computers as ‘magic boxes’: you push a button and something magically comes out of the box, without any possibility of human influence over what that output is. This view puts power solely in the hands of the creators of the computing technology you’re using, and it isn’t guaranteed that these people have your best interests at heart or are motivated to behave ethically when designing the technology.

An icon with the word 'stakeholders' below it

Who creates the algorithms you use, and what are their motivations?

You should be critical of the output algorithms deliver to you, and if you have questions about possible flaws in an algorithm, you should not discount these as mere worries. Such questions could include:

  • Algorithms that make decisions have to use data to inform their choices. Are the data sets they use to make these decisions ethical and reliable?
  • Running an algorithm time and time again means applying the same approach time and time again. When dealing with societal problems, is there a single approach that will work successfully every time?

Below, I give two concrete examples to show where ethics come into the creation and use of algorithms. If you know other examples (or counter-examples, feel free to disagree with me), please share them in the comments.

Algorithms can be biased

Part of the ‘magic box’ mental model is the idea that computers are cold instructions followers that cannot think for themselves — so how can they be biased?

Humans aren’t born biased: we learn biases alongside everything else, as we watch the way our family and other people close to us interact with the world. Algorithms acquire biases in the same way: the developers who create them might inadvertently add their own biases.

An illustration of four people using smartphones

Humans can be biased, and therefore the algorithms they create can be biased too.

An example of this is a gang violence data analysis tool that the Met Police in London launched in 2012. Called the gang matrix, the tool held the personal information of over 300 individuals. 72% of the individuals on the matrix were non-white, and some had never committed a violent crime. In response to this, Amnesty International filed a complaint stating that the makeup of the gang matrix was influenced by police officers disproportionately labelling crimes committed by non-white individuals as gang-related.

Who curates the content we consume?

We live in a content-rich society: there is much, much more online content than one person could possibly take in. Almost every piece of content we consume is selected by algorithms; the music you listen to, the videos you watch, the articles you read, and even the products you buy.

An illustration of a phone screen showing an invented tweet asking where people get their news from

Some of you may have experienced a week in January of 2012 in which you saw a lot of either cute kittens or sad images on Facebook; if so, you may have been involved in a global social experiment that Facebook engineers performed on 600,000 of its users without their consent. Some of these users were shown overwhelmingly positive content, and others overwhelmingly negative content. The Facebook engineers monitored the users’ actions to gage how they responded. Was this experiment ethical?

In order to select content that is attractive to you, content algorithms observe the choices you make and the content you consume. The most effective algorithms give you more of the same content, with slight variation. How does this impact our beliefs and views? How do we broaden our horizons?

Why trust algorithms at all then?

People generally don’t like making decisions; almost everyone knows the discomfort of indecision. In addition, emotions have a huge effect on the decisions humans make moment to moment. Algorithms on the other hand aren’t impacted by emotions, and they can’t be indecisive.

While algorithms are not immune to bias, in general they are way less susceptible to it than humans. And if a bias is identified in an algorithm, an engineer can remove the bias by editing the algorithm or changing the dataset the algorithm uses. The same cannot be said for human biases, which are often deeply ingrained and widespread in society.

An icon showing a phone screen with an internet browser symbol

As is true for all technology, algorithms can create new problems as well as solve existing problems.

That’s why there are more and less appropriate areas for algorithms to operate in. For example, using algorithms in policing is almost always a bad idea, as the data involved is recorded by humans and is very subjective. In objective, data-driven fields, on the other hand, algorithms have been employed very successfully, such as diagnostic algorithms in medicine.

Algorithms in your life

I would love to hear what you think: this conversation requires as many views as possible to be productive. Share your thoughts on the topic in the comments! Here are some more questions to get you thinking:

  • What algorithms do you interact with every day?
  • How large are the decisions you allow algorithms to make?
  • Are there algorithms you absolutely do not trust?
  • What do you think would happen if we let algorithms decide everything?

Feel free to respond to other people’s comments and discuss the points they raise.

The ethics of algorithms is one of the topics for which we offer you a discussion forum on our free online course Impact of Technology. The course also covers how to facilitate classroom discussions about technology — if you’re an educator teaching computing or computer science, it is a great resource for you!

The Impact of Technology online course is one of many courses developed by us with support from Google.

19 Comments

How to control multiple servo motors with Raspberry Pi

In the latest Explaining Computers video, Christopher Barnatt explains how to use servo motors with Raspberry Pi. Using servos is a great introduction to the digital making side of computing; servos allow you to control the movement of all manner of project components with your Raspberry Pi and a motor controller attached to its GPIO pins.

Raspberry Pi Servo Motor Control

Control of SG90 servos in Python on a Raspberry Pi, including an explanation of PWM and how a servo differs from a motor. You can download the code from the video at: https://www.explainingcomputers.com/pi_servos_video.html The five-pack of SG90 servos used in this video was purchased on Amazon.co.uk here: https://www.amazon.co.uk/dp/B07H9VC698/ref=nosim?tag=explainin-21 with a similar product on Amazon.com here: https://amzn.to/2QHshx3 (affiliate links).

Servos and your Raspberry Pi

Christopher picked up his SG90 servo motors online, where you’ll find a variety of servo options. What type of servo you need depends on the project you want to create, so be sure to consider the weight and size of what you plan to move, and the speed at which you need to move it.

As the motor controller connects via GPIO, you can even use the tiny £5 Raspberry Pi Zero to control your servo, which makes adding movement to your projects an option even when you’re under tight space constraints.

Find out more

For other detailed computing videos, be sure to subscribe to the Explaining Computers YouTube channel.

And for more Raspberry Pi projects, check out the Raspberry Pi projects page.

Raspberry Pi projects PSA

We’re always looking for people to join our incredible community of translators to help us translate our free resources, including the free projects found on our projects page.

If you speak English and another language and would like to give a portion of your time to making our resources available to more people across the globe, sign up as a translator today.

No Comments