Skip to main content

Programming an Arduino Esplora to interface to Scratch

Downloaded: 301

Last edit: 03 September 2022

Curriculum Topic Programming

Why use this program

This program can be used to make an Arduino Esplora act like a PicoBoard. It can be re-programmed, and has all the capabilities of both the Arduino and PicoBoard. This allows students to start learning using Scratch and develop into the full Arduino system. This can also be purchased for about the same price or less than the PicoBoard.

Level: Intermediate/Advanced

Teaches: Physical Computing, Sensors, Interfaces, Scratch, Arduino

How to use this program

  1. Download & install Arduino software.
  2. Download & install the ScratchSensors library. Download the ZIP file. Then extract and copy it to your Arduino Libaries folder (in windows this is in C:\Program Files (x86)\Arduino\libraries).
  3. Download the Esplora program from this page, and open it with the Arduino program.
  4. Program the Esplora board (press upload in the Arduino program).
  5. The board can now be used with Scratch like a PicoBoard.
  6. The sensors can be found at the bottom of the "Sensing" blocks in Scratch.

Adapting this program

The program maps the accelerometer to resistance A and B, and the joystick to resistance C and D. This can be changed to other inputs by changing the code.

The accelerometer and joystick send the data to Scratch using positive and negative numbers (using two's complement). Scratch interprets the numbers as all positive, so some Scratch code is needed to convert these into negative numbers. I have included an example of the Scratch code as a file.

Using this program on other boards

I chose the Arduino Esplora as it has the sensors built-in. You can use other Arduino compatible boards with the ScratchSensors library. You would have to create your own sensors, but that could be part of the learning