Currently, we are creating a GPS information acquisition program on SPRESENSE (CXD5602) in ArduinoIDE.
We are aiming for battery life and are measuring low power consumption. (This is my first time using GPS.)
At that time, the reception interval of GPS is increased and *The number of reception times has been changed, but it will take some time to fix it.
G When I call Gnss.waitUpdate() and update it, I receive data, but waitUpdate() is
Changing the time interval between calls.
Once fixed, it rarely comes off, but it takes time to fix and consumes electricity.
Questions
1. Please let me know if there is anything I need to do to receive multiple satellite information and speed up the time to Fix.
2. How long is the best time to call waitUpdate()?
For GPS and LowPower conversion, refer to the following:
https://developer.sony.com/develop/spresense/docs/arduino_developer_guide_ja.html#_gnss_%E3%83%A9%E3%82%A4%E3%83%96%E3%83%A9%E3%83%AA
As the management pointed out, I'm not sure if the answer is due to lack of information, but I've tried a GPS hot start on SPRESENSE, so I'll post the code.I am not familiar with GPS, so I cannot guarantee the contents of the code.It's just the content that I've tried, so please refer to it.
#include<GPS.h>
# include<LowPower.h>
# include <RTC.h>
static SpGnss Gnss;
void setup() {
intresut;
Serial.begin (115200);
RTC.begin();
LowPower.begin();
LowPower.clockMode (CLOCK_MODE_32MHz);
bootcause_ebc=LowPower.bootCause(); /*get boot cause*/
sleep(3);
Gnss.begin();
Gnss.select (GPS);
Gnss.select (GLONASS);
Gnss.select(QZ_L1CA);
Gnss.select(QZ_L1S);
if((bc==POR_SUPPLY)||(bc==POR_NORMAL)){
Serial.println("Power on reset";
Gnss.start(COLD_START);
} else{
Serial.println("Wakeup from deep sleep");
RtcTime now = RTC.getTime();
// Print the current clock
printf("%04d/%02d/%02d%02d:%02d:%02d\n",
now.year(), now.month(), now.day(),
now.hour(), now.minute(), now.second());
SpGnssTimegnss_time;
gnss_time.year=now.year();
gnss_time.month=now.month();
gnss_time.day = now.day();
gnss_time.hour = now.hour();
gnss_time.minute=now.minute();
gnss_time.sec = now.second();
gnss_time.usec = now.nsec()/1000;
Gnss.setTime (&gnss_time);
Gnss.start(HOT_START);
}
}
void loop() {
if(!Gnss.waitUpdate(-1)return;
SpNavDataNavData;
Gnss.getNavData(&NavData);
/* print satellites count*
Serial.print("numSat:"+String(NavData.numSatellites)+"";
/* update RTC time*/
RtcTime gps_time(NavData.time.year)
, NavData.time.month
, NavData.time.day
, NavData.time.hour
, NavData.time.minute
, NavData.time.sec
, NavData.time.usec*1000/*RtcTime requirements nsec*/);
Serial.print(String(gps_time.year())+"/"
+ String(gps_time.month())+"/"
+ String(gps_time.day())+""
+ String(gps_time.hour())+":"
+ String(gps_time.minute())+":"
+ String(gps_time.second())+"");
/* When time is different more than 1sec, update RTC time*/
if(abs(RTC.getTime()-gps_time)>=1){
RTC.setTime(gps_time);
Serial.print("*Updated RTC time*";
}
/* print position data*/
if(NavData.posFixMode==FixInvalid&NavData.posDataExist==0){
Serial.print ("No Position");
} else{
static intg_loop = 0;
Serial.print("Lat="+String(NavData.latitude, 6);
Serial.print(",Lon="+String(NavData.longitude, 6);
unsigned long passed_time;
Serial.println("");
passed_time=millis();
Serial.println("POSITION FIXED TIME:" + String(passed_time)));
if(g_loop>10){
// Go to deep sleep for 60 seconds
Gnss.saveEphemeris();
Gnss.stop();
Gnss.end();
passed_time=millis();
Serial.println("Go to deep sleep..." + String(passed_time)));
LowPower.deepSleep(60);
}
++g_loop;
}
Serial.println("");
}
© 2024 OneMinuteCode. All rights reserved.