Scratch is a tile-based visual programming language, which is an excellent first language for children to learn. We are providing a helper app that allows you to use Scratch 2.0 with Finch and Hummingbird.
Table of Contents
- Video Tutorials
- Launching Scratch with Hummingbird
- Hummingbird Scratch Blocks
- Known Issues
This playlist of videos takes you through launching Scratch, describes the Hummingbird Scratch blocks, and demonstrates how to create several Hummingbird Scratch programs:
Step 1: BirdBrain Robot Server for Windows/Mac or Hummingbird Connection App for Chromebooks
In order to connect Scratch 2.0 with Hummingbird or Finch, you will need to install a helper application, the "BirdBrain Robot Server". Follow the instructions for your OS:
Download the Windows installer and double click on it. Follow the instructions in the installer. Once installation is complete, a short cut to BirdBrain Robot Server will appear on your desktop.
Download the Mac installer and double click on it to mount the disk image and open the installation folder. Drag the "BirdBrainRobotServer" lightbulb icon into the "Applications" directory. To run it, go to Applications and double click on BirdBrainRobotServer.
Visit the Chrome webstore to install the Hummingbird Connection App.
Important note 1: Projects saved on a Chromebook will not work with the BirdBrain Robot server used on Windows or Mac. If this is an issue, you can also install the Hummingbird Connection Chrome app on Windows or Mac.
Important note 2: If using the Chrome app on a Macbook running Mac OS 10.9 or later, keep some part of the Hummingbird Connection App visible on the desktop to prevent app nap.
Step 2: Install Scratch 2.0 Offline Editor
Hummingbird's Scratch library currently only works with Scratch 2.0's offline editor. Install it from here.
You do not need to install Scratch 2.0 offline if using a Chromebook, as we use the ScratchX website instead.
- Plug in a Hummingbird.
- Start the BirdBrain Robot Server helper application. It should show that the Hummingbird is connected. If you have a Duo in Arduino mode, the BirdBrain Robot server will indicate this and will ask you to press reset to revert to tethered mode.
- Start Scratch 2.0 by pressing the Open Scratch button on the BirdBrain Robot Server. In Windows/Mac, the Hummingbird Scratch blocks should be pre-loaded under the More Blocks category:
- Download the zip file containing the Finch and Hummingbird extensions, as well as a few example programs.
- Import the Hummingbird Extension file (hummingbird.s2e). Hold down the Shift key and click on File at the top left hand corner of the page. You should see the following:
3. Now click on More Blocks to see the Hummingbird blocks!
Plug in the Hummingbird, then launch the Hummingbird Connection App from your Apps launcher page. The following window should appear:
Click the Open Scratch button on the app to automatically load a ScratchX page with the Hummingbird blocks loaded. Click Enable Flash if needed.
If the ScratchX interface with Hummingbird blocks doesn't load, click Open Extension URL and then enter the URL for the Hummingbird:
- HB servo: Sets servos 1 through 4 to a value from 0 to 180 degrees.
- HB motor: Sets motor port 1 or 2 to a value from -100 to 100.
- HB vibration. Sets vibration motor 1 or 2 to an intensity value from 0 to 100.
- HB LED: Sets the intensity of light on a single color LED on ports 1 through 4. Intensity ranges from 0 to 100.
- HB triLED R G B: Sets the full color LED at port 1 or 2. The R, G, and B arguments control the intensity of the red, green, and blue elements in the tri-color LED. Range is 0 to 100 for each color.
All sensing commands allow the user to specify a number corresponding to the port the sensor is on. For example, a distance sensor on port three would be read by Hummingbird distance on port 3.
- HB temperature: Returns the value in Celcius of a temperature probe.
- HB sound: Returns the value of a sound sensor, range is 0 to ~100.
- HB rotary: Returns the value of the hummingbird's knob; range is 0 to 100.
- HB light sensor: Returns the value of a light sensor, range is 0 to 100.
- HB distance sensor: Returns the distance to an object from a distance sensor in centimeters. The range is 8 to 80 cm with the kit's range sensor (a value greater than 60 cm should be considered as not seeing an object).
- HB voltage: Returns the raw analog voltage reading at the sensor port, range is 0.00 to 5.00.
The "speak" block will cause the computer to say whatever text is placed in the box.
We have created six step by step examples that demonstrate how to create Scratch and Hummingbird projects. Check them out:
|Traffic Light||Build a working traffic light out of LEDs||Beginner|
|Burglar Alarm||Flash LEDs and vibrate when someone gets too close||Beginner|
|Rainbow LED||Make a tri-color LED fade through the colors of the rainbow||Intermediate|
|Dimmer LED & Servo||Control a servo and LED with a rotation sensor||Intermediate|
|Sprite Sizer||Make the cat bigger or smaller with the distance sensor||Intermediate|
|Combination Lock||Utilize variables and procedures to make the Hummingbird turn a servo when someone enters the correct combination||Advanced|
The BirdBrainScratch zip file includes nine Hummingbird example files. They are:
GraphKnob - This program graphs the value of a knob sensor (will also work with a light sensor on the same port).
Hummingbird Pong - Uses the knob to control a paddle in a simplified pong game.
SlowMotionServo - Slowly sweeps a servo through its full range.
example-1-traffic-light.sb2 - This program is used in the traffic light example
example-2-burglar-alarm.sb2 - This is the program for the burglar alarm example
example-3-rainbow-led.sb2 - This is the program for the rainbow LED example
example-4-dimmer-led-and-servo.sb2 - This is the program for the dimmer LED example
example-5-cat-sizer.sb2 - This program uses a distance sensor to change the size of the cat sprite.
example-6-combination-lock.sb2 - This is the program for the combination lock example.
These examples will not work on Chromebooks, but you can use the step by step examples to construct our examples on the Chrome platform.
Many of our examples, such as the burglar alarm or combination lock, combine Scratch animations and games with Hummingbird electronics. Watch the students at Christ Church Episcopal School present their creations for an idea of how to implement this type of project in the classroom:
Known Issues and Troubleshooting
- If the Hummingbird blocks do not pre-load when you click Open Scratch, click on Open Scratch again with Scratch already open. If this does not work or if Scratch does not open, use the instructions for manually loading the Hummingbird Scratch blocks.
If you are running an older version of the Birdbrain Robot Server (downloaded prior to May 2017), the sensor values may update very slowly. This is caused by App Nap putting the BirdBrain Robot Server to sleep. We recommend that you uninstall the Birdbrain Robot Server and install the most recent version. To manually disable App Nap on the BirdBrain Robot Server, CTRL-click on the BirdBrain Robot Server application and select Get Info in the resulting menu. In the Info window, check the box for Prevent App Nap:
- In Mac, if both Finch and Hummingbird are plugged in, you may see a 5-10 second delay after you try closing the server, and you may get an error message on close.
- In Mac, occasionally the application will not quit when you try to close the window - end the process with force quit.
- If the robot seems to stop responding for any reason, there is no need to close Scratch. Close the BirdBrain Robot Server application instead and re-open it.
- In Mac, the Hummingbird board must be plugged in before starting the BirdBrain Robot Server.
- On a Mac, if you revert a Hummingbird Duo from Arduino mode to tethered mode, you must then close/reopen the BirdBrain Robot Server.
- Sometimes loops with just Finch/Hummingbird command blocks seem to run just once instead of looping. Add a non Finch/Hummingbird block into the loop to make the loop work (a good dummy block is a "Wait 0").
- The Hummingbird Connection App for Chrome must stay visible on the desktop if using it with a Macbook running OS 10.9 or later. If the app is minimized, sensor values will stop updating and output commands will be sent very slowly.