2020-11-30 09:15 PM
I am doing a GPS tracking project. I want to turn the GPS into standby mode or Enable Periodic Mode. I am doing the code in the Arduino IDE
For standby mode
I use the following code to set the GPS into standby mode.
MicroNMEA::sendSentence(gps,"$PSTMFORCESTANDBY,00010");
Can I use any code to wake the GPS up in software way?
I try the following code:
MicroNMEA::sendSentence(gps,"$PSTMFORCESTANDBY,00010");
delay(5000);
MicroNMEA::sendSentence(gps, "$PSTMSRR");
However, the GPS received no signal anymore.
For Enable Periodic Mode
I used the code
MicroNMEA::sendSentence(gps, "$PSTMLOWPOWERONOFF,1,0,0,0,0,0,0,3,100,0,1,1,15,180");
But this makes no any change while reading the output from serial monitor.
Can anyone help give me a hint?
Thank you!
2020-12-01 02:46 AM
Hi,
I try to set the code in the setup and wait for almost one hour, but it seems that still not turn into periodic mode according to the GPGGA timestamp?
MicroNMEA::sendSentence(gps,"$PSTMLOWPOWERONOFF,1,0,0,0,0,0,0,3,30,2,1,1,15,180");
2020-12-01 03:00 AM
Hi
When you send the command did you get '$PSTMLOWPOWERON,...' answer from the module?
Regards
Francesco
2020-12-01 03:09 AM
initially, I put this line of code in the setup loop, and I think I did not see the '$PSTMLOWPOWERON,.. from the serial monitor. But now, I put the code in the loop, so it will launch the code every loop and I can see the '$PSTMLOWPOWERON,.. right now. It is correct? Thank you
2020-12-01 03:15 AM
Hi
You should raise the command just once. (not continuously in loop)
> initially, I put this line of code in the setup loop, and I think I did not see the '$PSTMLOWPOWERON
As first step you should check the system is already up-and-running before you send the low-power-command (do you seen NMEA message before you send the command?)
Regards
Francesco
2020-12-01 03:26 AM
Hi,
Here is the code
//MicroNMEA library structures
char nmeaBuffer[100];
MicroNMEA nmea(nmeaBuffer, sizeof(nmeaBuffer));
bool ledState = LOW;
volatile bool ppsTriggered = false;
void ppsHandler(void);
void ppsHandler(void)
{
ppsTriggered = true;
}
void gpsHardwareReset()
{
// Empty input buffer
while (gps.available())
gps.read();
//reset the device
digitalWrite(RESET_PIN, LOW);
delay(50);
digitalWrite(RESET_PIN, HIGH);
//wait for reset to apply
delay(2000);
}
void setup(void)
{
console.begin(115200); // console
gps.begin(9600); // gps
pinMode(LED_BUILTIN, OUTPUT);
digitalWrite(LED_BUILTIN, ledState);
//Start the module
pinMode(RESET_PIN, OUTPUT);
digitalWrite(RESET_PIN, HIGH);
console.println("Resetting GPS module ...");
gpsHardwareReset();
console.println("... done");
// Change the echoing messages to the ones recognized by the MicroNMEA library
MicroNMEA::sendSentence(gps, "$PSTMSETPAR,1201,0x00000042");
MicroNMEA::sendSentence(gps, "$PSTMSAVEPAR");
//Reset the device so that the changes could take plaace
MicroNMEA::sendSentence(gps, "$PSTMSRR");
delay(4000);
//clear serial buffer
while (gps.available())
gps.read();
pinMode(6, INPUT);
attachInterrupt(digitalPinToInterrupt(6), ppsHandler, RISING);
MicroNMEA::sendSentence(gps,"$PSTMLOWPOWERONOFF,1,0,0,0,0,0,0,3,30,2,1,1,15,180");
should I move the LOWPOWERONOFF to the very beginning? Thank you
2020-12-01 03:28 AM
and for the message read from the serial monitor after the code is just uploaded
Do I miss something?
2020-12-01 03:43 AM
//NOTE: for compatibility with the Arduino Due some additional cabling needs to be performed:
// pin D8 should be connected to pin D18 and pin D2 should be connected to pin D19
#include <MicroNMEA.h>
//Define Serial1 for STM32 Nucleo boards
#ifdef ARDUINO_ARCH_STM32
HardwareSerial Serial1(PA10, PA9);
#endif
#define RESET_PIN 7
// Refer to serial devices by use
HardwareSerial& console = Serial;
HardwareSerial& gps = Serial1;
//MicroNMEA library structures
char nmeaBuffer[100];
MicroNMEA nmea(nmeaBuffer, sizeof(nmeaBuffer));
bool ledState = LOW;
volatile bool ppsTriggered = false;
void ppsHandler(void);
void ppsHandler(void)
{
ppsTriggered = true;
}
void gpsHardwareReset()
{
// Empty input buffer
while (gps.available())
gps.read();
//reset the device
digitalWrite(RESET_PIN, LOW);
delay(50);
digitalWrite(RESET_PIN, HIGH);
//wait for reset to apply
delay(2000);
}
void setup(void)
{
console.begin(115200); // console
gps.begin(9600); // gps
pinMode(LED_BUILTIN, OUTPUT);
digitalWrite(LED_BUILTIN, ledState);
//Start the module
pinMode(RESET_PIN, OUTPUT);
digitalWrite(RESET_PIN, HIGH);
console.println("Resetting GPS module ...");
gpsHardwareReset();
console.println("... done");
// Change the echoing messages to the ones recognized by the MicroNMEA library
Serial.println("11111111111111");
MicroNMEA::sendSentence(gps, "$PSTMSETPAR,1201,0x00000042");
Serial.println("22222222222222");
MicroNMEA::sendSentence(gps, "$PSTMSAVEPAR");
delay(2000);
Serial.println("33333333333333333");
MicroNMEA::sendSentence(gps,"$PSTMLOWPOWERONOFF,1,0,0,0,0,0,0,3,30,2,1,1,15,180");
//Reset the device so that the changes could take plaace
Serial.println("44444444444444444");
MicroNMEA::sendSentence(gps, "$PSTMSRR");
Serial.println("55555555555555555");
MicroNMEA::sendSentence(gps,"$PSTMLOWPOWERONOFF,1,0,0,0,0,0,0,3,30,2,1,1,15,180");
delay(4000);
//clear serial buffer
while (gps.available())
gps.read();
pinMode(6, INPUT);
attachInterrupt(digitalPinToInterrupt(6), ppsHandler, RISING);
//MicroNMEA::sendSentence(gps,"$PSTMLOWPOWERONOFF,1,0,0,0,0,0,0,3,30,2,1,1,15,180");
}
int i = 0;
void loop(void)
Hi, according to my code, I think I send the command "$PSTMLOWPOWERONOFF. However, I do not see the '$PSTMLOWPOWERON,...' answer from the serial monitor...
Thank you
2020-12-01 03:51 AM
> should I move the LOWPOWERONOFF to the very beginning? Thank you
Yes you should
Moreover I don't know which is the initial pins condition but in standard condition Wakeup-Pin has to be Low
If in Arduino they are high for any reason the system will never enter in standby (or it's better say... it enters and immediately woken-up).
Regards
Francesco