Monday, February 11, 2008

Prototyping a Tangible Interface for Google Earth

As I mentioned in a previous post, students in my digital history grad class this year are working in teams to create interactive exhibits that involve physical computing. Since none of the students have much prior experience with programming or electronics, I'm providing a bit of the scaffolding to help them realize their designs.

The design. One of the groups imagined an interface consisting of a handheld globe. As you touch a point on the surface of the globe, a computer display responds by orienting a corresponding digital globe to focus on that place, and then opens some panels with information about an event that happened there. They decided that Google Earth would make a good software platform. I left them to the task of creating their exhibit materials in the XML-based Keyhole Markup Format (KML) that Google Earth uses.

Hardware. The exhibit will be mounted on a laptop running Windows. For the tangible interface we're using an Arduino microcontroller board. Normally-open pushbutton switches are connected to the digital inputs on the Arduino with 10K pull-down resistors. We debounced the switches in software, by reading their value twice at 10ms intervals. The Processing program that runs on the Arduino is here. It maintains the state of the last button pressed, and sends it repeatedly over a serial connection to the PC. (If you'd like to try making something like this yourself, Lady Ada's Arduino Tutorial is a great place to start).



Python glue. We needed a program to sit in between the Arduino and Google Earth, collecting information from the former and using it to control the latter. Python is ideal for this. First we installed the Python for Windows extensions and the Python Serial Library. We were then able to control Google Earth via the COM API. Our Python test program is here. It first defines two functions, one to orient Google Earth to the main gates of the University of Western Ontario, and one to orient it to Uluru (Ayers Rock) in Australia. The program then initializes the serial port and Google Earth. Finally it enters an infinite loop, reading the serial port and calling one of the two navigation functions when the corresponding button is pressed. (If you'd like to use Python to control Google Earth, François Schnell has a very useful page.)

Testing. I was quite impressed with how crisply the whole system works together. To get it running, you go through the following steps.

  1. Build and test the button circuit, then connect it to the Arduino.
  2. Start the Arduino software on the PC.
  3. Compile the Arduino program and download it to the board.
  4. Run the Python program. It will start Google Earth automatically in full screen mode.
  5. Once Google Earth has finished initializing, you can press the buttons to navigate within the program.


The final exhibit for our class will be mounted in April. You will be able to read more about it on the students' blogs and at the exhibit website. I'll write about some of the other components in future posts.

Tags: | | | | |