Start by watching the videos below.
The first will show you how to attach components to the Hummingbird board, and the second will demonstrate how to connect to the Hummingbird from the BirdBlox app.
**You must have a BLE adapter to use your Hummingbird Duo with BirdBlox. Purchase it here.**
Before you can build an awesome robot with your Hummingbird, you need to know how to use all the parts. This lesson will first show you how to use the Hummingbird outputs, the lights and motors. These components are called outputs because programs in BirdBlox send commands to them to make something happen. Then you will learn how to use the Hummingbird inputs, the sensors that provide information to the robot about its environment.
Start by watching the videos below.
The first will show you how to attach components to the Hummingbird board, and the second will demonstrate how to connect to the Hummingbird from the BirdBlox app.
Once BirdBlox is connected to a Hummingbird, you will see a steady blue light on the bluetooth adapter. If you have multiple Hummingbirds, this will tell you which one you have connected to. Once you know a Hummingbird’s name, it is useful to write the name on a piece of masking tape and tape it to the top of the Hummingbird board. This will make it easier to connect to the device in the future.
This is the main BirdBlox window. To write a program, you will drag blocks from the Blocks area on the left to the Scripts area on the right. In BirdBlox programs are also called scripts. You can use BirdBlox to write scripts that use the Hummingbird and the sensors of the tablet. For example, you can write a program to control a robot based on how you are tilting the tablet.
When BirdBlox is connected to a Hummingbird, there will be a green circle by the Hummingbird Connection icon, and the blocks on the Robots menu will be teal. If the robot becomes disconnected, the circle will turn red and the blocks on the Robots menu will be gray.
The Blocks area in BirdBlox contains six different menus – Robots, Tablet, Sound, etc. Click on the different menus to get an idea of the blocks that they contain. All the Hummingbird blocks are located in the Robots menu. This video will show you the basics of how to write a program in BirdBlox.
In BirdBlox, projects are saved automatically to the memory of the tablet. They will only be accessible on the current device and will be deleted if the app is uninstalled. To transfer a project to another device or back it up more securely, you can export the program. This process is summarized in the video below.
To move a program from one device to another, you can export it. From the File screen, select the Export button by the name of the project you wish to export. A number of options are available. You can use AirDrop to transfer the project to a neighboring device, you can email the project as an attachment, or your can upload to project to a cloud storage option such as Google Drive. The last option requires that you have an additional app installed for the cloud storage option that you choose. For example, you will need the Google Drive app to export your file to Google Drive. Because most storage apps are not available for the Amazon Fire, email or DropBox are the best choices for exporting with these devices.
To load a file from iCloud Drive, Google Drive, or another cloud storage option, tap the cloud icon on the File screen. Use the Locations button to select the location you want. Then tap the name of the file that you want to open. The file will be imported into BirdBlox and saved locally. If you want to save your updates in the cloud, you will need to export the updated file again.
The Duo LED block is used to control a single color LED. This block requires two numbers. The number on the left is the number of the Hummingbird port to which the LED is attached. This will be a number between 1 and 4 that you can select from a drop-down menu. In the picture above, the LED is connected to LED port 1. The second number in the Duo LED block is the intensity of the LED. This is a number between 0 and 100. 0 means that the LED is off, and 100 means that the LED is at maximum brightness.
Attach a single color LED to LED port 1. Then drag the block shown below out into the Scripts area. Tap the 0. A menu will pop-up to allow you to enter another number. Change this number to 50 and then tap the check mark.This is your first program! Tap this block to run your program. The LED should turn on.
Change the 50 to 0 and tap the block again. This should make the LED turn off. Change the 0 to 100 and tap the block. This is the maximum brightness of the LED. Try out other numbers between 0 and 100 to explore the different levels of brightness that are possible.
Connect a second LED to LED port 2. Write a script that turns the first LED on and then waits 2 seconds. Then the script should turn the second LED on for 2 seconds. Then the program should turn both LEDs off. Remember to save your work!
When Scratch reaches an Duo LED block, it sets the LED and moves immediately to the next block. This means that if you do not have a wait block between two commands for the same LED, you may not see the effects of the first block. For example, you will only see the LED turn on very briefly when you run the script below. Place a wait block between the Huo LED blocks in order to see the LED turn on for a period of time and then turn off.
Write a program that turns two LEDs on at different intensities, waits five seconds, and then turns both LEDs off.
LEDs do not automatically turn off at the end of a program; you must add a block to turn each LED off. You can also turn them off by tapping the stop sign in the upper right corner of the screen.
A tri-color LED can be attached to one of the two ports labeled “TRI-COLOR” on the Hummingbird board. The four wires of the tri-color LED are red, green, blue, and black. The black wire should be connected to the ‘-’ terminal. The red wire should be connected to the ‘R’ terminal, the green to the ‘G’ terminal, and the blue to the ‘B’ terminal.
The tri-color LED actually has three tiny lights inside it. One is red, one is green, and one is blue. This is important for programming the tri-color LED. The Duo Tri-LED block is used to control a tri-color LED. This block requires four numbers. The number on the left is the number of the port to which the tri-color LED is attached (1 or 2). The other numbers are labelled R, G, and B. R controls the amount of red light from 0 (none) to 100 (maximum brightness). G and B control the amount of green and blue light, respectively, from 0 to 100. As an example, the block below makes a tri-color LED in port 1 turn green.
Write a script to turn the tri-color LED five different colors.
Think about how you might turn an LED on and off repeatedly. One way to do this would be to use a long sequence of commands, but it is much simpler to use the repeat forever block in the Control menu. This block is called a loop. A loop is a programming structure that repeats a portion of a program. Look at the Control menu. Which of the other blocks do you think might be loops?
Other blocks can be placed inside the repeat forever block. The repeat forever block repeats the blocks inside it until you press the stop sign to stop the program. The loop shown below blinks the tri-color LED from green to blue. The loop repeats the four blocks inside it over and over. After the second wait block, the program immediately goes back to the first block inside the loop, the block that turns the LED green. What happens if you remove the second wait block?
Make a tri-color LED blink on and off in your favorite color at least ten times in five seconds. The tri-color LED should blink evenly – in other words, it should be off for the same amount of time that it is on. Next, add a single color LED. The single color LED should be off when the tri-color is on and on when the tri-color is off.
Write a program that turns both a vibration motor and a single color LED on for four seconds and then off for four seconds. Then place these commands within a loop to repeat them five times.
A servo motor is a motor that moves to a particular angle. The Hummingbird servo motor can rotate to any angle from 0° to 180°.
The servo motor has a small plug. This plug should be connected to one of the four sets of pins in the “SERVOS” section of the Hummingbird board. Each set of three pins is one servo port. The black wire should be connected to the ‘-’ pin, the red wire to the ‘+,’ and the yellow wire to the ‘S.’
Use hot glue to attach a popsicle stick to the white plastic circle on the servo motor. This will help you to see the movement of the servo motor more easily. If you don’t want to use hot glue, you can tape a feather to the plastic circle.
Write a script that repeatedly moves the servo to five different angles. Make the tri-color LED a different color at each angle.
Before you start building with a servo, always set it to 90°. This will make sure that the servo can move both left and right once it is attached to your robot.
The gear motor can be attached to either of the ports labeled “MOTORS” on the Hummingbird board. It does not matter which wire is attached to ‘+’ and which is attached to ‘-.’ When using the gear motor, you must also use the AC power adapter (or a battery pack).
Important Note: Do not cut the zip ties off your motors. Without the zip tie, the wires may break off the motor.
The Duo Motor block is used to control the gear motor. This block requires two numbers. The number on the left is the port attached to the motor. The number on the right is the motor speed. This number can be any whole number from -100 to 100. As an example, the script below turns the motor on for two seconds and then off.
Use a small screwdriver to attach a wheel to the motor so that you can see it move more easily (or just place it on the motor without using a screw). Try several speeds between 0 and 100. Describe how the speed affects the motor. Try several negative speeds. What does it mean for the speed to be negative?
Important Note: You may notice that your motor rotates clockwise for positive numbers, while your neighbor’s rotates counterclockwise for the same number. This just means that you and your neighbor chose ‘+’ and ‘-‘ differently when you plugged in your motors. Either way is fine!
Write a program that rotates the motor first in one direction, then in the other. Next, use a loop to repeat these actions.
Are you ready to use all the Hummingbird outputs? Write a program that includes the following:
The Hummingbird LEDs and motors are output devices. Scripts in BirdBlox send commands to these devices to make something happen. The Hummingbird sensors, on the other hand, are input devices. They send information to the BirdBlox program. The program can use this information to make a decision or control a light or a motor.
The distance sensor measures the distance to the closest object. Attach a distance sensor to the Hummingbird. Drag the Duo Distance CM block into the Scripts area away from the other blocks. Make sure that the port number is set to the port attached to the distance sensor. Tap this block to see the current value of the sensor. Then hold something in front of the sensor and tap the block again. Is the value of the distance sensor different?
The Duo Distance CM block measures the distance to an object in centimeters. The value of the distance sensor is between about 8 cm and 100 cm. The sensor cannot detect objects very close to the sensor or very far from it. It works best in the range of 20 cm to 60 cm.
To see the value of the distance sensor change, it is helpful to display it on the screen. To do this, you can use the Display block; it is located on the Tablet menu.
Place the Duo Distance CM block inside the Display block and tap the Display block. You should see the value of the distance sensor along the bottom of the screen. You can use the drop-down menu in the Display block to choose where on the tablet screen to display the value.
Run the script above and watch the value of the distance sensor change as you move an object back and forth in front of the sensor.
Do not delete this script. You will find it helpful as you continue to use the distance sensor! You may need to remove the white display box from the screen to see your scripts. To do this, stop your script and tap the white box.
The if else block has spaces in the middle that can hold other blocks. In addition, the if else block contains a hexagonal space. This space requires a Boolean block. A Boolean block is a block that can be either true or false.
You can use the distance sensor to create a Boolean block using the two blocks shown below, which are found on the Operators menu. Notice that these blocks match the shape of the space in the if else block.
Create the Boolean block shown below. This block is true if the value of the distance sensor is greater than 30 cm, and false otherwise. The value that the Boolean block uses to make a decision is called the threshold. In this case, the threshold is 30 cm. Click on the green part of the block with an object in front of the sensor. Is the block false?
Place the Boolean block into the hexagonal space in the if else block. When a script reaches an if else block, it checks the value of the Boolean block inside it. If the value is true, then the script runs the blocks inside the top part of the if else block. If the value of the Boolean block is false, then the script runs the blocks in the bottom part of the if else.
Write a program that blinks a red light and moves a servo motor when an object is close to the distance sensor. When nothing is near the distance sensor, the light should be off and the servo should not move.
The Boolean block for the if else is checked each time the program repeats the decision. However, the Boolean block is not checked during the statements inside the top or the bottom of the if else block. Try out the script below. In this script, the motor should be on when something is close to the distance sensor. When you run this program, you will notice that the program does not respond quickly when you move an object toward or away from the distance sensor. How can you modify this program to make it respond more quickly to a change in the value of the distance sensor?
Attach the knob to the Hummingbird board. Write a script that continually displays the value of the Duo Knob block. Then turn the knob all the way to the left. What is the value of the Duo Knob block? What is the value of the Duo Knob block when the knob is turned all the way to the right?
Write a program that turns on a single color LED when the knob is turned far enough to the left. When the knob is turned far enough to the right, the LED should be off. What will your threshold be for this program? Remember, the threshold is the value that the Boolean block uses to make a decision.
In the previous exercise, you used the rotary knob to decide whether the LED should be on or off. Instead, you could use the knob to determine the brightness of the LED. Because the Duo Knob block is a number between 0 and 100, you can place it inside the Duo LED block to set the intensity of the light. Try out the script below. The forever loop repeatedly changes the brightness of the LED to match the value of the knob.
Use the knob to control a gear motor and the amount of red in a tri-color LED (the amount of green and blue can be whatever you want). These components should change at the same time.
Don’t forget to set the port in the sensor block to the port on the Hummingbird board that you are actually using! If the value of the sensor is not changing as expected, be sure to check that the sensor block is reading the correct port.
The light sensor measures the amount of light around it. This sensor is very similar to the other sensors that you have learned about. You can use the Duo Light block to find the value of this sensor. This value will be between 0 and 100. Always remember to make sure that the Duo Light block is set to the appropriate port.
Attach the light sensor to the Hummingbird board. Use the Duo Light block to measure the amount of light in your room. Then measure the value of the light sensor when you cover it with your hand. The average of these two values is a good threshold for the light sensor.
Write a script that turns on a vibration motor when the light sensor detects that it is dark. Otherwise, the vibration motor should be off.
You have now practiced using all the Hummingbird motors and lights, as well as three of the sensors. There are other sensors, including a temperature sensor and a sound sensor. These work very similarly to the sensors you have already used. The Duo Temperature C block tells you the temperature in Celsius, and the Duo Sound block tells you the amount of noise around the Hummingbird on a scale of 0-100.
The last two exercises below will give you some practice using multiple sensors. After you have completed these, you will be ready to create many exciting, unique Hummingbird robots!
Write a program that uses the knob sensor to control the color of a tri-color LED. However, the LED should only be on when an object is less than 30 cm from the distance sensor. Otherwise, the LED should be off.
Write a program that sends the servo to four different angles based on the values of the distance and light sensors. All of the values are shown in the table below.
Distance | Light | Servo Angle |
Greater than 20 cm | Above the threshold | 0° |
Greater than 20 cm | Below the threshold | 60° |
Less than 20 cm | Above the threshold | 120° |
Less than 20 cm | Below the threshold | 180° |
Congratulations! You have completed Hummingbird BirdBlox training. Have fun making robots!