Scratch 3 Desktop for Raspberry Pi OS on Raspberry Pi

You can now install and use Scratch 3 Desktop for Raspberry Pi OS on your Raspberry Pi!

Scratch 3

Scratch 3 was released in January this year, and since then we and the Scratch team have put lots of work into creating an offline version for Raspberry Pi.

The new version of Scratch has a significantly improved interface and better functionality compared to previous versions. These improvements come at the cost of needing more processing power to run. Luckily, Raspberry Pi 4 has delivered just that, and with the software improvements in the newest version of Raspberry Pi OS, Buster, we can now deliver a reliable Scratch 3 experience on our computer.

Coding for kids in Scratch

Your kids can learn to code in Scratch with our free learning paths. These paths guide them to make fun projects and gain independence as coders and makers.

An illustration of Scratch coding.

Scratch and electronics with a Raspberry Pi computer

If you think your kids would like to learn how to build physical projects they can program in Scratch, then take a look at our Physical computing with Scratch and Raspberry Pi path. In these six projects, your young people will learn how to use Scratch on a Raspberry Pi computer to control LEDs, buttons, and buzzers to make interactive games, displays, and instruments.

Which Raspberry Pi can I use?

Scratch 3 needs at least 1GB of RAM to run, and we recommend a Raspberry Pi 4 with at least 2GB RAM. While you can run Scratch 3 on a Raspberry Pi 2, 3, 3B+, or a Raspberry 4 with 1GB RAM, performance on these models is reduced, and depending on what other software you run at the same time, Scratch 3 may fail to start due to lack of memory.

The Scratch team is working to reduce the memory requirements of Scratch 3, so we will hopefully see improvements to this soon.

How to install Scratch 3

You can only install Scratch 3 on Raspbian Buster and on newer Raspberry Pi OS versions.

First, update Raspberry Pi OS!

  • If you’ve yet to upgrade to Raspbian Buster, we recommend installing a fresh version of Raspberry Pi OS onto your SD card instead of upgrading from your current version.
  • If you’re already using Raspberry Pi OS, but you’re not sure your running the latest version, update your OS by following this tutorial:

Once you’re running the latest version of Raspberry Pi OS, you can install Scratch 3 either using the Recommended Software application or apt on the terminal.

How to install Scratch 3 using the Recommended Software app

Open up the menu, click on Preferences > Recommended Software, and then select Scratch 3 and click on OK.

How to install Scratch 3 using the terminal

Open a terminal window, and type in and run the following commands:

sudo apt-get update
sudo apt-get install scratch3

What can I do with Scratch 3 and Raspberry Pi?

Scratch 3 Desktop for Raspbian comes with new extensions to allow you to control the GPIO pins and Sense HAT with Scratch code!

GPIO extension

GPIO extension is a replacement for the existing extension in Scratch 2. Its layout and functionality is very similar, so you can use it as a drop-in replacement.

The GPIO extension gives you the flexibility to connect and control a whole host of electronic devices.

Simple Electronics extension

If you are looking to add something simple, like an LED or button controller for a game, you should find the new Simple Electronics extension easier to use than the GPIO extension. The Simple Electronics extension is the first version of a beginner-friendly extension for interacting with Raspberry Pi’s GPIO pins. Taking lessons from the implementation of gpiozero for Python, this new extension provides a simpler way of using electronic components: currently buttons and LEDs.

In this example, an LED connected to GPIO pin 17 is controlled by a button connected between pin 2 and GND.

Sense HAT extension

We’ve improved the Sense HAT extension to take advantage of new features in Scratch 3, and the updated version of the extension also introduces a number of new blocks to allow you to:

  • Sense tilting, shaking, and orientation
  • Use the joystick
  • Measure temperature, pressure, and humidity
  • Display text, characters, and patterns on the LED matrix

micro:bit and LEGO extensions

The micro:bit and LEGO extensions will become available later on Scratch 3 Desktop. This is because Scratch Link, the software which allows Scratch to talk to Bluetooth devices, is not yet available for Linux-type operating systems like Raspbian. A version of Scratch Link for Raspbian is part of our plans but, as yet, we don’t have a release date.

A round of thanks

It has been a long ambition of both the Scratch and Raspberry Pi teams to have Scratch 3 running on Raspberry Pi, and it’s amazing to see it released!

A big thank you to Raspberry Pi engineer Simon Long for building and packaging Scratch 3, and to the Scratch team for their support in getting over some of the problems we faced along the way.

30 comments

Avatar

Yay!

Avatar

I would love to see some YouTube videos showcasing how Scratch programs can be written which incorporate things like a gamepad, and the Sense HAT. Showing this hardware and the software working together to create something fun on the screen would really make some light bulbs light up over the heads of the kids, as to the creative sorts of things kids can make with it.

Avatar

I use JoyDivision joystick adapter that converts from a Commodore 64/Atari joystick to USB. Now I can use it in Scratch 3, Scratch 2, and Scratch 1.4 (NuScratch) on Raspberry Pi 4 B (4GB RAM) with:
joy2key “Scratch Desktop” -X -dev /dev/input/js0 -buttons f -axis a d w s -thresh -9 9 -9 9

joy2key “Scratch 2” -X -dev /dev/input/js0 -buttons f -axis a d w s -thresh -9 9 -9 9

joy2key “Scratch 1.4 (NuScratch) of 2016-12-12” -X -dev /dev/input/js0 -buttons f -axis a d w s -thresh -9 9 -9 9

respectively.

Then the joystick sends keys wasd for directions and f for fire.

First you have to install jstest-gtk and joy2key. Run jstest-gtk to test the joystick/gamepad.

Avatar

Is it running in a chromium window?

Martin O'Hanlon

The Scratch 3 Desktop runs in Electron. You can of course if your online open up chromium and open Scratch 3 at https://scratch.mit.edu.

Avatar

Fabulous. I’ll get it set up on the Pi4 over the weekend and see if I can come up with something cool before next weekend’s conference.

Thanks for all the efforts to get this working.

Avatar

Fantastic that it is fully(?) translated in so many languages, including my native Nederlands, which will make it much easier for children to use it.

Avatar

Unfortunately it isn’t yet “fully” translated. The core Scratch blocks are all translated, but translation doesn’t yet work for the blocks in the extensions (so the GPIO, SenseHAT and basic electronics blocks).

MIT are aware of the issue, so hopefully it will be sorted in a future release.

Avatar

1. Well done. :)

2. If you’re not sure about your buster version and you want to upgrade, you might want to use

sudo apt update instead of sudo apt-get update

https://www.raspberrypi.org/forums/viewtopic.php?f=91&t=245022

Avatar

A great way to learn to program, would be that Scratch was “translating” his commands to another type of code. Python, C ++, Java or others.
That’s how I learned HTML with Office 97 at the time.

Avatar

I believe that’s something that https://developers.google.com/blockly/ offers.

Avatar

Is there a downloadable version of Blockly. We teach kids to code using Raspberry Pi’s Scratch and Python. For safety reasons we keep the younger kids off the internet so we need to be able to download everything.

I was excited about Scratch 3 but that is going to require us to upgrade all our Pi’s and that was not in the budget for this year.

Avatar

on rasberry pi programming was aewsome because i was programming something super big and it was cool

Avatar

Hi – the colour picker in the sense hat extension is really good, but I’d also like to map R,G,B colour values in variables onto pixels and it’s not quite so obvious how the colour values are mapped.

I’ve managed to get random colours, but I’m not quite sure of the range of values (tried 0 – 255^3 which seemed to work).

Could someone explain please.

Avatar

I think I just figured it out. Grrstvthat you can use a # in a variable to enter a hexadecimal HTML colour value.

Avatar

This i great! I had almost given up since Scratch 3 would not even work online with Chromium on my Pi 3B+.

At least Scratch 3 online works with my new Pi 4B. I have the offline version installed now. Now to see how it compares with the online version…

When I get a chance I will try the offline version of Scratch 3 on my Pi 3B+. Good timing since I upgraded it to Buster last week.

Avatar

The offline version of Scratch 3 is very marginal to run in the 1GB of RAM on the 3B+; to work reliably, it needs more than 1GB of RAM, so we recommend using a Pi 4 rather than a Pi 3.

It can work on a Pi 3, but it randomly fails to start properly depending on how much memory is being used by other system processes.

Avatar

good job, brilliant

Avatar

Amazing job! My students and I have been waiting for this, great news all around!
Is anyone else having problem initialising it? The Window opens normally but right after “Scratch Desktop is loading …” it goes blank and stays like that. I had to close it down and reopen a couple of times to get it working.
I’m running it on a RPi 3B+ and Raspbian Buster

Avatar

As said above, Scratch 3 really requires more than the 1GB of RAM available on the Pi 3B+; it will only run reliably on a Pi 4. The blank screen on startup is an indication that Scratch doesn’t have enough memory to launch.

Avatar

Just for the record, after downloading and installing latest Raspbian and doing normal updates, I still had to follow the instructions in the video to get Scratch 3 to come up as an option in Recommended Software.

Avatar

Awesome !!
My Pi 3B+ w/MPI3508 touch display becomes nice scratch machine.

Thanks your work.

Avatar

Smart choice not to embed Scratch3 within latest Buster distribution for RPI, since would not work properly unless hardware were RPI4B /2Gb, 4Gb RAM…
I bet many people would be upset when trying to use it on older platforms not reading previously the min. recommendations.

Avatar

Performance probably won’t be the best for me, since my only Pi is a model 3B… oh well. I’m updating Raspbian right now and will install Scratch 3 after!

Avatar

Brilliant work, Thanks.
Will we be notified if the extension for Scratch and micro:bit becomes available for the Pi4. I really love this toy and would love to implement the Pi as a mini PC where you can use scratch 3 to code your micro:bit in an offline environment.

Avatar

It can’t be installed on Pi4

Avatar

Where is the source?

Avatar

Hi, any update on when Scratch Link might become available for the Pi so I can use Lego Wedo 2?

Many thanks

Jon Chip

Avatar

I’m wondering if it’s possible to run scratch on my PC and control gpio on my raspberry pi remotely. This way the speed of scratch would be much faster. It’s even better if the extension works with online version.

Avatar

I have a RPi 3B (not 3B+) running Buster (4.19) and I tried to follow the instructions to get Sctach3 offline, but even after running
>sudo apt update
>sudo apt-get update
>sudo apt-get dist-upgrade
when I run “sudo apt-get install scratch3” I get the error “Unable to locate package scratch3”. Anyone know why we can’t get offline scratch 3??

Leave a Comment

Comments are closed