Go Down

Topic: GPS module power management (Read 3486 times) previous topic - next topic

srnet

The RXM-PMREQ message puts the GPS in the inactive state for the period specified and is supported on Ublox6, 7, 8;

If you send it with a zero period as below the GPS goes inactive, but retains settings, so you can hot-fix it.

0xB5, 0x62, 0x02, 0x41, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x4D, 0x3B


This is the measured power consumption in inactive mode;

Ubloc Neo 6M - 75uA
Ublox Max 8Q - 35uA

These are the bare GPS, no extra stuff connected.

Did not have a bare bones 7 to hand to test.   
$50SAT is now Silent (but probably still running)
http://www.50dollarsat.info/
http://www.loratracker.uk/

-dev

Nice work!  I just wonder why they're not in the specs...
Really, I used to be /dev.  :(

srnet

Nice work!  I just wonder why they're not in the specs...
Indeed very curious.

You would think that a 'software feature' that more or less negates the need for a seperate transistor turn off circuit is something to boast about in the datasheet.


$50SAT is now Silent (but probably still running)
http://www.50dollarsat.info/
http://www.loratracker.uk/

PaulS

Quote
can you suggest a suitable transistor that is small and will do the job?
https://www.adafruit.com/product/976
The art of getting good answers lies in asking good questions.

itmoto


srnet

Be careful switching the GPS on\off. This can generate a reasonably high voltage dip on the processors supply voltage if the power supply is inadequate.

If your powering the test circuit of a 3.3V Pro Mini (for instance) with one of those CP2102 USB-Serial adapters expect the GPS power on to cause the processor to reset.

Its a combination of poor power supply (from the CP2102) and the brown out detect on the processor probably being set at 2.7V.

I do reset the brown out voltage to 1.8V and also uses some resistor and capacitors on the GPS power switching MOSFET to slow the power on\off, these together eliminate the issue.

The last thing you want is a project that resets itself every time the GPS is switched on.
$50SAT is now Silent (but probably still running)
http://www.50dollarsat.info/
http://www.loratracker.uk/

freaklabs

Hi Itmoto. There are literally thousands of transistors that you can choose from. For low power, I'd recommend using a FET as opposed to a bipolar transistor. Also find one with a gate voltage threshold that's much lower than the system voltage of the microcontroller that will control it. You'll want a tight shutoff and turn on for the FET.
FreakLabs
Open Source Wireless Sensor Networks
https://freaklabs.org
Twitter: @freaklabs

itmoto

#22
Sep 12, 2017, 09:27 pm Last Edit: Sep 12, 2017, 09:32 pm by itmoto
Thanks srnet, yes I do not wish it to re-set itself. What you said is slightly over my head as I'm still quite new to this. I am currently powering the project with a 12v 8ah motorcycle battery with 2 mini 360 dc-dc step down buck converters. I am powering a 328p chip and a neo6m from 1 buck stepped down to 5v and the other buck down to 4v powering a Sim800L. Have the Sim800l in sleep mode. Am in the process of introducing the low power sleep library into my code using int0 to Sim800l Ri pin to wake (low) when sms or call received, (struggling badly have to say, should I start a new topic about this as it's a bit off topic?) just wasn't sure what to do about the gps to reduce the consumption. If there's another/better way (my simple brain can understand!) I would be interested in hearing it.

-------------

Thanks freaklabs, I know, there are a lot of transistors out there, bit mind boggling! Ok so a FET is best, not sure what you mean with the gate voltage threshold and tight shut off? Will try and research it, will try finding YouTube guide on mosfets!

srnet

Thanks srnet, yes I do not wish it to re-set itself. What you said is slightly over my head as I'm still quite new to this.
In essense turning on the power to the GPS with a transistor can reset the ATMEGA328. It may not happen with your circuit, but I have seen it happen with some of mine.

The circuit I use, and the MOSFET I use with a 3.3V Pro Mini will be found in the schematics folder here;

https://github.com/LoRaTracker/Locator2

I have found the IRLML6402 operates very relaibly in this application.

With a UBLOX GPS you can use the software power down, no transistor switch needed, but the current consumption 'only' goes down to 35uA as apposed to 0uA with the MOSFET switch.

 
$50SAT is now Silent (but probably still running)
http://www.50dollarsat.info/
http://www.loratracker.uk/

itmoto

srnet thanks, I will look into the IRLML6402.
I saw your post about the ublox software power down, it maybe a bit difficult for me, compared to switching a FET on and off from a digital pin. Something else I need to look into!
Had a quick look at your GitHub page, could only see a few bits as viewing from mobile, very impressive, lots of coding

itmoto

#25
Nov 18, 2017, 09:15 pm Last Edit: Nov 18, 2017, 09:30 pm by itmoto
I am trying srnet's method of putting the GPS in the inactive state by sending the RXM-PMREQ message  0xB5, 0x62, 0x02, 0x41, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x4D, 0x3B   so it can be hot fixed.

I bought the GPS breakout listed as a NEO-6M but I am unsure it is as listed. It has a XM37-1612 chip see image below (also attached).



I have been trying to find how to send the command/message to the GPS breakout, googling I found a guide on ublox power save modes:

https://ukhas.org.uk/guides:ublox_psm

It had a section on Turning the GPS to backup mode which i think is the same as inactive state? :

Code: [Select]
// 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();
}

//Set GPS to backup mode (sets it to never wake up on its own)
 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));

I tried sending the message GPSoff but could see no change in the consumption?

I am using NeoGPS library to parse the GPS data (thanks to /dev). Is it still possible to send the commands to turn off/reduce the GPS module power while using the library?

Here is the sketch trying to reduce GPS power:

Code: [Select]
#include <NMEAGPS.h>

#define gpsPort Serial // pin 0 to GPS TX and pin 1 to GPS RX

NMEAGPS GPS;
gps_fix fix; // a structure that contains all the GPS pieces, like lat/lon


//============================ GPS power functions ================================//


// 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++) {
    gpsPort.print(MSG[i]);
    //Serial.write(MSG[i]);
  }
  Serial.println();
}

void GpsOff()
{
  // ---- Set GPS to backup mode (sets it to never wake up on its own)
  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));
  Serial.println(F("GPS power OFF"));
}


void GpsOn()
{
  // ---- 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));
  Serial.println(F("GPS power ON"));
}

//============================ Setup ======================================//

void setup() {

  Serial.begin(9600);
  Serial.println( F("NeoGPS library + GSM test!") );


  // gpsPort.begin(9600);
  GPS.send_P( &gpsPort, F("PMTK314,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0") ); // RMC+GGA
  GPS.send_P( &gpsPort, F("PMTK220,1000") ); // 1Hz
  GPS.send_P( &gpsPort, F("PGCMD,33,0") ); // No antenna status

  delay(5000);

  GpsOff();

  delay(10000);

  GpsOn();
}

//=============================== Loop ===================================//

void loop() {

  // if a sentence is received...
  if (GPS.available( gpsPort )) {
    fix = GPS.read(); //  get the latest pieces
    readGPSdata();
  }
}

//=============================== Functions ===============================//

void readGPSdata()
{
  // if a sentence is received...
  // if (GPS.available( gpsPort )) {
  //   fix = GPS.read(); //  get the latest pieces

  if (fix.valid.location) {
    Serial.print( F("We have a fix!") );
  } else
    Serial.print( F("We dont have a fix!") );

  Serial.print( F("\nLocation: ") );
  if (fix.valid.location) {
    Serial.print( fix.latitude(), 6);
    Serial.print( F(", ") );
    Serial.print( fix.longitude(), 6);
  }

  Serial.print( F("\nSatellites: ") );
  if (fix.valid.satellites) {
    Serial.print( fix.satellites );
  }

  Serial.print( F("\nFix: ") );
  if (fix.valid.status) {
    Serial.println(fix.status);
  }
  Serial.println();
}


Going back to the GPS module (XM37-1612 chip) I found a datasheet:

http://www.simplewe.com/wp-content/uploads/2017/04/Simplewe-XM37-1612-Datasheet.pdf

On page 13 it says to send message to put in standby mode so am unsure what will work?

Code: [Select]
unsigned char StandbyMode[] = {"$PMTK161,0*28\x0D\x0A"};

Thanks so much for any help, it's the very last stage of my project.

Ian.

srnet

I bought the GPS breakout listed as a NEO-6M but I am unsure it is as listed. It has a XM37-1612 chip see image below (also attached).
It may have been sold to you as a UBLOX, but what does the datasheet say the chipset actually is ?

The commands I gave, and you found the same one on the UKHAS website, are specifically for UBLOX GPSs, they will not work on other types.
$50SAT is now Silent (but probably still running)
http://www.50dollarsat.info/
http://www.loratracker.uk/

itmoto

Thanks for the reply.

It says XM37-1612 module runs on the MTK Platform (MediaTek Inc.)

There are lots of GY-NEO6MV2 listed as ublox but using the XM chip.
So just to be clear, modules using this chip are not genuine ublox modules?

If that is the case, I will try sending the message
unsigned char StandbyMode[] = {"$PMTK161,0*28\x0D\x0A"}; and see if that works.

Would like to know if it's possible to send the message using the neoGPS library?
The message has a $ in it so will the library try to parse it?

Thanks.

srnet

In my experience geniune Ublox GPSs are marked with the Ublox logo.

There are however kinown to be fakes out there, especially the 6M type, which although marked as a Ublox GPS do not behave (as in accepting all Ublox commands) as a Ublox GPS.
$50SAT is now Silent (but probably still running)
http://www.50dollarsat.info/
http://www.loratracker.uk/

-dev

Quote from: itmoto
Would like to know if it's possible to send the message using the neoGPS library?
Sure:

    gps.send_P( &gpsPort, F("PMTK161,0") );


Quote from: itmoto
The message has a $ in it so will the library try to parse it?
Only if it receives that sentence.  You are sending it, so it never gets parsed.  Regardless, NeoGPS would ignore that sentence if it were received.
Really, I used to be /dev.  :(

Go Up