Strawbees and Hummingbird

Use this step-by-step guide to build your own Hummingbird creation with Strawbees. This is Strawbeest, our homage to Theo Jansen’s Strandbeests.

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.


MaKey MaKey and Hummingbird

To understand MaKey MaKey, spend two minutes watching their highly informative and entertaining video:

How does it work?

MaKey MaKey takes advantage of the fact that many things in the world are a little bit conductive: People, water, fruit, pencil lead, coins, play-dough, and much more. The MaKey MaKey connects to your computer and pretends to be a USB keyboard and mouse. It then takes impulses from alligator clips that you connect to conductive objects and to the MaKey MaKey board, and when you press two or more conductive objects together, it converts that into a keyboard press/mouse command.

How do you use it with Hummingbird?

Basically, MaKey MaKey + Hummingbird = Banana controlled robots. Hummingbird and MaKey MaKey are both USB devices, so connect both to a computer and let the fun begin! The easiest way to use them together is to use Snap! with Hummingbird. Snap! contains two critical blocks that make it very easy to use with MaKey MaKey: the block and the block. Just configure these blocks so that they’re sensing the key on the MaKey MaKey that you’ve attached to a banana, play-dough, etc, and make your Hummingbird code either start with that “key press” or use an if statement to decide to do something whenever that key is pressed. Read through the example to get an idea of exactly how this is done.

Example: Control a Robot with a Drawing!

Our setup: a MaKey MaKey connected to a pencil drawing of our friendly dog robot. The MaKey MaKey has five alligator clips connecting to the drawing. We’ve made dark hot spots that have enough pencil lead to be conductive on the drawing’s arms, ears, and collar. The connections are as follows:

  • Grey alligator clip connects the left arm hot spot to the down arrow key
  • Red alligator clip connects the right arm hot spot to the up arrow key
  • Blue alligator clip connects the left ear hot spot to the left arrow key
  • Yellow alligator clip connects the right ear hot spot to the right arrow key
  • Green alligator clip connects the collar hot spot to the space key
  • The Black alligator clip connects common earth/ground to you – this is very important, if you don’t hold the black clip or connect it to you somehow, then you’re not making a complete circuit when you touch a hot spot.

Our program uses the block to control the robot to do the following: When any of the arms or ears are touched on the drawing, that arm or ear moves up/down. Each time the collar is touched, the lights change from green to red to blue.

Here’s a snippet of the program responsible for controlling the right arm. Whenever the up arrow key is pressed, the program checks a variable we have defined called “rightArmState”. If the variable is 0, the arm goes down and the variable gets changed to a 1; if the variable is 1 the arm goes up and the variable is changed to 0. We also wait for a quarter second at the end to keep from triggering this code too often; the technical term for this is debouncing. If we didn’t debounce and touched the hot spot for a fraction of a second it might still trigger our code four or five times.

Watch the following short clip to see the full program in action:


Using Vernier Sensors with the Hummingbird

Hummingbird kits contain sensors, but you can dramatically expand your measurement abilities by using the Hummingbird with sensor probes from Vernier. This page contains all the information that you will need to use selected Vernier sensors with the Hummingbird, but it does assume that you already know how to use Scratch or Snap!.

Vernier BTA Sensors

Analog Vernier sensors can be connected to the Hummingbird using the Vernier BTA Sensor Adapter. You can find a list of Vernier sensors here, and any sensor with an order code that ends in BTA is compatible with this adapter and can be used with the Hummingbird.

Getting Started

  1. To use a Vernier BTA sensor with the Hummingbird, first connect the Vernier BTA Sensor Adapter to a sensor port on the Hummingbird board.
  2. Next, connect the Vernier sensor to the adapter. In this tutorial, we will use the Vernier dual-range force sensor.
  3. Look through the documentation that came with your Vernier sensor. Find the section that gives the calibration parameters for the sensor. For most sensors, these will be a slope and an intercept. You can use these to create a linear function that relates the voltage of the sensor to units of the quantity that you are measuring. Here, we are using the force sensor with the ±10 N range. The slope is -4.9 N/V, and the intercept is 12.25 N. That means that we can use this equation to relate voltage to force in Newtons: force = -4.9*voltage + 12.25 N.
  4. We can also use this equation to find out the voltages that we should expect from the sensor. When the force is -10 N, the voltage is roughly 5 V (4.6 V). When the force is 10 N, the voltage is roughly 0 V (0.46 V). This means that we should expect voltages in the 0-5 V range. We set the jumper on the Vernier BTA sensor adapter to 0-5 V. Almost all Vernier BTA sensors will use the adapter with the jumper in this position. There are two exceptions, which are detailed in the Two Unusual Sensors section.
  5. Open Scratch or Snap!. In Scratch, you can use the HB voltage block to read the value of the sensor. This value will be a voltage between 0 and 5 V. In Snap!, you can use the Hummingbird Raw Sensor block. This block will give you a value from 0-100. To convert this value to voltage, you need to multiply it by 0.05.
  6. Declare a variable to hold the value that you are measuring. We have called our variable force. Use the calibration equation to convert the voltage to units of the quantity that you are measuring.
  7. Use a forever loop to update the value of the variable several times each second. Now, you are ready to graph the variable value on the screen or use it to control a robot!

Two Unusual Sensors

For most Vernier BTA sensors, the jumper on the adapter will be set to 0-5 V. The two exceptions are the voltage probe and the 30-Volt Voltage Probe. If you are using one of these sensors, place the jumper in the +10/-10 V position. Each of these sensors produces a voltage between -10 V and 10 V. The Vernier BTA Sensor Adapter includes a circuit that maps this voltage range to the 0-5 V range that the Hummingbird can read. You can use this equation to relate the Hummingbird voltage to the sensor voltage: sensor voltage = 4*Hummingbird voltage – 10.


You can incorporate a Vernier BTA sensor into a Hummingbird project as you would any other sensor. Alternatively, you can modify activities from the Vernier lab manuals to use the Hummingbird to collect data. Students can write programs to save this data in lists and plot it to the screen. In addition, these labs can be extended to include a building component. Two examples are given here.


3D Printing and Hummingbird

We love using arts & crafts materials to build robots, but one of the strengths of Hummingbird is that you can use the parts with any sort of building media. Enter 3D printing, one of the coolest ways to design and make parts for your Hummingbird robots!

To help kickstart your 3D printing explorations, BirdBrain Technologies friend Rich Juchniewicz has created a library of open-source, freely downloadable, editable, and printable parts that work well with parts from the Hummingbird kit. We’ll use this tutorial to share the STL files for our current library of parts. Please share with us any parts that you create, especially if they used one of our designs as a starting point!

If you have a 3D printer on-site, you can download an STL file for any of the parts below and print it yourself. If you don’t have a 3D printer, a number of websites will fabricate designs in plastic, ceramic, or even metal. Low-cost plastic prints can be had for as little as a few dollars, so purchasing a print online can be a reasonable option. One possibility is to upload an STL file to Shapeways, an online marketplace for custom 3D designs.

Models and Projects Library

To download an STL file for any of these projects, just click the picture!

Hummingbird Duo Case

Want your Hummingbird Duo to have a case? Print one!

Hummingbird Rover

This is a design for an entirely 3D printable Hummingbird Duo rover – the only additional building materials you’ll need are screws and velcro. This project was inspired by PK Graff’s class project where students designed and 3D printed their own Hummingbird rovers. Click here to see the rover in action!


A collection of spur and worm gears and a rack. All gears work with each other and mount to either the HS-311 servo or the GM2 gear motor found in the Hummingbird kit.


Two pulleys, one of 30 mm and one of 50 mm diameter. They can mount to either the HS-311 servo or GM2 gear motor and they will fit the o-ring gear motor wheel tire included in the kit.

Motor Mount

A mounting strap and base for the Hummingbird’s gear motor.

Gear Motor Wheel

A wheel for the Hummingbird’s gear motor. For a tire, we suggest this O-ring.

Gear Motor plastic blocks adapter

An adapter that allows you to attach plastic blocks and gears to the Hummingbird’s gear motor. You can also see this project at Shapeways.

Servo Mount

A mounting strap and base for the HS-311 servo included with the Hummingbird kit.

Perpendicular Servo Mount

To mount the HS-311 servo in a different orientation.

Servo Lego Peg Adapter

An adapter that will fit two lego pegs to the HS-311 servo. The pegs are spaced to easily attach a Lego 40 tooth gear or Lego pulley.

LED Diffuser Caps

An arrangement of caps for the LEDs included in the Hummingbird kit. Print with white plastic for best results.

Crank and Piston System

This project includes all the parts you need to investigate how to use cranks, connecting rods, and pistons with the Hummingbird.


Squishy Circuits

Squishy circuits are circuits made of conductive playdough. Watch the tutorial for an introduction to using Squishy Circuits with Hummingbird or jump past it for a quick reference on connecting items from the Squishy Circuits Kit to the Hummingbird.

Connecting LEDs

You can connect multiple LEDs to a single Hummingbird LED port through conductive playdough. The image to the right demonstrates two ways of connecting LEDs to the Hummingbird. On the left side five LEDs are pressed into a conductive dough sandwich – two disks of conductive dough with insulating dough in between them. The red top disk of dough is connected to the ‘+’ terminal of Hummingbird’s LED port 1. The bottom disk is connected through a black wire to the ‘-‘, or ground, terminal of LED port 1. The LEDs are inserted into the sandwich with the long leg of the LED in the red top disk and the short leg into the bottom disk. In general, you can safely hook up any number of LEDs to a single LED port, but each additional LED will make all LEDs a bit less bright. The LED circuit on the right shows three LEDs hooked up to tri-color LED port 2. A red LED is connected to the ‘R’ terminal, a green LED is connected to the ‘G’ terminal, and a blue LED is connected to ‘B’. The short legs of all three LEDs are inserted into yellow conductive playdough, which is connected through a black wire to the ‘-‘ terminal. This setup allows you to individually control each LED.

Connecting Motors

Connecting a motor with squishy circuits is very similar to connecting a regular motor to Hummingbird. In the picture on the right a motor is connected through two pieces of conductive playdough. The motor’s black wire is connected to blue playdough which is connected with a red wire to motor port 1’s ‘-‘ terminal. The motor’s red wire is connected to red playdough which is connected with a red wire to motor port 1’s ‘+’ terminal. Unlike the LEDs, the motor will spin if you reverse how it is connected (black wire to red playdough, red wire to blue playdough); it will just spin in the opposite direction. Warning: When connecting the playdough, make sure not to accidentally connect the two red wires coming from the motor terminals. To be completely safe, you should hook up this circuit with the Hummingbird’s motor power supply disconnected; just connect power as soon as you’ve hooked everything else up.

Connecting a Buzzer

We’ve found that we can control the piezo-electric buzzer in the Squishy Circuits kit with the Hummingbird’s vibration motor port. To do so, create two blobs conductive dough, put the red wire from the buzzer into one, and hook this blob up to the vibration motor’s ‘+’ terminal. Put the black wire from the buzzer into the other blob and hook it up to the vibration motor’s ‘-‘ terminal. We’ve found that you need to power the port to at least 60% before the buzzer turns on.

Connecting a Playdough Sensor

Did you know that you can use conductive dough as a sensor? You can sense whether someone is pulling a ball of dough apart, twisting it, or squishing it together. To create a playdough sensor, take a single ball of dough and stick a black wire and a red wire into opposite ends of the dough. Connect the black wire to a sensor port’s ‘-‘ terminal. Connect the red wire to the ‘S’ terminal (not the ‘+’ terminal). Now take a 470 ohm through-hole resistor, and push one lead of the resistor into the ‘+’ terminal of the sensor port. Put the other lead of the resistor into the ‘S’ terminal; there is enough space in the terminal for both the red wire and the resistor’s lead. The sensor will probably register a value of between 10 and 30 (in Snap!), pulling the playdough or twisting it will raise the sensor value, breaking it apart will bring it close to 100 (in Snap!), and pushing it together will lower it.

More Information

Learn much more about Squishy circuits at the project’s homepage, or buy a kit at the Squishy Circuits Store. Finally, watch Dr. AnnMarie Thomas’ very fun TED talk on Squishy Circuits:


Raspberry Pi

Raspberry Pi is a line of $5 to $35 palm-sized Linux-ready embedded computer. Attach a keyboard, mouse, load an operating system on an SD card, attach a monitor, and you have a top of the line computer circa 2004. We’re interested in Raspberry Pi because:

  • It’s a computer, so you should be able to hook it up to a Hummingbird or Finch and write code to control them.
  • It’s a computer, so you can make it wirelessly connect to other computers and the internet.
  • It’s a computer, and it’s small enough to fit under/on top of a Hummingbird.
  • It’s a computer, and it’s $5 to $35!

At the moment, you can write code to control the Hummingbird in Java, Python, and Snap! (from a remote computer). The Raspberry Pi isn’t exactly plug and play; it requires a little bit of work to setup, and a little more work to talk with our robots. This tutorial guides you through setting up a Raspberry Pi, configuring Java, configuring our software libraries, and running our example files. If you’ve already got a Raspberry Pi, please keep in mind that our instructions and code use the default Raspbian OS.

Before You Begin

Before you start, you’ll need the following:

  • A Raspberry Pi Model B or later
  • A 4 GB or greater SD card. Some cards may not work, see this page for a selection of tested cards.
  • A power source for the Raspberry Pi. If you plan to go mobile and want a battery, we recommend the Powergen PGMPP8400 or a similar battery. You may also use USB wall chargers to power your Raspberry Pi.
  • If you want to make your creation entirely mobile, you can also power motors and servos with a Hummingbird battery pack.
  • A USB wireless adapter. We use the Airlink101 AWL5088.
  • A Hummingbird or Hummingbird Duo.

* – Some keyboards, hubs, and wi-fi adapters do not work with the Raspberry Pi. Check this list for a full listing of tested devices.

Installing an Operating System on the Raspberry Pi

There are numerous ways to install an operating system on the Raspberry Pi; you can even buy an SD card preloaded with an OS. See this page for an exhaustive listing of guides to install an OS. Our favorite installation method uses the Berryboot installer. To install via Berryboot, follow these steps:

  • Before you begin, make sure you have an internet connection that the Raspberry Pi can access (Access to a wireless signal + a USB wireless adapter, or a router and an ethernet cable).
  • Connect your SD card to a host computer; you may need a USB SD card reader.
  • Download the zip file from the berryboot page, and extract its contents onto your SD card.
  • Plug the SD card into your Raspberry Pi, plug in a keyboard, mouse, monitor, USB wireless or ethernet cable (if ethernet is available, it is less likely to cause problems than wireless).
  • Power up your Raspberry Pi and watch it boot!
  • Select your SD card as the destination drive. Typically it will be the first option and will have a prefix of “mm”.
  • For Install operating system, choose the Debian Wheezy Raspbian option – the “offical” rPi Raspbian version.
  • Twiddle your thumbs for a while as it downloads and installs.
  • When it has installed, reboot the Raspberry Pi.
  • The first time Raspbian boots, it will allow you to set some configuration options. We leave the defaults alone, but ensure that the ssh server is enabled as we typically run the Raspberry Pi via a remote terminal.
  • Login with username “pi” and password “raspberry”
  • Upgrade all the packages in the OS by typing “sudo apt-get update” and then “sudo apt-get upgrade”. These commands may take 10 minutes to an hour or so to complete, and are optional but recommended (you may also do them at a later time, or try them if things aren’t working).

Software for Remotely Connecting to the Raspberry Pi

Most people wish to run Raspberry Pi’s through a remote connection, dispensing with the need for a monitor, keyboard, and mouse, and making the Pi much more portable. In order to run the Raspberry Pi remotely, you will want:

  • Software to determine the IP address remotely or admin access to a router to view the attached devices list
  • An SSH client program so that you can run programs on the Raspberry Pi
  • A file copy program so you can get software from the host
  • Possibly a remote desktop so that you display and manipulate the Raspberry Pi’s desktop without a monitor.

Software to determine IP Address

We have used Advanced IP Scanner on Windows and Angry IP Scanner on Mac and Linux. They work reasonably well, though you may need to work out the IP address from the Mac address of your USB wireless module or from the ethernet port. Note that you may also simply be able to log into your router and view the attached devices list.

Terminal Software

Once you know the IP address, you can log into your Raspberry Pi using ssh client software. Our favorite is Putty in Windows; in Mac and Linux you can simply type “ssh username@host” in any terminal window; for example, “ssh pi@”.

File Copy Software

To install Java or the BirdBrain Technologies software, it is easier to download the software to a host computer and then copy it over to the Raspberry Pi using file copy software. Our favorite is WinSCP in Windows, Cyberduck or Fugu on Mac. On Linux (and Mac) you can also use “scp username@host” from a terminal.

Remote Desktop Software

If you want to view the Raspberry Pi’s desktop from your host computer, you can use TightVNC. To get it, first ssh into your Raspberry Pi and issue the following command to install the program: “sudo apt-get install tightvncserver” Then whenever you wish to allow remote desktops, type “tightvncserver” The first time you run it, it will request you set up a password and other configuration options. Every time you run it you will see a message like: “New ‘X’ desktop is raspberrypi:1” Your Raspberry Pi is now broadcasting its desktop on the IP address of the pi:1. To view it, get a vnc viewer like the TightVNC viewer. When asked for the ip address, connect to the IP address of the Raspberry Pi appended by :1, or whatever number the message gave you when you ran tightvncserver.

Installing and Configuring Java

If you plan to compile and run Java or Snap! programs, you may need to install Java first. First check if java is installed by typing java -version at the command line. If you get a response, or if you’re using Python only you win! Skip directly to initial configuration for Hummingbird.

If you have an older system, follow these steps to install Java:

  • Do a system wide update with sudo apt-get update
  • Install Java with sudo apt-get install oracle-java7-jdk

If that doesn’t work, try the following instructions:

  • Download Oracle’s Java JDK 8 for ARM to a host computer
  • Using a file copy program, Copy the file over to your Raspberry Pi’s default home/pi directory. (click for screenshot).
  • Extract the files in the tarball with the following command – you may need to change the jdk name to the version you’ve downloaded:
  • Move the JDK from your home directory to the /opt/ directory and delete the tarball to conserve space:
  • Update the Java alternatives configuration:
  • Edit the file ~/.bashrc by typing “nano ~./bashrc” and place the following text at the end of the file:
  • Type java -version and make sure your output matches the following, if you get an error, restart your Raspberry Pi and try again after restart:

Initial Configuration for Hummingbird

  • On your host computer, download and unzip the BirdBrain Technologies Software for the Raspberry Pi.
  • Copy the folder BBTechSoftwareForPi to your Raspberry Pi’s home directory (see screenshot for detail).
  • Using a terminal, change directory to ~/BBTechSoftwareForPi
  • Make the Configure script executable and then run it with sudo (“chmod +x Configure” followed by “sudo ./Configure”). You should see the following output:

Compiling and Running Java Programs for Hummingbird

To compile a Java program for Hummingbird, type javac -classpath :libs/hummingbird.jar FILEPATH For example, if you wish to compile, you would use:

To run a Java program for Hummingbird, type java -classpath libs/hummingbird.jar: FILEPATH For example, if you wish to run KnobControlledOrbServo, you would use:

Compiling and Running Python Programs for Hummingbird

You can run python programs for the Hummingbird in two ways: You can compile and run a stand-alone python file, or you can run python in interpretative mode. To run a standalone file, simply type “python”. Three examples are included. Alternatively, you can run Python in interpretative mode and issue commands from the Hummingbird. To do so, simply type “python”, and then in the resulting Python prompt, type “from hummingbird import Hummingbird”. Create a Hummingbird object to read sensors and set outputs by typing “hummingbirdObjectName = Hummingbird()”. See the following output for an example:

If you need to discover the names of functions for getting sensor values or setting outputs, type “help(Hummingbird).”

Compiling and Running Hummingbird Snap! Programs

We have created a server that allows you to control the Hummingbird with the Snap! programming environment from a remote computer. Snap! is an in-browser visual programming environment based on Scratch.

To use the Hummingbird Server, you may need to first install Java on your Raspberry Pi.

Unlike our other software distributions, in this case you have the option to create programs on a host computer as well as on your Pi. You will start a server program on the Raspberry Pi that will expose the Hummingbird’s outputs and sensors over HTTP. On a computer on the same local network, you can then create programs in Snap! using our specialized blocks library.

We attempted to use Snap! directly on the Raspberry Pi, and the model 2 and 3 Raspberry Pis work, but the original model B and the zero are simply too slow.

Step 1: Start the server on the Raspberry Pi. Navigate to the HummingbirdServer directory in BBTechSoftwareforPi folder and type “java -jar HummingbirdServer.jar. Assuming a Hummingbird is plugged in, you should see the following:

Step 2: Navigate to on a computer connected to the same local network as the Raspberry Pi.

Step 3: Import the HummingbirdSnapBlocks.xml file by dragging it from a file browser onto the Snap! webpage, or by clicking the file icon and selecting Import

Step 4: Change the IP Address variable to the IP Address of the Raspberry Pi using the provided “set” block:

Note that the when you launched the server in step 1, the server IP address was printed in the terminal.

You are now ready to program the Hummingbird with Snap!.


Piezo Buzzers with the Hummingbird

When the Hummingbird is plugged into the computer, you can use the computer speakers to add sound to your project. Another alternative for adding sound is to use a piezoelectric buzzer, and this tutorial will show you how! This is particularly helpful if you plan to run in Arduino mode (not connected to the computer). We will use the CREATE Lab Visual Programmer here because we want to export our project to Arduino, but the buzzer will work with any of the programming languages you can use with the Hummingbird. Also, this tutorials assumes that you are using a Hummingbird Duo. Only the Hummingbird Duo can run programs in Arduino mode, but the buzzer can also be used with the original Hummingbird.

First, you will need a buzzer. We used one like this, but any buzzer than can accept an input voltage from 0-5 V should be fine. Attach the red buzzer wire to the ‘+’ terminal of a Hummingbird LED port, and attach the black wire to the ‘-’ terminal.

Next, open the CREATE Lab Visual Programmer and select the LED port of your buzzer. You can move the slider bar to change the buzzer’s sound. The buzzer is off when the slider is all the way to the left (0).

We created three expressions: Piezo Low, Piezo High, and Piezo Off. We added some single color LEDs to these expressions as well. We used these expressions to create an alarm controlled by the distance sensor. When someone or something is near the sensor, the buzzer should alternate between Piezo Low and Piezo High. Otherwise, the buzzer should be off. A sequence for this behavior is shown below.

Once you have a sequence that you are happy with, you can use the Export Sequence button to export the sequence to Ardunio code. The main loop for our Arduino code is shown below. From the Arduino software or Codebender, you can put your Hummingbird Duo into Arduino mode and upload your program. More information on exporting to Arduino can be found here.

After testing our program, we made a sign that incorporated the distance sensor, two red LEDs, and the piezo buzzer. The Hummingbird board sits behind the sign on top of the battery pack. Now this portable project can be used to alarm anything!

Let us know what you decide to make with a piezo buzzer! Send us an email or tag us on Twitter (@birdbraintech).

Technical Note: The LED ports on the Hummingbird are actually controlled using pulses of voltage that form a wave (pulse-width modulation). The command to the LED port determines the width of the pulse from 0% to 100% of the wave period. Because the frequency of this wave is faster than our eyes can perceive, we see the brightness of the LED increase as the width of the pulse increases.

Most piezoelectric buzzers are designed to run with a DC voltage. If you turn on a buzzer with batteries, the buzzer always vibrates at the same sound frequency; the voltage of the batteries just determines the volume. When you control the buzzer with a Hummingbird LED port, you can change the pitch of the buzzer by changing the input to the port. This is because the wave output of the LED port is interacting with the frequency at which the buzzer is designed to vibrate. Resonance or interference between these waves changes the sounds that you hear.


Grove Sensors with the Hummingbird

Hummingbird kits come with their own sensors, but there are a lot of other sensors that you might want to try out. Seeed Studio makes a wide variety of inexpensive sensors, and their Base Shield V2 will enable you to use their analog sensors with the Hummingbird. This tutorial will show you how to use this shield with several different Grove sensors.

Important Notes: The Base Shield V2 is an Arduino Shield. It can be used with the Hummingbird Duo, but not the original Hummingbird. Also, you can only use analog Grove sensors, not digital ones.


Start by pushing the shield into the Arduino side of the Hummingbird. The shield pins do not go all the way into the ports.

Next, connect a Grove analog sensor to analog port A1, A2, or A3 on the shield. These are the only ports that you can use with the Hummingbird. In the picture below, the Grove moisture sensor is connected to analog port A1.

Programming in Scratch

Analog ports A1, A2, and A3 on the shield correspond to sensor ports 1, 2, and 3 on the Hummingbird. In Scratch, you can access the value of a sensor using the HB voltage block. The script below continually updates a variable that contains the value of the moisture sensor and also makes the sprite state the value of the variable. The math blocks are used to round the sensor value to two decimal places.

You may also want to make decisions based on the value of the sensor. The script below uses the value of the moisture variable to judge how wet a plant’s soil is.

It may also be helpful to graph the value of the sensor so that you can see how its value changes over time. An example script is shown below. This script uses a variable x that corresponds to a location on the x-axis. A repeat block plots the value of a sensor or each value of x and then increases the value of x by 1. The value of the sensor is scaled by 100 to make it easier to see changes in the graph. 

We decided to use three Grove gas sensors to test the air quality around our 3D printer. We used the MQ2, MQ3, and HCHO sensors. These sensors enabled us to detect a number of chemicals, including alcohol, smoke, and methane. We plotted the mean value of each sensor over time. The graph below shows the response of the sensors to a bowl of rubbing alcohol placed nearby.

We tested our setup for rubbing alcohol, water, Listerine, vinegar, and smoke. Then we tried it out while we 3D printed a gear. Check out our results in the video below!


Controlling Robots with Muscle Signals

You may have controlled a Hummingbird robot with a sensor, but have you ever controlled a robot by detecting the electrical signal from your own muscles? When we saw this video by Tim Hurt from the Lawrence Hall of Science, we knew we had to try it for ourselves. Many thanks to Tim for this inspired idea!

When you contract a muscle, it produces an electrical signal. You can use electrodes to measure this signal; this is called electromyography, or EMG. If you measure the muscle signal with the Hummingbird, you can use it as a sensor. This tutorial will show you how to measure the electrical signal, plot the value to the screen, and use it to control a robot.

1. Using a Shield

This tutorial requires some extra equipment. First, you need a Muscle SpikerShield from Backyard Brains. You probably also want to buy some extra electrodes, because the shield only comes with enough disposable electrodes for two attempts. This experiment from Backyard Brains also has a lot of useful information about the MuscleSpikerShield.

The Muscle SpikerShield is a shield for an Arduino. It can be used with the Hummingbird Duo, but not with the original Hummingbird.

The Muscle SpikerShield is designed to use analog pin A0 on the Arduino Uno. Unfortunately, this pin is already being used by the Hummingbird for something else (LED port 4). To fix this problem, bend the A0 pin on the shield so that it points out from the board. Then use a small piece of wire to connect pin A0 to pin A1. Now you will be able to read the muscle signal through pin A1, which is sensor port 1 on the Hummingbird.

Next, attach the Muscle SpikerShield to the bottom side of the Hummingbird. The shield pins do not go all the way into the ports on the Arduino. You can also attach the electrode cable to the shield.

2. Attaching Electrodes

The other end of the electrode cable has three alligator clips. These will be attached to disposable electrodes that you place on your arm. These electrodes have adhesive that will let you stick them to your skin, but they are disposable, so you can only use them once.

The electrical signals produced by muscles are very small and easily obscured by electrical noise. To maximize the amount of muscle signal and minimize the amount of noise, you need to be very careful about how you place the electrodes. The skin should be clean and free of both hair and lotions.

Two electrodes should be placed on the muscle you want to record. For this example, they were placed on the biceps. The two electrodes should be side by side and along the length of the muscle. For example, the biceps runs from the shoulder to the elbow, so the two electrodes are side by side along a line connecting the shoulder and the elbow. Also, make sure you place the electrodes over the main part of the muscle. You may want to consult an anatomy website or textbook.

The third electrode should be placed over a bony part of the body, like the side of the wrist. The two red alligator clips should be connected to the electrodes on the muscle, and the black alligator clip should be connected to the electrode over bone.

3. Processing Data

Basically, the Muscle SpikerShield measures the voltage between each red electrode and the black electrode (ground). It then subtracts these voltages to find the change in voltage across the muscle. When you see a spike in the voltage difference, that is the electrical signal produced by your muscle as it contracts. For more information, please see Surface Electromyography: Detection and Recording, particularly the excellent diagram on page 4.

In Scratch, you can use the HB voltage block to read the voltage your muscle is producing.

Start by graphing this data to get an idea of what the signal looks like. The script below will plot approximately 15 s of muscle data on the Scratch stage. If you like, you can modify this program so that when the graph reaches the right side of the screen, it begins again from the left side. That way, the program will continually graph your muscle signal. In this script, we have scaled the muscle voltage by multiplying it by 100; you may need to adjust the scaling factor in your script.

As you look at your graph, you will see that it looks very noisy. You can eliminate some of this noise by taking an average of 10 muscle voltage measurements. To do this, declare variables named sum and mean. Then you can use the code below to find the mean in the repeat until loop. Be sure to change your program so that you graph mean instead of the HB voltage block.

Now your graph should look something like this one. When you are sitting still, you will see small spikes. These are noise. When you contract your muscle, you should see larger spikes. To get a good contraction, it can be helpful to clench your fist or push against something. If you can’t see any muscle spikes, you may need to try new positions for the electrodes (this will require new electrodes).

4. Using the Muscle Signal

Once you have a reliable muscle signal, you can use it to control a robot. In this example, we used a model of the elbow. This model shows the bones of the arm. It includes two motors with pulleys attached. The right motor represents the biceps muscle, while the left motor represents the triceps muscles. When the program detects a spike in the voltage of the biceps muscle, it sets the motors to flex (bend) the arm. The ‘e’ key was used to extend (straighten) the arm, since we could only measure one muscle signal. Sample code is given above. The if statement below was used to flex the elbow. The and statement was used to keep the arm from flexing and extending at the same time.

In this example, we chose to use motors, but you can also use the muscle signal to control lights, sound, or servos!


Circuit Scribe and Hummingbird

Circuit Scribe is a pen that writes with conductive ink. It was developed by Electroninks. You can use it to draw circuits on paper! There are a lot of interesting things you can do with Circuit Scribe, but this tutorial will focus on how to use it with the Hummingbird. In the process, you will learn a little bit about how the Hummingbird sensors work.

Basic Circuit Scribe Circuit

Use the Circuit Scribe to draw the circuit shown below. The circuit diagram is also shown. This circuit includes a battery (CR2032), a resistor, and an LED (no Hummingbird yet). A 200 ohm resistor was used here, but anything from 100 ohms to 50 kohms should be fine. Magnetic Circuit Scribe connectors are used to connect the battery to the circuit. You will need to place a steel sheet (in this case, a cookie sheet) behind the circuit to hold the connectors in place.

To attach the resistor and the LED to the circuit, draw two filled circles with a gap between them. Then use Scotch tape to attach the resistor or LED to these circles. It may be helpful to bend the metal legs of the components to get a larger connection area.

Notice that the circuit above is open at the lower right corner. Current cannot flow. When the corner of the paper is folded, the circuit is closed and current can flow. The corner of the paper is like a button that can be used to turn the LED on and off.

To ensure that the switch would close properly, a straight pin was used to mark the position of the circles of conductive ink, as shown below.

Adding the Hummingbird

To integrate the Hummingbird with the Circuit Scribe, first remove the battery. Use the CircuitScribe connectors to couple the ‘+’ and ‘-’ ends of the circuit to the ‘+’ and ‘-’ terminals of sensor port 1 on the Hummingbird. Make sure the Hummingbird is attached to the computer with the USB cable. Now, the Hummingbird provides power to the circuit! You should still be able to use the switch to turn the LED on and off.

You can also use the Hummingbird to enable the computer to measure whether the switch is open or closed. Draw a new circle of conductive ink and use a third Circuit Scribe connector to couple it to the ‘S’ terminal of sensor port 1. This circle should be connected to the circuit between the resistor and the switch.

Compare the diagram below to the circuit that you have been working with. This image shows the circuit schematics for the Hummingbird light and temperature sensors. These sensors are represented by the variable resistors labelled “CDS” and “TEMP,” respectively. How are these similar to your circuit?

Programming with Circuit Scribe and the Hummingbird

In this tutorial, we will describe how to use your switch to control a motor in Scratch and in the CREATE Lab Visual Programmer. However, feel free to use another programming language if you prefer!

In Scratch, create a variable named voltage 1. Use the program below to set this variable equal to the voltage at the ‘S’ terminal of sensor port 1.

When you open and close the switch, you should see the value of voltage 1 change. When the circuit is open, the value should be close to 0 V. When the circuit is closed, the value should be larger. The exact value will vary based on the value of the resistor and the resistance of the Circuit Scribe traces. For the circuit shown here, the high value was approximately 1.5 V.

Now you can use the switch like any other Hummingbird sensor! The program below uses the switch to turn a motor on and off.

In the CREATE Lab Visual Programmer, you can create a sequence that uses the switch as a sensor. Select Raw Value for the type of sensor.

Open and close the switch to see the maximum and minimum values. Then move the blue slider to set the threshold midway between the maximum and minimum values.

Using Multiple Switches

You may want to create a Hummingbird project with multiple paper switches! To reduce circuit complexity and use fewer Circuit Scribe connectors, you can use a common ‘-’ trace. Connect this trace to the ‘-’ terminal of one sensor port to ground all the sensors. This is shown in the wiring diagram below. However, each switch does need a separate power supply; the switch connected to sensor port 2 must be powered by that port. Experiment to find out what happens when you use the same ‘+’ terminal to supply power to two switches!

It is very helpful to test your circuit as you add switches to it. The circuit below contains two switches. A coin was used to close each switch for testing. As you add switches to your circuit, create a variable for each switch in Scratch. Use a forever loop to continually set the value of each variable to the voltage at the corresponding sensor port. Test that the voltage rises when the switch is closed.

The circuit below contains four switches using a total of nine Circuit Scribe connectors. By itself, this circuit doesn’t do anything particularly interesting. It is time to add some Hummingbird motors and lights!

Up to this point, you have been placing your paper circuit on a metal surface. This won’t work well with the Hummingbird components, because you will want to be able to easily make holes for the wires and motors. Instead of a metal plate, you can use metal brads to keep the Circuit Scribe connectors in place.

Here is the finished project. It contains single color LEDs, tri-color LEDs, a servo motor, and a gear motor. Each of the four switches operates different components. To see this project in action, watch the video above.

What can you make by combining Circuit Scribe and the Hummingbird? Send us a picture or video of your creation!