Introduction: Getting Started With PocketLab in Scratch
The Scratch programming language is a accessible and hands-on tool for teaching young learners to think and reason creatively through computer code. Students can use Scratch's straightforward interface and building blocks to create projects that range from simple animations to interactive games and experiences. The Scratch coding environment can now be taken even further with the PocketLab sensor, a durable and kinetic device that can quickly collect data from it's surroundings. The PocketLab sensor can measure several different values such as velocity, acceleration, temperature, and magnetic field strength. When paired with Scratch, the PocketLab sensor enters a whole new world of potential uses, for example as a wireless controller, tracking device, or information collector. This tutorial will give you all the tools you need in order to start creating with PocketLab in the ScratchX programming environment.
You will need:
- A compatible Windows 10 laptop, 2-in-1, or other Bluetooth enabled device
- A PocketLab sensor
- The PocketLab app (free to download from the Windows Store)
- The Chrome web browser
- The PocketLab-Scratch plug-in for Chrome (free to download from the Google Web Store)
- The ScratchX for PocketLab program (free to download from the PocketLab website or Github page)
Step 1: Setup PocketLab With Windows 10 App
To connect the PocketLab sensor to your Windows device you will have to go through an initial setup like you would setup a Bluetooth mouse or speaker. You only have to do this once per PocketLab sensor and Windows device. After the initial setup, the PocketLab sensor can connect directly through the PocketLab app.
First, make sure your Windows 10 version is up to date, as the PocketLab app works best with the latest version of Windows 10. Then download the free PocketLab app from the Windows Store. After installations is complete, go to Settings >> Devices >> Bluetooth and turn Bluetooth ON. Press the top button on the PocketLab sensor. The sensor will flash red and green and a new Bluetooth device should appear in the device list with the serial number: "MS-PL-HW10-FW10-0001" and the message "Ready to Pair". Click on the Bluetooth device and press the Pair button. When prompted, enter the passcode "0000" and then press Next to pair to the PocketLab sensor. You can now disconnect the PocketLab sensor from your windows device by pressing the top button. Finally, go to your applications from the Start menu and click on the PocketLab icon to launch the app. The first time you open the app you will need to agree to allow access privileges in order to connect to the Bluetooth hardware and PocketLab sensor.
Step 2: Install the ScratchX for PocketLab Program
You will need to install a helper program in order to connect the PocketLab app data to ScratchX. Go to the PocketLab website (http://support.thepocketlab.com/topic/pocketlab-and-scratch-windows-10-install-files) or the PocketLab GitHub page (https://github.com/ThePocketLab/ScratchX/tree/gh-pages) to download the Windows 10 install files. Once the ZIP file entitled "ScratchX-gh-pages" has been downloaded and extracted to somewhere on your computer, open it and run the file "ScratchX for PocketLab". The Installation Wizard will then guide you through the process of the installing the helper program.
Step 3: Install the PocketLab ScratchX Chrome Extension
The PocketLab and ScratchX Extension is only available for the Chrome browser. If you do not have Chrome installed on your Windows computer, you can download the program from Google for free here: www.google.com/chrome. In the Chrome browser go to the PocketLab ScratchX Extension in the Chrome Web Store (https://chrome.google.com/webstore/detail/pocketlab-scratchx-extens/mjjkdikegondcpdflbniengckkedfooo) and click the Add To Chrome button. Then, in the pop-up box, click Add Extension.
Step 4: Connect the PocketLab Sensor and App
Launch the PocketLab app from the Windows Start menu. Press the top button on the PocketLab sensor and the LED indicator will flash alternating red and green. If the PocketLab sensor is in close range to your Windows device, the sensor will connect automatically and flash red. Otherwise, if the PocketLab sensor is too far away to connect automatically, a message that says "Pair with 360243..." will appear at the bottom of the screen. Click the message to connect. Then click on the Graph Select menu icon and enable the check box next to Scratch at the bottom of the Graph list.
Step 5: Launch the ScratchX Program
In the Chrome browser go to http://scratchx.org/?url=http://thepocketlab.github.io/ScratchX/pocketlab_extension.js. The ScratchX window should look like the image above. You can find example programs in the PocketLab and Scratch Windows 10 files you downloaded earlier, or on the PocketLab Github page at https://github.com/ThePocketLab/ScratchX/tree/gh-pages. In the ScratchX window go to File >> Load Project in order to select and load an example from your computer.
Step 6: Using PocketLab and ScratchX
When all the PocketLab app, extension and ScratchX program are working correctly, the indicator light next to the “PocketLab Extension” menu will be green. To run your Scratch program, click the green Run Flag icon. The PocketLab sensor should then begin sending data to the ScratchX coding environment. If the indicator light turns yellow, the first fix to try is disabling and re-enabling the PocketLab ScratchX Chrome extension. Go to Chrome menu button >> More tools >> Extensions. Navigate to the PocketLab ScratchX extension and uncheck then re-check the Enabled box. If the indicator light is still yellow and not data is being sent from the PocketLab sensor to the ScratchX environment, close all programs and restart your computer. You can also find a full video tutorial above detailing how to use ScratchX with PocketLab.
We have a be nice policy.
Please be positive and constructive.