Programming Your Hummingbird with MicroBlocks


To use MicroBlocks with the Hummingbird Bit, you will need a computer – Windows, Mac, Chromebooks, and Linux are all supported. Start by downloading and installing MicroBlocks from this page.

Insert a micro:bit into the Hummingbird Bit. Connect the Bit to power (battery pack or AC power adapter), and connect the micro:bit to the computer with the USB cable.

Next, open MicroBlocks. Click the Connect button at the top of the screen.

Click on the serial port of the Hummingbird Bit. If you see multiple serial ports, it may be helpful to unplug all USB devices except the Bit.

If you haven’t used MicroBlocks before with this micro:bit, you will be asked to install MicroBlocks on the micro:bit. Click Yes. If you are using a Chromebook, this prompt may not appear. Click with two fingers to the left of the Connect button and select install MicroBlocks on board.

Click BBC micro:bit and wait approximately 30 seconds for MicroBlocks to be installed. Your computer may pop up a window that says the micro:bit has been disconnected. Don’t worry, this is normal. If you are on a Chromebook, the app cannot install the file automatically. Follow the instructions in the app to drag the file onto your micro:bit and connect.

Once MicroBlocks has been installed on the micro;bit and your Hummingbird is connected, you will see a green circle by the Connect button.

Next, click the + sign by Libraries and choose Hummingbird.ulib. Then click Okay.


Using MicroBlocks

To try out MicroBlocks, connect a single color LED to LEDS port 1 on the Hummingbird. The colored wire should be connected to ‘+’ and the black to ‘-.’

In MicroBlocks, you can click on blocks to run them, just like you can in Scratch. For example, drag a Hummingbird LED block into the work area and set the % parameter to 100. if you tap on this block, the LED that you connected will light up.

As you write programs, they are automatically downloaded to the micro:bit. As an example, this program makes the LED blink 10 times when button A on the micro:bit is pressed. All the yellow blocks can be found on the Control menu. Run this program once, and then disconnect the USB cord from the micro:bit. You can still press button A to run the program!

Please note that the Hummingbird still needs power, so it will need to be plugged in to the battery pack or power adapter. Also, to change your program, you will need to reconnect the USB cord and click Connect in MicroBlocks.


Hummingbird Blocks

The table below contains brief descriptions of all the Hummingbird blocks in MicroBlocks. You can also use the blocks on the Output and Input menus to write programs that use the LEDs and sensors of the micro:bit in the Hummingbird. Don’t use the blocks on the Pins menu when writing programs for the Hummingbird. The pins are used by the Hummingbird, so these blocks may cause unexpected behavior.

Hummingbird Block     Description
    Sets a single color LED on LEDS port 1, 2, or 3 to a brightness value from 0% to 100%.
Sets a tri-color LED on TRI-COLOR port 1 or 2 to the color specified by red, green, and blue brightness values. The values range from 0% to 100%.
    Sets a position servo on SERVOS port 1, 2, 3, or 4 to an angle from 0° to 180°.
    Sets a rotation servo on SERVOS port 1, 2, 3, or 4 to a rotation speed from -100% to 100%.
Reads the value of the sensor on SENSORS port 1, 2, or 3. Readings for the distance sensor are given in cm. All other readings range from 0 to 100 (no units).
    Reads the value of the battery in milliVolts. Power to servos may shut off at values below 4200 mV.


Example Program

Since programs written in MicroBlocks are automatically downloaded to the micro:bit, it is an excellent choice for creating mobile robots, robots that can be disconnected from the computer to roam their environment. Try building a rover to use with MicroBlocks!

To create a basic program to move and avoid obstacles, use the distance sensor to detect when the rover is near a wall or another obstacle. If the rover detects an obstacle, it should back up and turn. Otherwise, the rover should drive forward. Basic code for this is shown below. Note that two rotation servos on the rover point in opposite directions. This means that to move the rover forward, the two servos must move in opposite directions.

After you have a basic rover program working, try adding headlights and making your driver steer. Then modify your rover and program to try something new!


Strawbees and Hummingbird

Hot glue a Strawbee to the Hummingbird servo motor, and then just start building!





You can also use Strawbees with the gear motor by gluing them to the plastic brick adaptor.






Try making a fun linkage with the Hummingbird and Strawbees!





Pro Tip: You can use just the tip of a Strawbee as a connector. This can help you to keep parts of your creation from colliding. In the video above, a small connector keeps the straw connected to the motor from hitting the stationary straw on the table.


Get a Grip!


  • computer with Birdbrain Robot Server and Scratch
  • plastic bottle
  • Hummingbird board
  • Vernier BTA Sensor Adapter for Hummingbird
  • 1-hole stopper with tapered valve
  • Vernier Gas Pressure Sensor
  • heavy-wall plastic tubing


  1. Connect the plastic bottle to the pressure sensor as shown below.
  2. Connect the Vernier BTA sensor adapter to the Hummingbird. Then connect the pressure sensor to the adapter. The jumper on the adapter should be set to 0-5 V.
  3. To read a measurement from the pressure sensor, you will use the HB voltage block in Scratch. This block will read a voltage between 0 and 5 V.
  4. The Vernier manual for the pressure sensor provides a linear equation that you can use to convert voltage to pressure: pressure = 51.71*voltage – 25.86
  5. In this experiment, you will grip the bottle as hard as you can for 60 s. You want to record data during this time and compare the data from 0 -10 s with the data from 50 – 60 s. To do this, you will need to write a program that meets the following requirements:
    1. The program must record 480 pressure sensor measurements and store them in a list.
    2. The program should wait 0.125 seconds between measurements (so the program takes approximately 8 measurements per second).
    3. The program must use the function above to calculate the pressure based on the HB voltage block.
    4. The program should graph the pressure measurements to the screen. The pressure measurements should be scaled so that this graph occupies most of the screen. The stage backdrop should show appropriate axes for this graph.
    5. The program should calculate the mean pressure for the entire 60 s period and display this value for the user.
    6. The program should calculate the mean pressure during the period 0 – 10 s and display this value for the user.
    7. The program should calculate the mean pressure during the period 50 – 60 s and display this value for the user.
  6. Grip the bottle as hard as you can with one hand while you run your program. Remember not to start the program until you are gripping as hard as you can. Record your data in the table below.
  7. Repeat this process for your other hand. Record your data in the table.


Processing the Data

  1. In the space provided in the data table, subtract to find the difference between your 0–10 s average and your 50–60 s average for each hand.
  2. Record the 0–60 s results for the other students in your group. Calculate and record your group average. Calculate and record the class average for 0–60 s.
  3. Which of your hands is stronger? Explain your decision.
  4. Did your gripping power increase or decrease during the 60 s period? Why did it change?
  5. How does your grip compare with the class average?
  6. What did you learn about your strength in this experiment? Were you surprised?


Can you motivate yourself (or someone else) to grip harder? Use lights, motors, and/or sounds to make a robot that does different things depending on how hard the person is gripping. For example, maybe more LEDs light up the harder the person grips. Does the average grip pressure increase when someone uses your device?


Where IS North?


Where IS north? It depends. Do you mean geographic north or magnetic north? The geographic (true) north pole is the point at 90° N latitude. It is aligned with the rotational axis of the Earth. The Earth is surrounded by a magnetic field with a north and south magnetic pole. The magnetic north pole is the point to which a compass needle points. It is currently in northern Canada, but moves at an average rate of 15 km per year due to complex fluid motion in the outer core of Earth. Depending on your location, the difference between magnetic north and geographic north, called magnetic declination, can range from 0° to 30°.

In this experiment, you will measure the magnetic field of the Earth. You will use this data to determine magnetic north. Knowing the direction of true north, you will calculate the magnetic declination at your location.


  • computer with Birdbrain Robot Server and Scratch
  • Hummingbird board
  • Vernier BTA sensor adapter for Hummingbird
  • Vernier Magnetic Field Sensor
  • glue gun
  • cardboard
  • rubber bands


  1. Bend the magnetic field sensor so that the end is at a right angle to the handle of the sensor.
  2. Connect the Vernier BTA sensor adapter to the Hummingbird. Then connect the magnetic field sensor to the adapter. Set the switch on the magnetic field sensor to 0.3 mT (high amplification).
  3. You need to build a robot that will rotate the magnetic field sensor to a variety of angles between 0° and 360°. To do this, you should use two servo motors. One possible design is shown below. The top servo rotates from 0° to 180° while the bottom servo is at 0°. Then the bottom servo moves to 180°, and the top servo rotates from 0° to 180° again. In this way, the top plate can stop at any angle from 0° to 360°. There are other possible designs! Note: If you mount one servo on top of another, make sure that the axes of rotation of the two servos lie along the same line.
  4. Once you have a robot that can stop at angles from 0° to 360°, mount the magnetic field sensor on it in the orientation shown below. DO NOT use hot glue on the magnetic field sensor! You can use rubber bands to gently attach it to your robot.
  5. To read a measurement from the magnetic field sensor, you will use the HB voltage block. This block will read a voltage between 0 and 5 V.
  6. The Vernier manual for the magnetic sensor provides a linear equation that you can use to convert voltage to magnetic field strength (in millitesla): magnetic field = (0.16 mT/V)*voltage – 0.32 mT
  7. In this experiment, you need to record a number of magnetic field measurements. You should write a program that saves these measurements in a list. Your program should meet the following requirements:
    1. The magnetic field sensor should stop every 15° between 0° and 360°.
    2. At each stop, the program should record the angle in one list and the magnetic field sensor reading in another list.
    3. The program should graph the magnetic field measurements to the screen. The measurements should be scaled so that this graph occupies most of the screen.
  8. Look at your graph. Where is the magnetic field highest? This is the direction of magnetic north! Look through your lists to find the angle with the highest magnetic field. Be sure to record this value.

Processing the Data

  1. Consult a map to estimate the direction of north for your location. How does this compare to the direction you identified in this experiment? If a compass is available, use this to measure the direction of magnetic north and compare it to your results.
  2. The difference between the measured magnetic north and true north is called magnetic declination. What is the magnetic declination for your location? What modifications would be needed on a compass in your location to keep you on course when following a map?


  1. Modify your program so that it automatically calculates the angle of magnetic north. Then make the robot point the magnetic field sensor in this direction. Use LEDs to show the user the direction of magnetic north.
  2. Research current theories on why the magnetic north pole moves.
  3. Scientists have found that the magnetic field of the Earth is continually changing. What would be the implications of a big change?

Robot Petting Zoo

  1. Introduction: Very briefly, introduce participants to the goals of the robot petting zoo. It may be helpful to use videos from this playlist above to show students the types of things that are possible. This is also a good time to show students the Hummingbird components and describe how they can be used to create robots that sense, think, and act.
  2. Learning to Build: Jumping right into a building activity capitalizes on student enthusiasm and enables them to immediately take ownership of the activity. This can also give students a chance to practice their skills in a low-stakes way before beginning work on their final robot. Possibilities for this step include the following:
    • Build a moving mouth and customize it to make a practice pet.

    • Use the Hardware Components Quick Reference to describe the parts of the Hummingbird kit. Have students quickly prototype their planned animal in cardboard, placing pictures of the components where they want them to go.Robot Petting Zoo Components Reference
  3. Programming Exercises: You can use any language with Hummingbird support, but for beginners, we recommend Scratch (on computers or Chromebooks) or BirdBlox (on tablets).
  4. Planning: Have students sketch their animal and create a plan to build and program it. The Makeathon Design Notebook may be helpful. This is also a good time to show students how different mechanisms can be used with the Hummingbird motors; this playlist may be helpful.Robot Petting Zoo Makeathon Design Notebook
  5. Robot Making Time! Give students ample time to build and program their robots. This should be roughly half of the total makeathon time.
  6. Community Display: Open your robot petting zoo to inspire and delight your community! If you want, you can have visitors vote on fun categories like “Cutest Pet,” “Silliest Pet,” etc.

Physics of Pinball

The eighth graders of Vickery Creek Middle School demonstrate their knowledge of physics by creating pinball machines! They learn about simple and complex machines in physical science, and then they apply this knowledge in their STEAM elective.

This project starts with an introduction to how pinball illustrates Newton’s Laws of Motion. Roanoke Pinball Museum: Key Concepts is a helpful resource. Discovery: How It’s Made: Pinball Machine shows the construction of an actual pinball machine.

Next, students are challenged to build a pinball machine with the Hummingbird. The game must have a clear, engaging theme and incorporate at least 3 simple or compound machines to apply Newton’s laws of motion. Students can use the attached planning document to design their machine.

As students build their game, the DIY Cardboard Pinball Machine video may be helpful. In addition, this video shows how to use the Hummingbird servo to construct a basic flipper that uses a linkage. Students can experiment with modifying this linkage to get the movement that they want for their game. 

When students complete their games, invite the school community to come play!

Differentiation: Students ready for an additional challenge can add sound effects and score keeping through Scratch or Snap!.

Assessment: The rubric found in teacher materials can be used to evaluate projects.


Check out this pinball machine from CreArtBot:


Mood Ring Finch

A mood ring is a ring that changes color based on your body temperature. The idea behind the ring, which is explained in this video, is that your body temperature can be used to predict your mood. In this activity, you will use the Finch to predict mood in the same way!

Write a program that sets the color of the Finch’s beak based on temperature. The Finch should also tell you what your mood is for each color. The Finch should have at least three different moods, but you can add as many as you want!

To test the “mood Finch,” place your fingertip or palm over the temperature sensor.


Miniature Golf

In July 2017, Mike Jacobs and Stephanie Sytsema hosted a Hummingbird summer camp at Grandville Christian Elementary School. This project grew out of a weekly Tinker Tuesday program in which high school engineering students facilitate STEM activities with elementary students. Students and parents were hungry for more, so Jacobs and Sytsema created a week-long camp that was offered twice during the summer of 2017. In this camp, students used the Hummingbird to create a miniature golf course, complete with windmills and moving obstacles. On the last day, students’ families were invited to come and play this very challenging course! The proceeds from the first week of camp were used to cover the costs of the Hummingbirds, which are now available for future camps and classes in the elementary school.

Program Outline

  1. Day 1: Students are introduced to the Hummingbird and learn to write programs with the lights and motors.
  2. Day 2: Students learn to use sensors to make decisions in their programs.
  3. Day 3: Students jump into designing their robotic creations for the miniature golf course! Students are required to draw their designs and annotate their drawings before beginning to build.  Teachers emphasize how to troubleshoot and solve problems step-by-step as they are  building and programming.
  4. Day 4: Students work to complete their robots in preparation for the open house on Day 5.
  5. Day 5: After students set up the golf course, family members are invited to come and play. This event is BYOP–Bring Your Own Putter!


Graphing with Finch

You have learned to use the Finch sensors to move a sprite on the screen. In this activity, you will use the commands on the Pen menu to graph the value of a sensor over time.

Start by writing a program that uses the block below to move the sprite on the screen. What numbers do you need to put in the blanks so that the sprite moves all the way to the top and the bottom of the screen

Now you want to record the path of the sprite on the screen. Explore the commands under the Pen menu. Start with the pen down block; you can think about this block as placing a pen on the “paper” of the screen. How can you change the color of the sprite’s path?

You have a program that tracks the value of the light sensor. To create a graph, you need to start with the sprite on the left side of the screen and gradually increase the x-coordinate as you change the y-coordinate. At the very beginning of your script, add a command that will make the sprite start at (-240, 0).

Within your loop, add a block that will increase the value of the x-coordinate by one pixel each time through the loop. When you run your program, you should see a graph that looks something like the one shown below.

Extension: Can you add axes to your graph? Can you graph the light value for exactly 30 seconds?


BirdBlox Maze Game

Hummingbird Setup

  1. Remove the circular plastic horns from each servo. Replace one with the large red flower-shaped horn and the other with the white “+” shaped horn. Do not replace the screws, as we may need to readjust the horns, and the friction between the horn and the servo should be enough for our purposes.
  2. Create a base for your robot by attaching a block to a flat surface or board. The block will hold up the servos, which will tilt the maze.
  3. Attach the two servos together at a right angle as shown above using rubber bands, tape, or hot glue.
  4. Mount the servos on the block so that both servos can turn freely.
  5. Construct a simple maze out of paper and cardboard for the ball to move through. There will be some lag when controlling the robot, so don’t make the maze too difficult.
  6. Place an upward-facing distance sensor at the start of the maze to detect the ball.
  7. Likewise, add a light sensor to the end of your maze. You could instead make a receiving container with the light sensor inside it as shown below:
  8. Attach the maze to the second servo. You will need a right-angled piece of cardboard/plastic to do this. You may find it easier to remove the horn from the servo and attach that to the maze.
  9. Connect the servo with the “+” shaped horn to servo port 1 and the servo with the flower-shaped horn to servo port 2.
  10. Attach the distance sensor to sensor port 1.
  11. Attach the light sensor to sensor port 2.
  12. Decorate the maze with 2 tri-color LEDs, which should be attached to tri-color ports 1 and 2.Now you are ready to begin programming!


NOTE: While programming, you should detach the “+” horn (and the maze attached to it) from its servo. This will prevent the maze from being damaged if the servo moves too far.

  1. Turn on Bluetooth if it is off.
  2. Open the BirdBlox app.
  3. Connect to the Hummingbird.
  4. Start your program with a when flag clicked block and a repeat forever loop, both of which are from the Control category.
  5. We will be using the tablet’s accelerometer to control the two servos. Start by placing a Hummingbird Servo block within the forever loop.
  6. Acceleration values can be anywhere from around -10 to 10. However, servos do not accept negative values. We can resolve this by adding 90 to the value before we send it to the servo. Head to the Operators category and place an addition operator in the second slot of the servo block. Then type 90 into the second slot of the addition block. 90 gives the servo the maximum amount of room to move in each direction.
  7. A change from -10 to 10 (80 to 100 after adding 90) is small and will move the servo only a little. To resolve this, we will multiply the acceleration value by 3. Add a multiplication block (from Operators) to the first slot of the addition block. Then type 3 into the first slot of the multiplication block. Place a Device Acceleration block (Tablet menu) into the second slot of the multiplication block.
  8. If you have not already, lock your device’s orientation. The will prevent the screen from turning when you tilt the tablet.
  9. Run your program by tapping the green flag. When you tilt your tablet back and forth, the upper servo (the one normally attached to the maze) should move accordingly. If it moves in the opposite direction to the tablet, change the 3 in the multiplication block to -3. Stop your program when you are done testing by tapping the red stop sign.
  10. Now we just need to link the second servo to the y acceleration. Duplicate the Hummingbird Servo block by tapping and holding. Attach the copy below the original servo block. Change the port number from 1 to 2 and use the drop-down menu to replace the “X” with a “Y.”
  11. Test the program again. Tilt your tablet back, forth, left, or right and the servos should move accordingly. Again, you may have to reverse one of the servos by changing the corresponding multiplication block from 3 to -3.
  12. You maze is now playable! However, there are still more features we could add.Let’s make the robot blink the LEDs when we successfully move the ball to the end of the maze and cover the light sensor. We will repeatedly move the servos to match the tablet’s orientation just like we did before, but only until the light sensor is covered. Then we will blink the LEDs.
  13. Place a repeat until block from the Control category so that it is within the forever loop but above the first servo block. Then drag both servo blocks into the repeat until loop.
  14. The loop should repeat until the light sensor is covered and falls below a certain value. Drag a less than block from Operators into the slot on the repeat until block. Then place a Hummingbird Light block into the left slot of the less than block. Change the port of the light sensor block to port 2. Then type 50 into the right side of the less than block. You may have to adjust this value based on your lighting conditions.
  15. When the sensor is covered, the robot will put on a light show! To make the lights blink many times without using too many blocks, we will use the repeat block from the Controlcategory. Place this loop directly below the repeat until block. 10 is a little much, so change the value to 5.
  16. Add HB TRI-LED blocks to light up your robot. Be sure to use both LEDs.Here is the pattern we used:First we made LED 1 green and LED 2 blue.
    Then we reversed the colors, making LED 1 blue and LED 2 green.
    NOTE: If you are wondering why we did not add wait blocks in between the LED blocks, we made the program this way because the BirdBlox app automatically has a small amount of delay in between Hummingbird blocks. This delay is caused by the time needed to send commands via bluetooth.
  17. Once the pattern is done, the program should wait for the ball to be placed at the start of the maze before activating the servos again. For this purpose, add a wait until block from the Control category above the repeat until block.
  18. We want the program to wait until the distance sensor sees the ball (or if the ball is too small, until it sees a hand holding the ball). Add the blocks Hummingbird Distance CM < 20to the wait until block.
  19. Once the maze is activated and the game begins, we can change the color of the LEDs to alert the user that the game has started. We chose to make both LEDs red. These LED blocks should be inserted right below the wait until block.
  20. Finally, when the robot is idle and waiting for the ball to be placed at the start of the maze, the board should be level and the LEDs should be a different color to reflect the idle state. Place two LED blocks and two servo blocks (one for each port) above the wait until block to do this. Set the servos to 90 degrees, which should be level.
  21. It is finally time to reattach the maze to the robot! Tap the green flag and place the iPad level on a table. This will set both servos to 90 degrees. Then attach the maze and adjust the horns as needed so that the maze platform becomes level.
  22. Have fun playing your maze!