#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_Ublox_GPS SFE_UBLOX_GPS myGPS; long lastTime = 0; //Simple local timer. Limits amount if I2C traffic to Ublox module. int counter = 0; boolean gpsResponse; // GPS response #define WAKEUP_PIN 32 void wakeUp() { pinMode(WAKEUP_PIN, OUTPUT); digitalWrite(WAKEUP_PIN, LOW); Serial.println("WAKING UP GPS VIA EXINT PIN"); delay(500); digitalWrite(WAKEUP_PIN, HIGH); delay(500); } void setup() { Serial.begin(115200); Wire.begin(); if (myGPS.begin() == false) //Connect to the Ublox module using Wire port { Serial.println(F("Ublox GPS not detected at default I2C address. Please check wiring. Freezing.")); while (1); } myGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise) myGPS.saveConfiguration(); //Save the current settings to flash and BBR myGPS.enableDebugging(); //Enable debug messages over Serial (default) //myGPS.enableDebugging(SerialUSB); //Enable debug messages over Serial USB } void loop() { if (millis() - lastTime > 1000) { lastTime = millis(); //Update the timer // after 10 loops powers off GPS for 60s if (counter == 10) { counter++; Serial.println("GPS POWER OFF for 60s -------------------------------------"); gpsResponse = myGPS.powerOff(60000); // seems to be more reliable + INT pin works as wakeup too // gpsResponse = myGPS.powerOffWithInterrupt(60000); Serial.println("Response from GPS " + String(gpsResponse)); delay(1000); } // wakes up the device after 30 loops and resets counter else if (counter == 30) { counter = 0; // use for pin wakeUp wakeUp(); } else { counter++; // wake up by querying /* long latitude = myGPS.getLatitude(); Serial.print(F("Lat: ")); Serial.print(latitude); long longitude = myGPS.getLongitude(); Serial.print(F(" Long: ")); Serial.print(longitude); Serial.print(F(" (degrees * 10^-7)")); long altitude = myGPS.getAltitude(); Serial.print(F(" Alt: ")); Serial.print(altitude); Serial.print(F(" (mm)")); byte SIV = myGPS.getSIV(); Serial.print(F(" SIV: ")); Serial.print(SIV); Serial.println(); */ } } }