Hi everyone, i'm working on a project with the aim of making an high performance GPS chrometer.
The aforementioned GPS is the only one that can give me the maximum update rate that i need for civilian use without a license.
In this Forum we have already talked about this module but only to make it works at 20Hz update rate.
Here the code..
/***************************************************
* This code turns updates the refresh rate of the
* Venus838FLPx GPS from 1 Hz to 20 Hz. I would
* like to thank -dev from the Arduino.org forums
* for the code he uploaded here:
*
* https://forum.arduino.cc/index.php?topic=438394.0
* Post #1
*
* This code that I have written just adds a few
* things and parses the data
*
* There is no error checking in the set-up. I may
* add that later. As of now, it assumes no error
* will occur and everything will work flawless.
*
* 11/23/17 DGrullon
*
* PS. I know the code is sloppy
***************************************************/
// Include ////////////////////////////////////////////
#include <TinyGPS++.h>
// Definitions ////////////////////////////////////////
#define GPS_PORT Serial2
#define SERIAL_BAUDRATE 9600
#define NEW_BAUDRATE 115200
// Function Prototypes ////////////////////////////////
void sendCommand(uint8_t*, uint8_t);
void readUpdate(void);
// Venus Commands /////////////////////////////////////
uint8_t refreshRateCmd[10] = {0xA0, 0xA1, 0x00, 0x03, 0x0E, 0x14, 0x00, 0x1A, 0x0D, 0x0A}; // 20 Hz Refresh Rate
uint8_t baudRateCmd[11] = {0xA0, 0xA1, 0x00, 0x04, 0x05, 0x00, 0x05, 0x00, 0x00, 0x0D, 0x0A}; // 115200 Baud Rate
// Objects ////////////////////////////////////////////
TinyGPSPlus gps;
// Initalizer /////////////////////////////////////////
void setup()
{
// Start serial ports
Serial.begin(NEW_BAUDRATE);
GPS_PORT.begin(SERIAL_BAUDRATE);
// Update Venus838FLPx baud rate to 115200
sendCommand(baudRateCmd, sizeof(baudRateCmd));
GPS_PORT.begin(NEW_BAUDRATE);
// Send Update Refresh Rate Command
sendCommand(refreshRateCmd, sizeof(refreshRateCmd));
return;
}
// Main Loop /////////////////////////////////////////
void loop()
{
// This sketch displays information every time a new sentence is correctly encoded.
while (GPS_PORT.available() > 0)
if ( gps.encode( GPS_PORT.read() ) )
displayInfo();
if (millis() > 5000 && gps.charsProcessed() < 10)
{
Serial.println(F("No GPS detected: check wiring."));
while(true);
}
return;
}
// Functions /////////////////////////////////////////
void sendCommand(uint8_t* Command, uint8_t sizeOfArray)
{
GPS_PORT.write(Command, sizeOfArray);
GPS_PORT.flush();
delay(10);
return;
}
void displayInfo()
{
Serial.print(F("Location: "));
if (gps.location.isValid())
{
Serial.print(gps.location.lat(), 6);
Serial.print(F(","));
Serial.print(gps.location.lng(), 6);
Serial.print(F(","));
Serial.print(gps.altitude.meters(),6);
}
else
{
Serial.print(F("INVALID"));
}
Serial.print(F(" Date/Time: "));
if (gps.date.isValid())
{
Serial.print(gps.date.month());
Serial.print(F("/"));
Serial.print(gps.date.day());
Serial.print(F("/"));
Serial.print(gps.date.year());
}
else
{
Serial.print(F("INVALID"));
}
Serial.print(F(" "));
if (gps.time.isValid())
{
if (gps.time.hour() < 10) Serial.print(F("0"));
Serial.print(gps.time.hour());
Serial.print(F(":"));
if (gps.time.minute() < 10) Serial.print(F("0"));
Serial.print(gps.time.minute());
Serial.print(F(":"));
if (gps.time.second() < 10) Serial.print(F("0"));
Serial.print(gps.time.second());
Serial.print(F("."));
if (gps.time.centisecond() < 10) Serial.print(F("0"));
Serial.print(gps.time.centisecond());
}
else
{
Serial.print(F("INVALID"));
}
Serial.println();
}
This is the program given by "OhSoCurious" in 2017 about a similar topic.
I have read all the discussion and learned a lot, thanks to you all. Now i would like to understand how to make it work at 50Hz (The maximum possible), and i think i need to rewrite a different bytes in this line :
uint8_t refreshRateCmd[10] = {0xA0, 0xA1, 0x00, 0x03, 0x0E, 0x14, 0x00, 0x1A, 0x0D, 0x0A};
I searched about the update configuration in the component datasheet but i could not find anything that led back to me.
All the adivices , links, documents, are appreciate.
Thanks you all.