In the neoGPS library examples, I think ubloxRate.ino is the good example to do a save power mode. The dataSheet in page 142 give the message structure for the power management CFG-RXM configuration :
uint8_t a = 0, b = 0;
while (len-- > 0) {
uint8_t c = pgm_read_byte( progmemBytes++ );
a += c;
b += a;
gpsPort.write( c );
}
gpsPort.write( a ); // CHECKSUM A
gpsPort.write( b ); // CHECKSUM B
} // sendUBX
So 2 first bytes (0xB5 0x62) are written in the sendUBX function and also the 2 CHECKSUMS.
I need help to write the const unsigned char * to pass to the sendUBX function to put the GPS in Power Save Mode or Eco mode.
Perhaps study the .ino file you mentioned a bit more.
Presumably if there is a function defined in that sketch (that you want to use) then elsewhere in the same sketch is examples of how to use the function.
With the code below, I don't have consumption difference with or without sendUBX(ubxPSM, sizeof(ubxPSM)); : around 70mA with an arduino nano and a ublox GPS neo-6M :
#include <NMEAGPS.h>
#include <GPSport.h>
//Power save modes
const unsigned char ubxPSM[] PROGMEM =
{ 0x06,0x11,0x02,0x08,0x01 }; //Power Save Mode
const unsigned char ubxEM[] PROGMEM =
{ 0x06,0x11,0x02,0x08,0x04 }; //Eco Mode
const unsigned char ubxMPM[] PROGMEM =
{ 0x06,0x11,0x02,0x08,0x00 }; //Max Performance Mode
NMEAGPS gps; // This parses the GPS characters
gps_fix fix; // This holds on to the latest values
void sendUBX( const unsigned char *progmemBytes, size_t len )
{
gpsPort.write( 0xB5 ); // SYNC1
gpsPort.write( 0x62 ); // SYNC2
uint8_t a = 0, b = 0;
while (len-- > 0) {
uint8_t c = pgm_read_byte( progmemBytes++ );
a += c;
b += a;
gpsPort.write( c );
}
gpsPort.write( a ); // CHECKSUM A
gpsPort.write( b ); // CHECKSUM B
} // sendUBX
void setup()
{
DEBUG_PORT.begin(9600);
while (!DEBUG_PORT)
;
gpsPort.begin(9600);
sendUBX(ubxPSM, sizeof(ubxPSM)); //turn GPS in Power Save Mode
}
void loop()
{
delay(2000);
}
There might be no change in power consumption until the GPS has a good fix anyway.
Then there is the issue of fake Ublox GPSs, plenty of them out there, of which one of the symptoms is that they dont accept some configuration commands correctly.