Explore Google Earth

 
 

Hover can be combined with an Arduino to make a gesture controller for any computer.  In this example, we're going to create a sketch to browse Google Earth by hand gestures. Spin the globe with a simple hand swipe and tap to zoom in/out. 


 

Connect Hover to Arduino

Here is the simplified version on how to wire up your Beam to the Raspberry Pi

  • HOST_V+:  If you're using a 5V Arduino like the UNO, Leonardo, etc, connect the HOST_V+ pin on Hover to the 5V pin on Arduino. If you're using a 3V3 Arduino like some versions of the Lilypad, connect the HOST_V+ pin to the 3V3 pin on Arduino.   
  • RESET and TS:  These pins are used by the library to configure Hover. These can be connected to any GPIO pins of the Arduino but the default library uses D6 for RESET and D5 for TS. 
  • SCL and SDA:  The I2C pins are used to read data from Hover.  If using the Arduino Uno, connect SDA to A4 on the Uno and SCL to A5 on the Uno. If using other boards like the Leonardo, connect SCL/SDA on Hover directly to the pins labeled SCL/SDA on Leonardo. Hover has on board logic level shifting so you can use it with 5V or 3.3V platforms without needing additional logic converters in between. 
  • 3V3 and GND:  The 3.3V power supply and ground pins used to power Hover. Connect these to the 3.3V and GND pins on Arduino. 

 

Run the Example Sketch

First, let's run the sketch before we dig into the code. In the /examples folder of the Hover library, you'll find a Hover_GoogleEarth_example.ino sketch. Upload this sketch to your Arduino and then load Google Earth either in the web or desktop app from here. Wait a few seconds for Hover to initialize and get ready. 

Next, make sure the window focus is on the Google Earth window (left click on the window to keep focus on it). 

Now start browsing planet earth with gestures! Try the following: 

  • Swipe your hand in the right or left direction to spin the earth. 
  • Tap the center pad to stop spinning. 
  • Tap the north and south electrode to zoom in and out. 

Understanding the Code

The first change required is to add Keyboard.begin() in setup() as shown here. This line initializes the keyboard library and allows the Arduino to essentially act like a keyboard. 

void setup() {
  Serial.begin(9600);
  delay(4000);
  Serial.println("Initializing Hover...please wait.");
  hover.begin(ts, reset);   
  Keyboard.begin();  
}

You're all set

Hopefully at this point, your project is working as expecting.  If not, try going back to the Hover Basics guide.  If all else fails, you can always contact us at support@hoverlabs.co