UKHAS Wiki

UK High Altitude Society

User Tools

Site Tools


guides:ublox_psm

This is an old revision of the document!


Ublox 6 Power Saving Modes

The Ublox 6 gps modules by default have excellent power consumption at around 50 - 60mA to get a lock and then around 40mA with a lock. They however have modes that allow them to reduce their consumption further and only a small loss to performance.

Cyclic Mode

This mode is available on all models of the ublox6 family though the maximum update period can vary. When the GPS starts up it is by default in the Maximum Performance mode. You can only set the power saving mode once the GPS has got a lock otherwise the module has a habit of reseting itself and losing all your settings. Once you have switched from Max Perfom to Power Saving the default setting is cyclic with an update period of 1 second resulting in a draw of between 15 and 20mA. On the max6 modules this can be extended to an update period of 10 seconds which should reduce the current to 12mA

Example Code:

int firstlock = 0;
 
// Send a byte array of UBX protocol to the GPS
void sendUBX(uint8_t *MSG, uint8_t len) {
  for(int i=0; i<len; i++) {
    Serial.write(MSG[i]);
  }
  //Serial.println();
}
 
void setupGPSpower() {
  //Set GPS ot Power Save Mode
  uint8_t setPSM[] = { 0xB5, 0x62, 0x06, 0x11, 0x02, 0x00, 0x08, 0x01, 0x22, 0x92 }; // Setup for Power Save Mode (Default Cyclic 1s)
 
  sendUBX(setPSM, sizeof(setPSM)/sizeof(uint8_t));
}
 
void loop() {
  Serial.println("$PUBX,00*33"); //Poll GPS
  while (Serial.available())
  {
    int c = Serial.read();
    if (gps.encode(c))
    {
      //Get Data from GPS library
      //Get Time and split it
      gps.get_datetime(&date, &time, &age);
      hour = (time / 1000000);
      minute = ((time - (hour * 1000000)) / 10000);
      second = ((time - ((hour * 1000000) + (minute * 10000))));
      second = second / 100;
 
      //Get Position
      gps.get_position(&lat, &lon, &age);
 
      // +/- altitude in meters
      ialt = (gps.altitude() / 100); 
 
      if(firstlock == 0 && lat != 0){
          setupGPSpower();
          firstlock = 1;
      }
    }
  }
  //Transmit data here over radio
  }
 

Turn GPS on and off via software

Another option is to manually control the GPS, this can be divided into 2 methods:

1) Switch the whole GPS to backup mode - minimal current draw <5mA, loses all settings, wakes on command via serial or after set time

 //Set GPS to backup mode
 uint8_t GPSoff[] = {0xB5, 0x62, 0x02, 0x41, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x4D, 0x3B};
 sendUBX(GPSoff, sizeof(GPSoff)/sizeof(uint8_t));
 
 delay(30000);
 
 //Restart GPS
 uint8_t GPSon[] = {0xB5, 0x62, 0x02, 0x41, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x4C, 0x37};
 sendUBX(GPSon, sizeof(GPSon)/sizeof(uint8_t));

2) Switch the RF GPS section off, draws about 5mA, retains its settings, wakes on serial command.

 uint8_t GPSoff[] = {0xB5, 0x62, 0x06, 0x04, 0x04, 0x00, 0x00, 0x00,0x08, 0x00, 0x16, 0x74};
 sendUBX(GPSoff, sizeof(GPSoff)/sizeof(uint8_t));
 
 delay(30000);
 
 uint8_t GPSon[] = {0xB5, 0x62, 0x06, 0x04, 0x04, 0x00, 0x00, 0x00,0x09, 0x00, 0x17, 0x76};
 sendUBX(GPSon, sizeof(GPSon)/sizeof(uint8_t));
guides/ublox_psm.1333521499.txt.gz · Last modified: 2012/04/04 06:38 by jcoxon

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki