S4A interacts with Arduino by sending the actuator states and receiving sensor states every 75 ms, therefore the pulse width needs to be greater than this time period. The data exchange follows the PicoBoard protocol and needs a specific program (firmware) to be installed in the board. Please refer to the Downloads section for further instructions on how to do so.

Take in account that this compatibility doesn't work both ways, so you won't be able to open an S4A project from within the original Scratch .

S4A is backwards compatible with Scratch , so you can open Scratch projects in it. However, you won't be able to share your projects on the Scratch community website because doing so goes against the Scratch terms of use.

S4A allows you to control as many boards as USB ports you have.

You can manage a board wirelessly by attaching an RF module to it, such as Xbee.

Components have to be connected in a particular way. S4A allows for 6 analog inputs (analog pins), 2 digital inputs (digital pins 2 and 3), 3 analog outputs (digital pins 5, 6 and 9), 3 digital outputs (pins 10, 11 and 13) and 4 special outputs to connect Parallax continuous rotation servomotors (digital pins 4, 7, 8 and 12).

S4A works with Arduino Diecimila, Duemilanove and Uno. Other boards haven't been tested, but they may also work.

It is possible to connect to multiple boards at the same time by just adding a new Arduino sprite.

In S4A, an Arduino board is represented by a special kind of sprite. The Arduino sprite will automatically find the usb port where the board is connected.

Arduino objects offer blocks for the basic microcontroller functionalities, analog and digital writes and reads, and also for higher level ones. You can find blocks to manage standard and continuous rotation servomotors:

The main aim of the project is attracting people to the programming world. The goal is also to provide a high level interface to Arduino programmers with functionalities such as interacting with a set of boards through user events.

S4A is a Scratch modification that allows for simple programming of the Arduino open source hardware platform. It provides new blocks for managing sensors and actuators connected to Arduino . There is also a sensors report board similar to the PicoBoard one.

If you wish to help us continue developing and maintaining this project, you can always make a donation!

Our main purpose was to provide an easy way to interact with the real world by taking advantage of the ease of use of Scratch .

Scratch for Arduino (S4A) is a modified version of Scratch , ready to interact with Arduino boards. It was developed in 2010 by the Citilab Smalltalk Team and it has been used since by many people in a lot of differents projects around the world.

This video serves as an introduction for the S4A workshops given at Citilab , but you'll find a couple of demos of what can be achieved with our software.

A robot with a rotative camera, distance sensors and a remote control. It uses two arduino boards (remote control + robot), an XBee wireless module, three IR sensors, a camera module and three servomotors.

Some of the following demos are in Catalan or Spanish, but the images pretty much speak for themselves. Some of the videos have English subtitles as well.

Here you'll find basic S4A examples, complete with the Arduino schematics and an .sb Scratch project file for you to download.

These materials were created and used by our team in an actual S4A course at the Elisava School of Design (Barcelona) in 2011.

If you want to see the HTTP API in action, you can do so from our test webapp:

You will first need to enable the remote sensors option in S4A (right click on any "Sensors" block).

The Android application uses a very simple protocol we developed on top of the Scratch HTTP message protocol, so it is also possible to interact to S4A from a browser or any other network enabled application.

Both S4A as HiS4A must be connected to the same local network!

We have developed a simple Android application that can communicate with S4A through HTTP by means of the remote sensors protocol in Scratch . You can download it here or by scanning the QR code below:

Since our VPS provider may sometimes be down, we've set up an alternative location for all files, including old versions:

However, in the final user version some code has been compiled and you'll be missing several variable and message argument names, which is why we are also providing you with a clean source code image for developers, downloadable here:

Since Scratch is actually a Squeak Smalltalk image, all of its code is actually shipped with the final user version itself. To access it, just shift + left click on the S4A "File" menu and select "Exit User Mode". You're now in front of a classic Squeak 2.8 image, and have access to a Browser, Workspace and all tools you're used to.

If you are a Microsoft Windows user, you may need to install the Arduino drivers into your computer:

This firmware is a piece of software you need to install into your Arduino board to be able to communicate with it from S4A.

S4A works in the three major consumer operating systems. Download and install the one that fits your configuration:

Installing S4A requires you to install software both in your PC and your Arduino board. Here you'll find the detailed steps to get it up and running.

These kits will come in incremental upgrades, so that you won't need to pay for components you don't require for your project.

As a response to requests by the S4A community, several of our students, and users around the globe, we are developing a series of kits that will provide the necessary hardware to get started with S4A, with preinstalled firmware and documentation.

Frequently Asked Questions

General questions Can the S4A firmware damage the board? In fact, our "firmware" is just like any other Arduino sketch, so there is no risk at all. Of course, you can upload other sketches to the board and then upload the S4A firmware again when needed. Can the S4A programs be pushed into the Arduino board? There is currently no way to compile code into Arduino binaries. It must be said that S4A was conceived as an improvement of the older versions of Scratch (the ones that were developed in Smalltalk), to make learning how to program real-world objects easier to everyone, specially to children, by dealing with these real objects in the same way they'd deal with Scratch "normal objects", so they can interact between them. In other words, it was not made to program the board directly, but to help learn programming and electronics at the same time. Still, if what you want is to just get rid of the USB cable, we recommend you use a wireless device like XBee.

Can I change the pinout configuration?

Unfortunately, no. Pin configuration is hardcoded both in the firmware and in the source code of S4A, and the way S4A is made does not allow to change source code "on the fly". So, until we find a better way or enhance the communication protocol between the board and the program, the only way to customize the pinout is by changing both S4A source code and the firmware. There is a Spanish unofficial guide available here (thanks to Borja Pérez).

Which boards does S4A support?

S4A works with Arduino Diecimila, Duemilanove and Uno. Other boards haven't been tested, but they may also work.

Will S4A work on my PC?

S4A works on the three major consumer operating systems: Microsoft Windows, GNU/Linux and MacOS. So yes, it will most probably work on your PC.

Installation troubleshooting I can't install it on 64-bit Ubuntu/Debian The Debian version of S4A is packaged only for i386 systems. To get it working in a 64-bit version, you need to follow the following steps (in a terminal, as root): Fist of all, enable i386 packages and install ia32-libs dpkg --add-architecture i386

apt-get update

apt-get install ia32-libs

Then install S4A: dpkg -i --force-architecture S4A16.deb I'm having issues trying to install it on MacOS Since MacOS 10.8 (Mountain Lion), Gatekeeper is set up by default to allow downloaded applications only from "Mac App Store and identified developers". To install S4A, you'll need to change this option to "Anywhere". More info here.