# Angles with Hummingbird

Practice moving a servo to different angles using the Hummingbird.

#### Programming Language

Snap! Level 4, Scratch

Math

4-5, 6-8

#### Standards

This activity meets Common Core math standards that involve measuring and constructing angles (4.MD.C and 4.G.A).

Teacher Note: This is a short introductory activity designed to introduce students to the servo motor. Students construct a large protractor and investigate how to write a program that moves the servo motor to different angles. To save time, you could do this activity as a demonstration or have students use a photocopied image of a protractor. However, having students create the protractor reinforces Common Core math standards for measuring and constructing angles (4.MD.C and 4.G.A).

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°. In this activity, you will practice moving the servo motor to different angles.

Start by using a protractor to draw 13 angles from 0° to 180°, as shown in the picture below. Draw an angle every 15° from 0° to 180°. Make sure that 0° is on the left side of the paper.

Attached your motor to a small box to give it a stable base.

Next, use hot glue to attach your angle drawing to the back of the motor. Try to position the origin of the angles directly behind the screw in the center of the white disk.

Next, connect the servo motor to the Hummingbird. The servo motor plug should be placed on one of the four male servo connectors on the Hummingbird board. The black wire should be connected to the ‘-’ pin, the red wire to the ‘+,’ and the yellow wire to the ‘S.’ When using the servo motor, you must also use the AC power adapter (or a battery pack). Otherwise, the Hummingbird board will not have enough power to run the motor.

Set your servo motor to 90°. In Scratch or Snap!, you can use a script like the one shown below.

Glue a popsicle stick to the motor so that it is pointing to 90°.

Try writing scripts to move the motor to different angles. If you write a script with more than one angle, make sure to put a wait block between the HB servo blocks. If you omit the waitblock from the script below, the servo will not have time to move to 90° before the command to move to 30°.

The script below is supposed to move the servo motor repeatedly to two different angles, but there is a problem. Try out this script, and figure out how to correct it.

Write a script that repeatedly moves the motor to five different angles. Try adding some lights or music!