Blog Home

Build an automatic cat treat dispenser with Hummingbird

Arduino TeamJanuary 25th, 2017
cattreat01

The Hummingbird by BirdBrain Technologies is an Arduino AtHeart microcontroller designed to enable beginners to create robots from craft materials. Hummingbird kits include LEDs, motors, and sensors that connect directly to the board. This eliminates the need for soldering or breadboarding and ensures that users have the parts they need to build their first robots. All of the components are reusable, so the same kit can be used to build many different robots.

In addition, the Hummingbird supports a variety of programming options, making it appropriate for beginning programmers as well as those who are more advanced. Some programming languages, such as Scratch and Snap!, can only be used when the board is connected to the computer. We will concentrate here on programming alternatives that enable users to upload a program onto the board’s Arduino.

Classrooms all over the world have used the Hummingbird from elementary to high school for projects ranging from Shakespeare dioramas to the physics of amusement park rides. In the following project, the BirdBrain Technologies team will show how they used the Hummingbird to build an automatic cat treat dispenser and demonstrate how the Hummingbird can be utilized to construct robots from everyday materials.

Building with the Hummingbird
Beginners can easily get started building Hummingbird robots with cardboard and craft materials. Motors, sensors, and LEDs can be connected directly to the Hummingbird board, and these elements can be added to the robot with hot glue. Hot glue peels off the components so that they can later be reused.

The example project uses one servo motor, one single color LED, and a light sensor. The dispenser consists of a servo motor attached to craft sticks that block the bottom of a chute containing cat treats. The position of the servo motor can be changed in software to release treats.

To receive a treat, the cat must cover a light sensor in front of the chute. When the cat covers the sensor, the servo motor briefly moves to open the chute and dispense a treat. The LED was included to show our test cat the location of the light sensor.

cattreat02

Programming with the Hummingbird
One unique feature of the Hummingbird is that it supports three different programming options for producing an Arduino program. These options provide steps of increasing difficulty to support learners as they transition from programming novices to Arduino experts.

Beginners can start with the CREATE Lab Visual Programmer. This software option is based on storyboarding. Users can select the motors and LEDs that they are using on a schematic of the Hummingbird board. Then they can create expressions by using sliders to set the values of these outputs. The expression below sets a servo motor to 100°.

cattreat03

Expressions can be combined to create sequences. For example, the sequence below controls our automatic cat treat dispenser. This sequence is controlled by a sensor block. If the light level is low, the three expressions on the left are executed. If the light level is high, the three expressions on the right are executed. The user can then convert this sequence to an Arduino program by simply clicking the “Export Sequence” button (shown outlined in red). The Hummingbird can then be placed into Arduino mode and the program uploaded to the microcontroller.

cattreat04

Another option for beginners is ArduBlock, which provides a visual introduction to the Arduino language. The Hummingbird extension for ArduBlock includes a block for each Hummingbird component. A program in ArduBlock to control the treat dispenser is shown below. This program is equivalent to the CREATE Lab Visual Programmer sequence shown above.

cattreat05

The Arduino code generated by this ArduBlock program is shown below. Individuals moving from the CREATE Lab Visual Programmer or ArduBlock to Arduino can start by modifying the generated code. For example, in the video we modified the commands inside the else to make the LED blink to attract the cat’s attention.

cattreat06

Once individuals are comfortable with the Arduino programming language, they can create more complex programs in Arduino. For instance, the video shows how we modified our robot and our code to incorporate three lights and three sensors. To get a treat, the cat must cover the sensor when the corresponding light is on.

The cat treat dispenser is only one example of a Hummingbird robot using the power of the Arduino at its core. The parts can be used and reused to construct an unlimited number of robots with low-cost materials such as cardboard, pipe cleaners, recycled materials, and even paper mache!

Categories:Arduino