Arduino Esplora Flight Simulator




Introduction: Arduino Esplora Flight Simulator

About: Technologist, Electronic Engineer, sometime Coderdojo mentor.

Control the Flight Simulator option of Google Earth using the Accelerometer of the Arduino Esplora.

Fly virtually around the world; tilting the Accelerometer forward, back, left and right to control the Plane's Pitching and Banking.

If you don't have Google Earth on your PC download it from here:

BTW, you if you don't want to agree to Google Chrome becoming your Default Browser UNCHECK the box at the License Agreement stage.

Step 1: You Will Need

Arduino Esplora.

You can download the required code here.

Step 2: Esplora Code

  Esplora Google Earth Flight Sim
 This  sketch shows you how to read the values from the accelerometer to
 control your Mouse.  Mouse is active/inactive on SWITCH_4 Press.
 Use with Google Earth Flight Sim Mode
 This example is in the public domain.

#include <Esplora.h>

int state = 1;
int state_old = 1;
int mode = 0;
int xAxis, xAxis_old = 0;
int yAxis, yAxis_old = 0;
int zAxis, zAxis_old = 0;

void setup()

void loop()
  state = Esplora.readButton(SWITCH_4);
  if (state_old && !state) {
    mode = !mode;
    if (mode) {
      Mouse.begin();            // take control of the mouse
      Keyboard.begin();;          // Click to use Mouse Control in Sim
    else {
  // Throttle ++
  if (!Esplora.readButton(SWITCH_3)) {;
  // Throttle --
  if (!Esplora.readButton(SWITCH_1)) {;
  xAxis_old = xAxis;
  yAxis_old = yAxis;
  xAxis = Esplora.readAccelerometer(X_AXIS);    // read the X axis
  yAxis = Esplora.readAccelerometer(Y_AXIS);    // read the Y axis
  int delta_x = xAxis-xAxis_old;
  int delta_y = yAxis-yAxis_old;
  if (mode) Mouse.move(-5*delta_x, 2*delta_y, 0 );

  delay(10);              // wait half a second (500 milliseconds)

Step 3: Enjoy

1. Open Google Earth

2. Start the Flight Simulator mode (Tools-> Enter Flight Simulator) or (Ctrl+Alt+A)

3. Best to Select the SR22 Aircraft to start with. It's easier to control.

4. Centre your mouse in the Google Earth Screen

5. Press SWITCH 4 on the Esplora to Take Control of the Mouse

6. Tilt your Arduino to Control the Plane. Backwards to Climb, Forwards to Descend etc...
KeyBoard Controls:
PgUp : Speed ++  (or SWITCH 1)
PgDn : Speed--  (or SWITCH 1)
Space: Pause
More details in Google Earth Help

7. Press SWITCH 4 on the Esplora again to Relinquish control of the Mouse.

Have fun!!

Be the First to Share


    • Fruit and Veggies Speed Challenge

      Fruit and Veggies Speed Challenge
    • DIY Summer Camp Contest

      DIY Summer Camp Contest
    • Maps Challenge

      Maps Challenge



    Tip 2 years ago

    You can also try to implement the Joystick librarie for arduino's based on the 32u4 (such as the Esplora and the Leonardo). If you apply this librarie, then your arduino will show up as a Joystick in Google Earh.

    Ps: I love where you're going with this project.