ScratchGPIO5 – Installing

Installing ScratchGPIO5 software on a Raspberry Pi

  • With Raspberry Pi connected to Internet

Copy the text below ( left click just before the s of sudo and drag right until all the text in the line as been selected) then right-click and select copy. Open up an LX Terminal window and select Edit and the Paste that into an LX Terminal window and run it to download the installer.

sudo wget -O

(If there is a problem try this link instead)

sudo wget -O

Once the installer has been downloaded then just type (or copy and paste the text below as before)

sudo bash

(If logged in as a different user to standard pi, then type sudo bash yourusername) This will install all the necessary extra software and some simple examples.

  • With Raspberry Pi not connected to Internet.

Power down you Pi and put the SD card into another computer and download this file

and copy it to your SD card.

Put the card back into your Pi and then open up an LX Terminal windowtype the following

sudo bash /boot/

(If logged in as a different user to standard pi, then type sudo bash /boot/install_scratchgpio5.shΒ yourusername) This will install all the necessary extra software and some simple examples.

The installer will create 2 desktop icons – ScratchGPIO5 which is used for beginners using simple circuits and ScratchGPIO 5Plus which is used with specific add-on boards.

Continue onto 1st Project

64 thoughts on “ScratchGPIO5 – Installing

    • No – just a roll-up of all the extra add-on board support plus change back to 11,12,13,15,16 and 18 as default outputs and 7 and 22 default inputs with pull-up resistors enabled.

      • Hi I have tried to get scratch gpio 5 with your instructions and i fails and I don’t understand why I have the latest raspbian installed fresh to see if that helps on a raspberry pi b with a 32gb sd and loaded in raspbian to desktop tried copy paste text in lx and copy straight to sd and still got no where tried different raspberry pi s tried different sd s please help me as I think it must be simple but I just can’t do it please help

      • OK
        When you do the sudo bash does it look like it installs OK?
        Do you see any new icons on your desktop?
        If you go into lx terminal and CD scratchgpio5 does folder exist?
        Does ls give you a list of files?

    • Sorry about that – wrong link and instructions weren’t right either!
      This is the link for downloading via other computer to SD Card
      then stick it back in your Pi and open up LX Terminal and type
      sudo bash /boot/

  1. Hi Simon
    Now that version 5 is available, do we have to remove the earlier version of GPIO before installing version 5.
    Thanks for all your hard work on the software.
    By the way what does BYOB stand for?

  2. Hello Simon,

    Thank you for all your amazing work to make GPIO control so easy in Scratch! I’ve volunteered some time at my kids school in the past to lead Scratch game making lessons. Next week we’ll try making some simple ‘robots’. It’s going to be fun!

    This isn’t a feature request… I’m just curious whether there’s an existing way to use your Scratch GPIO tool to read a photocell light sensor similar to the following link:

    Many thanks from Toronto!

  3. Using the first line above (sudo wget -O
    Gives the following error 😦

    GnuTLS: A TLS warning alert has been received.
    Unable to establish SSL connection.

    This is an issue with my RPi rather than your link.
    Any clues to the cure? πŸ™‚

  4. Pibrella. Just ordered a PiDie too πŸ™‚
    All LED’s working fine but not got the hang of the switch input yet πŸ˜‰

  5. I downloaded and installed this fine but when I want to use the sensor value black only has these values


    and it doesn’t show any of the pins

    • oops – sorry about that – i left some code commented out – please re-download and it should be OK now – thanks for reporting it πŸ™‚

      • I have exactly the same problem as Erika Y even though I only downloaded last week (27 Jun).
        I have a basic single LED on P11 and can run the Python script fine using a terminal session and “sudo python” and this flashes the LED.

        When I run scratchgpio5 from the desktop icon, I get the message “Remote Sensor Connections Enabled”, click “OK” but the sensor values only list the same as Erika Y – no pins are shown – and when I load and run the blink11 scratch program, nothing happens!

        I have tried running scratch first then run the python script from a terminal, scratch doesn’t do anything but the python script works then tried the python prog first then scratch but still nothing from scratch!

        What could be going wrong?

      • Just to aid debugging – re-download and install – see what happens πŸ™‚
        Then if it doesn’t work
        open up LX terminal and run
        cd /scratchgpio5
        sudo python
        The python prog should start and sit there complaining that it can’t connect to Scratch.
        Launch NORMAL PLAIN Scratch and open up rsc file.
        Go back to LX Terminal window and see if any error is being reported.
        report back to me please


      • I have the same problem as Erkia Y and TimH. Accordingly to your suggestions I re-installed everything, started scratchgpio_handler5 and got the following error: “I couldn’t find a Mesh session at host:, port: 42001”

        Do you have any idea what goes wrong?


        i had this working good using python until
        i did this ( sudo apt-get update). and then this
        ( sudo apt-get upgrad )
        i can trigger the relays manualy useing this in the LXTerminal
        gpio -g mode 25 out
        gpio -g mode 17 out
        gpio -g mode 27 out
        gpio -g mode 22 out
        gpio -g mode 23 out
        gpio -g mode 24 out
        gpio -g write 25 1
        gpio -g write 17 1
        gpio -g write 27 1
        gpio -g write 22 1
        gpio -g write 23 1
        gpio -g write 24 1
        gpio -g write 25 0
        gpio -g write 17 0
        gpio -g write 27 0
        gpio -g write 22 0
        gpio -g write 23 0
        gpio -g write 24 0
        GPIO cleanup()

        but I cant get python to run my scripts?

  6. Hi Simon,
    love what you’ve done.
    I’m looking to use the PiRoConB. I can get it to run via VNC, but was wondering if it might be a bit less CPU intensive it was run via -X windows forwarding. I followed the advice on Meltwaters site (removed -xshm and ran it as a shell script) but this didn’t work with scratchGPIO5plus.
    Any ideas?
    If not I’ll just keep using VNC



  7. First, ScratchGPIO is wonderful. Thank you for all of your work on this. My son and I bought a Pi (model B) this summer for a fun project. We have been working on some basic python scripts and scratch programming. We are just now getting into the GPIO pins (LED lights, etc.).

    We ran into a slight snag while working on the “Sweet Shop Reaction Game” found on the site:

    At one point, the game calls for us to add the sensing block “sensor value” in ScratchGPIO and, using the drop-down menu on the block, change slider to pin3. However, pin3 is not listed in the drop-down menu on the sensor block. Our drop-down looks like this:


    I think that pins 3 and 5 should also be listed with the other pins. After trying to re-download/install ScratchGPIO5 and still having no luck getting the pins to show up, I downloaded the GPIO testing utility from WiringPi:

    According to the pin test, the pins on the Pi are OK. Am I doing something wrong? Should this list include pins 3 and 5?

    Thank you for any assistance!

    • Sorry about that – I occidentally deleted a file but luckily Github really hels out when you do daft things like that
      Try again – it should be OK now


  8. Successfully executed first two commands. I downloaded Pthh62 to SD card on separate computer, copied to SD card root. After typing command “sudo bash /boot/” get error message “bash: /boot/ No such file on directory.” ScratchGPIO5 works with blink11, ScratchGPIO5 Plus doesn’t. Suspect copying Pthh62 to wrong place. Appreciate your thoughts.

  9. I have successfully downloaded but when I sudo bash I get the following error message: line 1: syntax error near unexpected token `newline’ line 1: `’

    Is it me?? Help please!

      • I re-tried the original command sudo wget -O later the same day and eventually it worked.

        I wondered if the Pi was having a problem differentiating between backticks and apostrophes in line1.

        However, as I said after redoing exactly the same command, on the same pi, a few times, eventually it worked! I put it down to the idiosyncrasies of the Pi, or you updating the code that afternoon!

        We are now happily using Scratch GPIO on the RaspPi with our Year 7 and 8 pupils.
        Thanks so much for your great program.

  10. Scratch GPIO6 Help Please…


    First, thank you for all the great work you’ve done making GPIO control so easy in Scratch! My kids and I have had fun building simple robots with your code.

    We wanted to try adding servo motor control and downloaded GPIO6alpha to test this. We were looking forward to some robot arm waving.

    The servo didn’t respond so we started simplifying our project back to simpler LED on/off control. This wouldn’t work either. When we ran the script from the terminal, the LED would blink on and off, but when we ran blink11 in ScratchGPIO6alpha the LED stays off. If we run blink11 in Scratch GPIO5 with the same circuit connected the LED blinks as expected. The GPIO wiring connections seem to have the 3V and 5V and GND signals working properly but the programmable pins stay off even when we try to turn them all on with the GPIO6 code. With GPIO5 we can control pins, LEDs and motors fine.

    I’ve tried a fresh re-install of the OS and have tried re-booting and re-downloading but always have this problem.

    Appreciate any suggestions as to how I might get ScratchGPIO6 or some other form of servo control working from Scratch.

    Thanks again for all your terrific work! It’s much appreciated!


  11. I found that sudo wget worked better for me than removing the SD card and copying to the card. Manually copying makes it hard to put the file in the correct directory. By running wget from the boot directory everything just falls into place and you do not need to monkey around with the SD card and your PC.

  12. I’m having a problem with v5, v7, and what ever version came with my pi 2. I’m learning to program and the graphical interface is much easier for me so i love the program. I made the “Robot” circuit and when i run the script the sound plays and the light blinks and then the scratch program shutsdown and i have to restart the program again to run the script again. Any ideas on how to fix it or what is going wrong?

  13. Is there a current list of available and compatible addon boards that work with raspberry pi 2b and scratch. Anything like the Adafruit 16 channel pwm servo hat? or RasPirobot3. Most of the supported boards I see listed,I cant find in the US. Thanks for the hard work.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s