Bangle GPS Power management

Posted on
Page
of 3
/ 3
Last Next
  • Apologies for posting again. My original post was in New Projects which I realise was the wrong place.

    I have question around power management options for the GPS and how to minimise power consumption over frequency of updates.

    In GPS-comms.js on github I can see:

    function UBX_CFG_PMS() {
    // UBX-CFG-PMS - enable power management - Super-E
    writeGPScmd([0x06,0x86, // msg class + type
    
         8,0,//length
         0x00,0x03/*1hz*/, 0,0, 0,0, 0,0]);  
    }
    

    Could someone explain what the parameters mean ?

    How could I set the GPS to only look for an update every 120 seconds ?

    Thanks
    Hugh

  • It is not that simple that with less updates power goes equally down. Every update has an acquisition time and the longer the updates are apart, the longer the acquisition may take because things may have changed more drastically. It is a matter of 'continuous' tracking with reasonable frequency, with 'reasonable' meaning balancing out pros and cons of each aspect involved in delivering sufficient accurate fix(es).

    Attached documents explain that there is/are optimum/s in relation to update interval length / frequency, accuracy and power. First reading with good explanations is in the attached document about design considering power consumption minimization for the M6 series of u-blox receivers. Second document includes field tests with the M7 and M8 series. And finally I link to the document - which you also may have found -about the M8130-KT as is in the BangleJS https://www.u-blox.com/sites/default/fil­es/products/documents/u-blox8-M8_Receive­rDescrProtSpec_(UBX-13003221)_Public.pdf­ - same as you find under Hardware at https://www.espruino.com/Bangle.js+Techn­ical


    2 Attachments

  • Thanks for the response. I think I had seen the AppNote before, but was not able to make the
    connection with the code in GPS-comms.js. Its a great bit of code, just needs a few more comments
    to explain what it is doing.

    What I would like to acheive is to have a OS GRID ref showing as a widget or a line of TEXT in the front screen of the watch. Normally GPS will be switched off so the grid ref line will be skipped
    and not displayed. When I do a new fell walk it is useful to have a grid ref every now and then.
    Using a 1:25000 OS map you can only really only see a 6 digit OS grid ref and that puts you in a 100m square which is good enough for general map reading. Say I walk at a speed of 4km/hr; thats 67m per minute. So I'd be happy to take a GPS update between 1-2 minutes apart. When I stop and look at the watch I would only have to wait a max of 2 mins before the GRID REF was refreshed. I could have a little coundown value that would show me how many seconds ago the GRID REF was updated.

    What I read in the AppNote:
    Power Management Considerations for u-blox 7 and M8 GNSS receivers (UBX-13005162 - R01) Page 6:

    Smallest average current consumption is obviously achieved when the update period is long

    Section 2.3.1 shows a chart, with PSMOD set to 30seconds the average power consumption is 2mA.

    The question is how to set this value using the Bangle JS framework.

    Once I understand how to use the code in GPS-comms.js I can try a few experiments, to see what is practical.

    I see Gordon has requested votes on the next in depth tutorial, so I have upvoted for a GPS tutorial.

    Back to more studying of GPS-comms.js against the datasheet, I guess I am going to
    end up knowing more about GPS than expected.

  • Had a closer look at the code and the datasheet.
    I might be a bit further along on answering my original question.
    I dont have my watch yet so cant really test

    /*
    UBX-CFG-PMS - enable power management - Super-E
    period and ontime are ignored and set to 0 in 1hz mode
    
    See: UBX-13003221 - R21 page 243, for format of config message
    
    */
    function UBX_CFG_PMS() {
      writeGPScmd([0x06,0x86, // msg class + type
             8,0,//length
                   
             //v0,  1hz     period            ontime       reserved
             0x00,  0x03,   0,        0,      0,      0,   0,      0  ]);  
    }
    
    /*
    
    UBX_CFG_2MIN - enable power management, Interval type: 2 min period (0x78), 7s On time
    FIXME: need to enable Enable waitTimeFix feature ?
    
    See: UBX-13003221 - R21 page 243, for format of config message
    
    */
    function UBX_CFG_2MIN() {
      writeGPScmd([0x06,0x86, // msg class + type
             8,0, //length
             //v0,  interval     period            ontime           reserved
             0x00,  0x02,        0x78,        0,    0x07,     0,    0,      0  ]);
             // the values are little endian, least significant byte first
    }
    

    There are some example interval setups in
    section 13.2.4.3 of the datasheet:

    Use update periods of 30 minutes

    Scenario: Get a position fix once every 30 minutes and acquire a fix needed for timing products.
    Solution: Set mode of operation to PSMOO. Set updatePeriod to 1800 seconds.
    Set the search period to 120 seconds. Enable waitTimeFix feature"

  • Hi - sorry for the delay on this - but what you've got there looks like it could work well. It's really just a matter of trying to digest what the datasheet says you can do and come up with the series of bytes. The CRC is handled for you at least.

    Once you've got the command name you're interested in from the datasheet you may also have some success googling and seeing if anyone has used it anywhere else.

  • More experimentation tonight. I can confirm that the UBX_CFG_2MIN() function will get an ACK response from the GPS. However thats not enough as the GPS still sends a fix every 1-2 seconds. The rate appears to be controlled by UBX_CFG_RATE(). So I tried the function below.

    // header    class  id
    // 0xB5 0x62 0x06   0x08
    
    function UBX_CFG_RATE() {
      writeGPScmd([0x06,0x08,  // class, id 
             0x06,             // length
             0x00, 0x20,       // b0: 8192ms ie 0x2000,  0x00FF (~65sec)
             0x01, 0x00,       // b2: 
             0x01, 0x00]);     // b4: timeref GPS
    }
    

    This gets neither an ACK or a NACK so I assume that the GPS does not like the format or checksum and is ignoring it.

    I found the following python code at:
    [https://community.emlid.com/t/change-sam­pling-frequency-of-gps/421/2]

    def ubx_change_rate(self):
          msg = [0xb5, 0x62, 0x06, 0x08, 0x06, 0x00, 0x64, 0x00, 0x01, 0x00, 0x01, 0x00, 0x7A, 0x12]
          self.bus.xfer2(msg)
    

    But when I look at the bytes it does not match the datasheet.
    But I tried it anyway, stripping out the sync bytes and CRC, but that did not get a response.

  • This gets an ACK - seems the length byte is 2 bytes !!!

    function UBX_CFG_RATE3() {
      writeGPScmd([0x06,0x08,  // class, id 
             0x06, 0,          // length
             0x00, 0x20,       // b0: 8192ms ie 0x2000,  0x00FF (~65sec)
             0x01, 0x00,       // b2: 
             0x01, 0x00]);     // b4: timeref GPS
    }
    
    
    
  • Almost there. Getting updates every 65 seconds, then seemed to loose the configuration.
    Phew that was hard work!.


    1 Attachment

    • updates_every65s.png
  • That's great - thanks for posting up your progress!

    Yes, I'm pretty sure length is 2 bytes. It'd be great to turn this into a GPS config app - maybe with some presets for 'default','low power', etc.

    I wonder if even though the GPS data is getting pushed out every second, it is only properly updating every 2 min anyway? If so I guess it's not that bad - it won't be wasting too much power compared with the GPS power saving.

  • Found this useful bit code code for configuring a UBX GPS via python.
    https://github.com/Korving-F/ublox/blob/­master/ublox/ubx.py

  • This link indicates that UBX-CFG-CFG/ save needs to be called otherwise the configuration is lost when the GPS wakes up. I have built a basic widget but after 4hrs 58% battery was left, indicating that approx 36mA being drawn per hr.

    https://github.com/ldab/u-blox_GNSS/tree­/master/src

  • This link indicates that UBX-CFG-CFG/ save needs to be called otherwise the configuration is lost

    Actually that's quite good news - at least it means it's harder to brick the GPS or mess it up for other applications :)

    Do you have a link to your widget somewhere? I could run it here on the Bangle I have set up for power usage testing...

  • Here is the last version of my widget. Not yet checked into git. I dont think I have low power working yet. Have been looking at other code across the web, github etc. I have added some new functions tonight but they are not tested yet. I've not yet spent the time of the settings file so to switch on and off have using command line whne connected through the IDE.

    WIDGETS.gpsservice.gps_power_on();
    

    The Widget.

    
    (() => {   
      var have_fix = false;
      var fixToggle = false; // toggles once for each reading
      var gps_power = false;
      
      var last_fix = {
        fix: 0,
        alt: 0,
        lat: 0,
        lon: 0,
        speed: 0,
        time: 0,
        satellites: 0
      };
    
      function gps_get_fix() { return last_fix; }
      function gps_get_status() { return gps_power;}
      
      function gps_power_on() {
        have_fix = false;
        fixToggle = false;
        gps_power = true;
        setupGPS();
      }
    
      function gps_power_off() {
        Bangle.setGPSPower(0);
        gps_power = false;
        have_fix = false;
        fixToggle = false;
        gps_power = false;
        last_fix.fix = 0;
      }
    
      // quick hack
      function wait(ms){
        var start = new Date().getTime();
        var end = start;
        while(end < start + ms) {
          end = new Date().getTime();
        }
      }
    
      function setupGPS() {
        Bangle.setGPSPower(1);
        wait(20);
    
        UBX_CFG_INTERVAL(29,5);
        wait(20);
    
        UBX_CFG_RATE(17);
        wait(20);
    
        UBX_CFG_SAVE();
        wait(5);
    
        Bangle.on('GPS', onGPS);
      }
    
      //  NEW NOT TRIED YET
      function setupGPS_PMS2() {
        Bangle.setGPSPower(1);
        wait(20);
      
        UBX_CFG_RESET();
        wait(100);//wait for effect
     
        //Set power mode / interval mode
        UBX_CFG_PM2();
        wait(20);
     
        //save
        UBX_CFG_SAVE();
        wait(20);
    
        Bangle.on('GPS', onGPS);
      }
      
      function writeGPScmd(cmd) {
        var d = [0xB5,0x62]; // sync chars
        d = d.concat(cmd);
        var a=0,b=0;
        for (var i=2;i<d.length;i++) {
          a += d[i];
          b += a;
        }
        d.push(a&255,b&255);
        //console.log(d);
        Serial1.write(d);
      }
      
      // UBX-CFG-PMS - enable power management - Super-E
      function UBX_CFG_PMS() {
        writeGPScmd([0x06,0x86, // msg class + type
    		 8,0,//length
    		 0x00,0x03, 0,0, 0,0, 0,0]);  
      }
    
    
      function UBX_CFG_INTERVAL(period, ontime) {
        writeGPScmd([0x06,0x86, // msg class + type
    		 8,0, //length
    		 //v0,  interval     period             ontime           reserved
    		 0x00,  0x02,        period,        0,  ontime,     0,    0,      0  ]);
        // the values are little endian, least significant byte first
      }
    
      
      /*
       *  NOT TRIED, NOT TESTED YET
       * https://github.com/thasti/utrak/blob/mas­ter/gps.c
       */
      function UBX_CFG_PM2() {
        writeGPScmd([0x06, 0x3B,                    /* class id */
    	         44, 0,	                        /* length */
    		 0x01, 0x00, 0x00, 0x00, 	/* v1, reserved 1..3 */
    		 0x00, 0x10, 0x00, 0x00,        /* on/off-mode, update ephemeris */
    		 // little endian, lsb first
    		 0x30, 0x75, 0x00, 0x00,	/* update period, ms, 120s=00 01 D4 C0, 30s= 00 00 75 30 */
    		 0x20, 0x4E, 0x00, 0x00,	/* search period, ms, 120s, 20s = 00 00 4E 20 */
    		 0x00, 0x00, 0x00, 0x00,	/* grid offset */
    		 0x00, 0x00,	         	/* on-time after first fix */
    		 0x01, 0x00,        		/* minimum acquisition time */
    		 0x00, 0x00, 0x00, 0x00,	/* reserved 4,5 */
    		 0x00, 0x00, 0x00, 0x00,	/* reserved 6 */
    		 0x00, 0x00, 0x00, 0x00,	/* reserved 7 */
    		 0x00, 0x00, 0x00, 0x00,	/* reserved 8,9,10 */
    	         0x00, 0x00, 0x00, 0x00]);	/* reserved 11 */
      };
    
    		 
      /*
       * set update baud rate
       *
       * the setting is in milliseconds in 2 bytes, max 65 seconds
       * we are passing in a value in seconds
       * we set the most significant byte only
       * 8 seconds ~ 8192ms 0x2000, 0x20 = 32 = 4*8
       *
       */
      function UBX_CFG_RATE(rate) {
        rate = (rate * 4) % 256;
        //console.log("rate=" + rate);
        
    
        writeGPScmd([0x06,0x08,  // class, id 
    		 0x06, 0,          // length
    		 0x00, rate,       // b0: 8192ms 0x2000,  0x00FF (~65sec)
    		 0x01, 0x00,       // b2: 
    		 0x01, 0x00]);     // b4: timeref GPS
      }
    
      /*
       * Save configuration otherwise it will reset when the GPS wakes up
       *
       */
      function UBX_CFG_SAVE() {
        writeGPScmd([0x06, 0x09,   // class id
    		 0x0D, 0x00,   // length
    		 0x00, 0x00, 0x00, 0x00,  // clear mask
    		 0xFF, 0xFF, 0x00, 0x00,  // save mask
    		 0x00, 0x00, 0x00, 0x00,  // load mask
    //		 0x01]);                  // b2=eeprom b1=flash b0=bat backed ram
    		 0x07]);                  // b2=eeprom b1=flash b0=bat backed ram
        // code on github had 7 - all 3 set ?
      }
    
    
      /*
       * NOT TRIED, NOT TESTED
       * Reset to factory settings using clear mask in UBX_CFG_CFG
       * https://portal.u-blox.com/s/question/0D5­2p0000925T00CAE/ublox-max-m8q-getting-st­uck-when-sleeping-with-extint-pin-contro­l
       */
      function UBX_CFG_RESET() {
        writeGPScmd([0x06, 0x09,   // class id 
                     0x0D, 0x00,
    		 0xFF, 0xFB, 0x00, 0x00,  // clear mask
    		 0x00, 0x00, 0x00, 0x00,  // save mask
    		 0xFF, 0xFF, 0x00, 0x00,  // load mask
    		 0x17]);
      }
     
      // draw the widget
      function draw() {
        g.reset();
        g.drawImage(atob("GBgCAAAAAAAAAAQAAAAAAD­8AAAAAAP/AAAAAAP/wAAAAAH/8C9AAAB/8L/QAAA­fwv/wAAAHS//wAAAAL//gAAAAf/+AAAAAf/4AAAA­L//gAAAAD/+DwAAAB/Uf8AAAAfA//AAAACAf/wAA­AAAH/0AAAAAB/wAAAAAAfAAAAAAAAAAAAAAAAAAA­AAAAAAAAAAAAAA"),this.x,this.y);
        if (gps_power && have_fix) {
          g.setColor("#00FF00");
          g.drawImage(fixToggle ? atob("CgoCAAAAA0AAOAAD5AAPwAAAAAAAAAAAAA­AAAA==") : atob("CgoCAAABw0AcOAHj5A8PwHwAAvgAB/wABU­AAAA=="),this.x,this.y+14);
        } else {
          g.setColor("#0000FF");
          if (fixToggle) g.setFont("6x8").drawString("?",this.x,t­his.y+14);
        }
      }
      
      function onGPS(fix) {
        fixToggle = !fixToggle;
        WIDGETS["gpsservice"].draw();
    
        last_fix.satellites = fix.satellites;
    
        /*
         * If we have a fix record it, we will get another soon. Apps
         * will see the timestamp of the last fix and be able to work out
         * if it is stale. This means an App will always have the last
         * known fix, and we avoid saying no fix all the time.
         *
         */
        if (fix.fix) {
          last_fix.fix = fix.fix;
          last_fix.alt = fix.alt;
          last_fix.lat = fix.lat;
          last_fix.lon = fix.lon;
          last_fix.speed = fix.speed;
          last_fix.time = fix.time;
        }
      }
      
      // redraw when the LCD turns on
      Bangle.on('lcdPower', function(on) {
        if (on) WIDGETS["gpsservice"].draw();
      });
      
      // add the widget
      WIDGETS["gpsservice"]={
        area:"tl",
        width:24,
        draw:draw,
        gps_power_on:gps_power_on,
        gps_power_off:gps_power_off,
        gps_get_status:gps_get_status,
        gps_get_fix:gps_get_fix
      };
      
    })();
    
    enter code here
    

    As a client I have defined a watch face for multiclock.

    (() => {
      
      function getFace(){
    
        //var img = require("heatshrink").decompress(atob("m­EwghC/AH4AKg9wC6t3u4uVC6wWBI6t3uJeVuMQCq­cBLisAi4XLxAABFxAXKgc4DBAuBRhQXEDAq7MmYX­EwBHEXZYXFGAOqAAKDMmczC4mIC62CC50PC4JIBk­QABiIvRmURAAUSjQXSFwMoxGKC6CRFwUSVYgXLPI­gXXwMYegoXLJAYXCGBnzGA0hPQIwMgYwGC6gwCC4­ZIMC4gYBC604C4ZISmcRVgapQAAMhC6GIJIwXCMB­cIxGDDBAuLC4IwGAARGMAAQWGmAXPJQoWMC4pwCC­poXJAB4XXAH4A/ABQA="));
        var nofix = 0;
        
        function formatTime(now) {
          var fd = now.toUTCString().split(" ");
          return fd[4];
        }
    
        
        function timeSince(t) {
          var hms = t.split(":");
          var now = new Date();
          
          var sn = 3600*(now.getHours()) + 60*(now.getMinutes()) + 1*(now.getSeconds());
          var st = 3600*(hms[0]) + 60*(hms[1]) + 1*(hms[2]);
      
          return (sn - st);
        }
    
        function draw() {
          var gps_on = false;
    
          var fix = {
            fix: 0,
            alt: 0,
            lat: 0,
    	lon: 0,
    	speed: 0,
    	time: 0,
    	satellites: 0
          };
    
          var y_line = 26;
          var y_start = 46;
          var x_start = 10;
          
          // only attempt to get gps fix if gpsservuce is loaded
          if (WIDGETS.gpsservice !== undefined) {
            fix = WIDGETS.gpsservice.gps_get_fix();
    	gps_on = WIDGETS.gpsservice.gps_get_status();
          }
    
          g.reset();
          g.clearRect(0,24,239,239);
    
          if (fix.fix) {
    	var time = formatTime(fix.time);
    	var age = timeSince(time);
    	
    	g.setFontAlign(-1, -1);
    	g.setFont("6x8");
    	g.setFontVector(22);
    	g.drawString("Alt: " + fix.alt +" m", x_start, y_start, true);
    	g.drawString("Lat: "+ fix.lat, x_start, y_start + y_line, true);
    	g.drawString("Lon: " + fix.lon, x_start, y_start + 2*y_line, true);
    	g.drawString("Time: " + time, x_start, y_start + 3*y_line, true);
    	g.drawString("Age(s): " + age, x_start, y_start + 4*y_line, true);
    	g.drawString("Satellites: " + fix.satellites, x_start, y_start + 5*y_line, true);
    	
          } else if (gps_on) {
    	
    	g.setFontAlign(0, 1);
    	g.setFont("6x8", 2);
    	g.drawString("Waiting for GPS 0.02", 120, 80);
    	nofix = (nofix+1) % 4;
    	g.drawString(".".repeat(nofix) + " ".repeat(4-nofix), 120, 120);
    	g.setFontAlign(0,0);
    	g.drawString(fix.satellites + " satellites", 120, 100);
    	
          } else if (!gps_on) {
    	
    	g.setFontAlign(0, 0);
    	g.setFont("6x8", 3);
    	g.drawString("GPS is off", g.getWidth()/2, g.getWidth()/2);
    	
          }
        }
    
        function onSecond(){
          var t = new Date();
          if ((t.getSeconds() % 5) === 0) draw();
        }
        
        return {init:draw, tick:onSecond};
      }
    
      return getFace;
    
    })();
    
    

    I will probably have another hack-fest on Wednesday night, get the settings working.

  • Here's my test bed code (based on your test code). I just load it into the IDE and test via the command line. Hoping some of the PM2 functions does the trick, though I can see lots of questions on the web on how to get this to work. I am switching evenings between writing bits of code and reading the datasheet and doing a test session on another day.

    /*
    
    test bed for working out lowest power consumption, with workable GPS
    Load into IDE and upload code to RAM when connected to watch
    
    */
    
    
    Bangle.on('GPS-raw',function (d) {
      if (d[0]=="$") return;
      if (d.startsWith("\xB5\x62\x05\x01")) print("GPS ACK");
      else if (d.startsWith("\xB5\x62\x05\x00")) print("GPS NACK");
      // 181,98 sync chars  
      else print("GPS",E.toUint8Array(d).join(","))­;
    });
    
    function writeGPScmd(cmd) {
      var d = [0xB5,0x62]; // sync chars
      d = d.concat(cmd);
      var a=0,b=0;
      for (var i=2;i<d.length;i++) {
        a += d[i];
        b += a;
      }
      d.push(a&255,b&255);
      console.log(d);
      Serial1.write(d);
    }
    
    // quick hack
    function wait(ms){
      var start = new Date().getTime();
      var end = start;
      while(end < start + ms) {
        end = new Date().getTime();
      }
    }
    
    function UBX_CFG_PMS() {
      // UBX-CFG-PMS - enable power management - Super-E
      writeGPScmd([0x06,0x86, // msg class + type
             8,0,//length
             0x00,0x03, 0,0, 0,0, 0,0]);  
    }
    
    function UBX_CFG_INTERVAL(period, ontime) {
      writeGPScmd([0x06,0x86, // msg class + type
             8,0, //length
             //v0,  interval     period             ontime           reserved
             0x00,  0x02,        period,        0,  ontime,     0,    0,      0  ]);
             // the values are little endian, least significant byte first
    }
    
    /*
     * set update baud rate
     *
     * the setting is in milliseconds in 2 bytes, max 65 seconds
     * we are passing in a value in seconds
     * we set the most significant byte only
     * 8 seconds ~ 8192ms 0x2000, 0x20 = 32 = 4*8
     *
     */
    function UBX_CFG_RATE(rate) {
      rate = (rate * 4) % 256;
      console.log("rate=" + rate);
       
    
      writeGPScmd([0x06,0x08,  // class, id 
    	       0x06, 0,          // length
    	       0x00, rate,       // b0: 8192ms 0x2000,  0x00FF (~65sec)
    	       0x01, 0x00,       // b2: 
    	       0x01, 0x00]);     // b4: timeref GPS
    }
    
    /*
     * Save configuration otherwise it will reset when the GPS wakes up
     *
     */
    function UBX_CFG_SAVE() {
      writeGPScmd([0x06, 0x09,   // class id
    	       0x0D, 0x00,   // length
    	       0x00, 0x00, 0x00, 0x00,  // clear mask
    	       0xFF, 0xFF, 0x00, 0x00,  // save mask
    	       0x00, 0x00, 0x00, 0x00,  // load mask
    	       0x01]);                  // b2=eeprom b1=flash b0=bat backed ram
                                            // code on github had 7 - all 3 set ?
    }
    
    
    function onGPS(fix) {
      console.log(fix);
    }
    
    
    Bangle.setGPSPower(1);
    
    UBX_CFG_INTERVAL(30,5);
    wait(20);
    UBX_CFG_RATE(8);
    wait(20);
    UBX_CFG_SAVE();
    
    Bangle.on('GPS',onGPS);
    
    
    

    I am hoping if you can test connected to a milliamp meter on the bench you might be able to find the right sequence to get to the magic 2mA current usage. I am looking for a usable fix update between 30-60 seconds. This is why I have set UBX_CFG_PM2 to 30 and 20 seconds for the update and search times (though as I say, yet to try these new functions, I have just drafted them out tonight).

  • Ok, so quick testing: Normally, Bangle.js draws 33-37mA with the GPS on.

    With just UBX_CFG_INTERVAL(30,5);, I see it drop to 8mA for just a few seconds, but then it never drops that low again and stays at around 31mA.

    However just running UBX_CFG_PMS() (so super-e 1 Hz) without anything else drops power usage to around 17mA. Power usage does spike sometimes to 33mA for a few seconds (I guess as it updates the fix) but it seems pretty good. There's also no need to call _SAVE for it to take effect - but obviously if not it'd need resetting each time.

    Looking at https://www.u-blox.com/sites/default/fil­es/EVK-M8BZOE_UserGuide_%28UBX-17053592%­29.pdf

    For lowest power consumption, Super-E mode supports continuous tracking with update periods up
    to 10 s. To set update periods longer than 1 s, select default Super-E mode (1 Hz) and use Extended
    Power Management message UBX-CFG-PM2 to set the update period.

    So that could be an option I guess?

  • I agree. In my code widget I have drafted functions marked NEW/NOT TESTED I have done the code for UBX-CFG-PM2(), not been able to test yet. I read the above comment in the datasheet a while back but did not understand what it meant. I now understand that UBX-CFG-PMS is mean't to be a superset for power management. Hovever PMS seems a bit redundant when it sounds like you have to fill in PM2 as well. One of the power management PDFs shows a chart saying you can get 2ms when using a 10s interval period - the holy grail I guess.

  • PMS seems a bit redundant when it sounds like you have to fill in PM2 as well

    I know! It seems really odd.

    One of the power management PDFs shows a chart saying you can get 2ms when using a 10s interval period - the holy grail I guess.

    Wow, that'd be great! I've seen a bunch of screenshots from their config app - I wonder whether it could be used to find the correct sequence of bytes to send?

  • Just to add - I notice you're in the UK. Do you own a volt meter that can measure current?

    Given this would be such a nice feature to have, I could always post you one of the reject Bangles that we have here, with wires brought out so you could measure power consumption?

  • Any chance you could try my UBX-CFG-PM2() I got most of the code from the link in the comments and adjusted the timings I wanted.

    I got the bytes from the code at:
    https://github.com/thasti/utrak/blob/mas­ter/gps.c

      /*
       *  NOT TRIED, NOT TESTED YET
       * https://github.com/thasti/utrak/blob/mas­ter/gps.c
       */
      function UBX_CFG_PM2() {
        writeGPScmd([0x06, 0x3B,                    /* class id */
    	         44, 0,	                        /* length */
    		 0x01, 0x00, 0x00, 0x00, 	/* v1, reserved 1..3 */
    		 0x00, 0x10, 0x00, 0x00,        /* on/off-mode, update ephemeris */
    		 // little endian, lsb first
    		 0x30, 0x75, 0x00, 0x00,	/* update period, ms, 120s=00 01 D4 C0, 30s= 00 00 75 30 */
    		 0x20, 0x4E, 0x00, 0x00,	/* search period, ms, 120s, 20s = 00 00 4E 20 */
    		 0x00, 0x00, 0x00, 0x00,	/* grid offset */
    		 0x00, 0x00,	         	/* on-time after first fix */
    		 0x01, 0x00,        		/* minimum acquisition time */
    		 0x00, 0x00, 0x00, 0x00,	/* reserved 4,5 */
    		 0x00, 0x00, 0x00, 0x00,	/* reserved 6 */
    		 0x00, 0x00, 0x00, 0x00,	/* reserved 7 */
    		 0x00, 0x00, 0x00, 0x00,	/* reserved 8,9,10 */
    	         0x00, 0x00, 0x00, 0x00]);	/* reserved 11 */
      };
    
  • I do have an AVO yes. You should have my address from my original order. Testing that way would be really quick to establish that the GPS current had dropped. I am going to try some more experiments tonight.

  • Well, running that seemed to have no effect - but running PMS then PM2 dropped power consumption to around 10mA for a few seconds, then it went right up again and appears to stay there.

    What I find a bit confusing is that the GPS seems to add 30mA, but all these graphs show power draw in the range of 6mA.

    I'll try and get a modified Bangle out to you today...

  • From various bits of code I was found on the web I think the sequence has to be something like.

        UBX_CFG_RESET();  // do a factory reset to ensure my setup is taken
        wait(20);
        UBX_CFG_INTERVAL(29,5);  // PMS
        wait(20);
        UBX_CFG_PM2();  // with same intervals but in ms instead of seconds
        wait(20);
        UBX_CFG_RATE(17);  // set the rate but may not be required
        wait(20);
        UBX_CFG_SAVE();  //  save the configuration as it gets reset on wake up
        wait(5);
    
  • The moded Bangle has arrived. Just loading it up with the software etc.
    Noticed that the firmware is 2.05.
    I tried to update the firmware but had trouble selecting the firmware.zip file from downloads. What my phone does is show me a list of contents of the zip but no other options.

    Will the different firmware make much difference to the tests ?


    1 Attachment

    • Screenshot_2021-01-16-13-13-21-665_com.android.documentsui.jpg
  • try to go out of the zip and touch and hold the zip to select it, don't go inside

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Bangle GPS Power management

Posted by Avatar for HughB @HughB

Actions