This site requires JavaScript.

EV3+Scratch Extension

Code & Circuit has developed this ScratchX Extension to control our EV3 bricks over Bluetooth from Scratch.
Check out the demo video below.

Try it out!

REQUIREMENTS:
  • An EV3 brick
  • A properly configured ScratchX device plug-in on Mac (Safari) or Windows (IE or Firefox)
INSTRUCTIONS:
  1. Make sure you have installed the latest Device Plugin for Safari or IE.
  2. First-Time Setup:
    1. In our classroom, we've paired each brick with its own laptop. The bricks and laptops are labeled with numbers, and students match the numbers before starting.
    2. Mac-specific step (skip if on PC):
      1. The brick must first be re-named starting with the string "serial" (in lowercase) before pairing so that Scratch will recognize it. Re-name a brick by connecting it to the Mac via USB, and using the LEGO Mindstorms Mac software. You should see the name change on the brick’s title bar.
      2. If you previously paired the brick before renaming it, follow these steps before pairing:
        1. Turn off Bluetooth on the Mac (in the BT prefs).
        2. Trash /Library/Preferences/com.apple.Bluetooth.plist (this is the main Library, not the user Library.)
        3. Reboot the Mac
        4. Re-enable Bluetooth.
        5. Follow the next step to pair the brick.
    3. On the Brick, enable bluetooth if it’s not already enabled.
    4. On the Brick, select the "iPhone/iPad/iPod” checkbox. (only temporarily; we’ll turn this off in the last step.)
    5. Look for the brick in the computer's Bluetooth panel, and click Pair. You should not be asked about passcodes. (Checking that iPhone/iPad/iPod for some reason eliminates the passcode requirement.)
    6. During pairing, you’ll see the brick show up as connected to the computer for about 5 seconds and then disconnect. This is normal. Wait for it to disconnect before the next step.
    7. Lastly, turn off that "iPhone/iPad/iPod” checkbox.
    8. You should not have to do these steps again, unless a brick crashes hard and does a full reset. If you notice the brick's name has reverted back to "EV3", it may have to be renamed and repaired.
  3. Using the Extension:
    1. Make sure brick is powered on first and iPhone/iPad/iPod checkbox is unchecked.
    2. Do not manually initiate any connections to or from the brick. The Scratch Plug-in will automatically connect when the ScratchX webpage loads.
    3. Go to this link using Safari (Mac) or IE (Windows): EV3 Scratch Extension. We have not had any luck with Chrome.
    4. When the connection is successful, you will hear the brick play some happy tones.
    5. If the connection is lost (brick was turned off, goes out of range, etc.), you must refresh the browser page to re-connect to the brick. Save your ScratchX project as an sbx file first, refresh the page, wait for the beeps, and then load the sbx file.
  • Tips:
    • Make sure the brick is turned on before going to the ScratchX webpage link.
    • You can double-click a block directly in the menu in Scratch to make it trigger immediately. For example:
      • To test whether a brick is connected, double-click the "play tone" block in the More Blocks menu. You should hear a tone!
      • To stop all motors quickly, double-click the "stop all motors" block.
      • To see the value of a sensor, double-click its rounded block to see the result in the little pop-over.
    • Make sure your EV3 blocks have selected the correct motor or input port.
    • For the IR Remote block to work, the red slider on the remote must be switched to top (1) setting. On the block, select the port where the IR sensor is connected.
  • Demo SBX files on Github

    Feedback

  • Send comments/feedback to lego@codeandcircuit.org