(Extra) The Finch Robot

In this note, we are going to look a the Finch robot. The Finch is an easy-to- use robot that cost about $100 each. Not only can they move around, but they have obstacle, light, acceleration, and temperature sensors. Plus, they can play tones, and have a nose-cone that lights up in any RGB color.

The Finch robot.

The original design goal of the Finch was to create a cheap, easy-to-use robot that beginning programmers could use in their first programming course. Instead of buying a $100 textbook, students buy a Finch and then learn by writing programs for it. While it does not seem to have become popular in teaching (yet?), it is still a fun and easy way to get learn a little bit about how to write programs that control hardware.

The Finch robot and its sensors.

Using the Finch in Processing

To use the Finch in Processing is relatively easy. After you install the Finch code library, you plug a Finch into your computer via a USB port, and then run a program.

For example, this program causes the Finch to beep repeatedly (sounding like an alarm) if you turn it over:

import edu.cmu.ri.createlab.terk.robot.finch.*;

Finch finch;   // initially null

boolean upsideDown;

void setup() {
  finch = new Finch();
}

void draw() {
  if (finch.isFinchUpsideDown()) {
    if (upsideDown) {
      finch.buzz(262, 100); // 262 Hertz (middle C) for 100 milliseconds
    } else {
      upsideDown = true;
    }
  } else {  // finch is right-side up
    if (upsideDown) {
      upsideDown = false;
    }
  }
}

The Finch robot is accessed through the finch variable. If the Finch is not plugged into the computer, then this program will crash.

The expression finch.isFinchUpsideDown() asks the Finch if it is currently upside down. If it is, then it returns true; if it’s not, it returns false. The variable upsideDown is used to remember the state of the Finch so that the program can recognize when it goes from upside down to right-side up, and vice-versa.

While this program is simple, it is actually quite useful: it shows how you can use the Finch as an “alarm”. It’s not hard to think of interesting modifications. For instance, instead of triggering the alarm when the Finch is turned over, you could trigger it when the clock on the computer reaches a certain time. And you could also make it, say, move forward when the alarm goes off. Now you have an alarm clock that runs away when it goes off (so you can’t easily turn it off).