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/Firefox*) or Windows (IE or Firefox) * IMPORTANT: Safari 12 no longer works with the Scratch Device Plugin, and neither does the latest Firefox.
As there is no way to downgrade Safari, you'll need to download an older version of Firefox:
- Download Firefox 46 from here: Firefox 46
- Turn off Firefox auto-updating by going to the Preferences, the Advanced -> Update -> Never check for updates.
- Make sure you have installed the latest Device Plugin for Safari/Firefox or IE.
- First-Time Setup:
- 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.
- Mac-specific step (skip if on PC):
- 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.
- If you previously paired the brick before renaming it, follow these steps before pairing:
- Turn off Bluetooth on the Mac (in the BT prefs).
- Trash /Library/Preferences/com.apple.Bluetooth.plist (this is the main Library, not the user Library.)
- Reboot the Mac
- Re-enable Bluetooth.
- Follow the next step to pair the brick.
- On the Brick, enable bluetooth if it’s not already enabled.
- On the Brick, select the "iPhone/iPad/iPod” checkbox. (only temporarily; we’ll turn this off in the last step.)
- 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.)
- 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.
- Lastly, turn off that "iPhone/iPad/iPod” checkbox.
- 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 re-paired as in step 2b above, including step 2b2.
- Using the Extension:
- Make sure brick is powered on first and iPhone/iPad/iPod checkbox is unchecked.
- Do not manually initiate any connections to or from the brick. The Scratch Plug-in will automatically connect when the ScratchX webpage loads.
- Go to this link using Safari/Firefox* (Mac) or IE (Windows): EV3 Scratch Extension. We have not had any luck with Chrome.
- Agree to allow Flash Player if asked.
- Agree to Trust the plugin if asked. Then, after trusting, you must reload the webpage.
- When the connection is successful, you will hear the brick play some happy tones.
- 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.
- 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.