 }
 
 int readMotion() {
-    // MPU6050
-    // class default I2C address is 0x68
-    // specific I2C addresses may be passed as a parameter here
-    // AD0 low = 0x68 (default for InvenSense evaluation board)
-    // AD0 high = 0x69
-    MPU6050 mpu6050(0x68);
-    mpu6050.initialize(); // Initialize MPU6050...
-    ACCELOK = mpu6050.testConnection(); // ...and verify connection
+    FOXFIRE_MPU9150 mpu9150;
+    ACCELOK = mpu9150.begin(mpu9150._addr_motion); // Initialize MPU9150
 
     if (ACCELOK)
     {
-        // read raw accel/gyro measurements from device
-        mpu6050.getMotion6(&ax, &ay, &az, &gx, &gy, &gz);
+        // Clear the 'sleep' bit to start the sensor.
+        mpu9150.writeSensor(mpu9150._addr_motion, MPU9150_PWR_MGMT_1, 0);
+
+        // Set up compass
+        mpu9150.writeSensor(mpu9150._addr_compass, 0x0A, 0x00); //PowerDownMode
+        mpu9150.writeSensor(mpu9150._addr_compass, 0x0A, 0x0F); //SelfTest
+        mpu9150.writeSensor(mpu9150._addr_compass, 0x0A, 0x00); //PowerDownMode
+
+        mpu9150.writeSensor(mpu9150._addr_motion, 0x24, 0x40); //Wait for Data at Slave0
+        mpu9150.writeSensor(mpu9150._addr_motion, 0x25, 0x8C); //Set i2c address at slave0 at 0x0C
+        mpu9150.writeSensor(mpu9150._addr_motion, 0x26, 0x02); //Set where reading at slave 0 starts
+        mpu9150.writeSensor(mpu9150._addr_motion, 0x27, 0x88); //set offset at start reading and enable
+        mpu9150.writeSensor(mpu9150._addr_motion, 0x28, 0x0C); //set i2c address at slv1 at 0x0C
+        mpu9150.writeSensor(mpu9150._addr_motion, 0x29, 0x0A); //Set where reading at slave 1 starts
+        mpu9150.writeSensor(mpu9150._addr_motion, 0x2A, 0x81); //Enable at set length to 1
+        mpu9150.writeSensor(mpu9150._addr_motion, 0x64, 0x01); //overvride register
+        mpu9150.writeSensor(mpu9150._addr_motion, 0x67, 0x03); //set delay rate
+        mpu9150.writeSensor(mpu9150._addr_motion, 0x01, 0x80);
+
+        mpu9150.writeSensor(mpu9150._addr_motion, 0x34, 0x04); //set i2c slv4 delay
+        mpu9150.writeSensor(mpu9150._addr_motion, 0x64, 0x00); //override register
+        mpu9150.writeSensor(mpu9150._addr_motion, 0x6A, 0x00); //clear usr setting
+        mpu9150.writeSensor(mpu9150._addr_motion, 0x64, 0x01); //override register
+        mpu9150.writeSensor(mpu9150._addr_motion, 0x6A, 0x20); //enable master i2c mode
+        mpu9150.writeSensor(mpu9150._addr_motion, 0x34, 0x13); //disable slv4
+
+        // Read all sensor values which the sensor provides
+        // Formated all values as x, y, and z in order for
+        // Compass, Gyro, Acceleration. The First value is
+        // the temperature.
+
+        tm = ( (double) mpu9150.readSensor(mpu9150._addr_motion, MPU9150_TEMP_OUT_L, MPU9150_TEMP_OUT_H) + 12412.0 ) / 340.0;
+        cx = mpu9150.readSensor(mpu9150._addr_motion, MPU9150_CMPS_XOUT_L, MPU9150_CMPS_XOUT_H);
+        cy = mpu9150.readSensor(mpu9150._addr_motion, MPU9150_CMPS_YOUT_L, MPU9150_CMPS_YOUT_H);
+        cz = mpu9150.readSensor(mpu9150._addr_motion, MPU9150_CMPS_ZOUT_L, MPU9150_CMPS_ZOUT_H);
+        ax = mpu9150.readSensor(mpu9150._addr_motion, MPU9150_ACCEL_XOUT_L, MPU9150_ACCEL_XOUT_H);
+        ay = mpu9150.readSensor(mpu9150._addr_motion, MPU9150_ACCEL_YOUT_L, MPU9150_ACCEL_YOUT_H);
+        az = mpu9150.readSensor(mpu9150._addr_motion, MPU9150_ACCEL_ZOUT_L, MPU9150_ACCEL_ZOUT_H);
+        gx = mpu9150.readSensor(mpu9150._addr_motion, MPU9150_GYRO_XOUT_L, MPU9150_GYRO_XOUT_H);
+        gy = mpu9150.readSensor(mpu9150._addr_motion, MPU9150_GYRO_YOUT_L, MPU9150_GYRO_YOUT_H);
+        gz = mpu9150.readSensor(mpu9150._addr_motion, MPU9150_GYRO_ZOUT_L, MPU9150_GYRO_ZOUT_H);
     }
 
     return ACCELOK ? 1 : 0;

    Spark.publish("PreTAlt", String(PreTAlt), SLEEP_DELAY, PRIVATE); delay(EVENTSDELAY);
    Spark.publish("AmbiTnH", String(AmbiTnH), SLEEP_DELAY, PRIVATE); delay(EVENTSDELAY);
    Spark.publish("UVVisIR", String(UVVisIR), SLEEP_DELAY, PRIVATE); delay(EVENTSDELAY);
    Spark.publish("AcclXYZ", String(AcclXYZ), SLEEP_DELAY, PRIVATE); delay(EVENTSDELAY);
    Spark.publish("GyroXYZ", String(GyroXYZ), SLEEP_DELAY, PRIVATE); delay(EVENTSDELAY);
}

int readWeatherBMP180() {
    Adafruit_BMP085_Unified bmp180 = Adafruit_BMP085_Unified(10085);
    BMP180OK = bmp180.begin(); // Initialize BMP180
    float bufferPressure = 0;
    float bufferTemperature = 0;

    if (BMP180OK)
    {
