I am trying to make a GPS tracker using the GPS module NEO 6M. How can I create a code for the argon board to make this GPS tracker using the neo 6m GPS module? Please help and thanks.
It looks like that GNSS unit has a serial interface (defaults to 9600 baud) and should support the standard NEMA protocol.
I’d start with the AssetTrackerRK library which includes the TinyGPS++ NEMA parser, and also includes some support for u-blox extensions that you may or may not eventually need.
Thank you soo much for this, i have a question, is the following set up connected properly to use example number 1 from your library?
the goal is to make a gps tracker using the neo 6m module, should i add anything more to this set up using example number 1 from your library as the code for this circuit?
That looks correct.
I am not able to find particle.h when adding that library to my code using the particle web IDE
@tineframe11, Particle.h
is “built-in” to the IDE and you don’t need to have the actual file to include it.
@tineframe11, are you compiling an example from the AssetTrackRK library and if so, which one?
Example 1. I will love to have this working for my argon board to make my GPS tracker using the NEO 6M module
@tineframe11, I am able to compile that example without any errors. Are you sure you have your Argon selected as the target (yellow star next to its name in the IDE).
i have my argon device connected, is there any way you can share a screenshot of it to see if i made any mistake?
Here is the code after i uploaded <TinyGPS++.h> and <AssetTrackerRK.h>
// This #include statement was automatically added by the Particle IDE.
#include <TinyGPS++.h>
// This #include statement was automatically added by the Particle IDE.
#include <AssetTrackerRK.h>
// only used for AssetTracker::antennaExternal
// Port of TinyGPS for the Particle AssetTracker
// https://github.com/mikalhart/TinyGPSPlus
SYSTEM_THREAD(ENABLED);
/*
This sample sketch demonstrates the normal use of a TinyGPS++ (TinyGPSPlus) object directly.
*/
void displayInfo(); // forward declaration
const unsigned long PUBLISH_PERIOD = 120000;
const unsigned long SERIAL_PERIOD = 5000;
const unsigned long MAX_GPS_AGE_MS = 10000; // GPS location must be newer than this to be considered valid
// The TinyGPS++ object
TinyGPSPlus gps;
unsigned long lastSerial = 0;
unsigned long lastPublish = 0;
unsigned long startFix = 0;
bool gettingFix = false;
void setup()
{
Serial.begin(9600);
// The GPS module on the AssetTracker is connected to Serial1 and D6
Serial1.begin(9600);
// Settings D6 LOW powers up the GPS module
pinMode(D6, OUTPUT);
digitalWrite(D6, LOW);
startFix = millis();
gettingFix = true;
// If using an external antenna, uncomment this block
// { AssetTracker t; t.antennaExternal(); }
}
void loop()
{
while (Serial1.available() > 0) {
if (gps.encode(Serial1.read())) {
displayInfo();
}
}
}
void displayInfo()
{
if (millis() - lastSerial >= SERIAL_PERIOD) {
lastSerial = millis();
char buf[128];
if (gps.location.isValid() && gps.location.age() < MAX_GPS_AGE_MS) {
snprintf(buf, sizeof(buf), "%f,%f,%f", gps.location.lat(), gps.location.lng(), gps.altitude.meters());
if (gettingFix) {
gettingFix = false;
unsigned long elapsed = millis() - startFix;
Serial.printlnf("%lu milliseconds to get GPS fix", elapsed);
}
}
else {
strcpy(buf, "no location");
if (!gettingFix) {
gettingFix = true;
startFix = millis();
}
}
Serial.println(buf);
if (Particle.connected()) {
if (millis() - lastPublish >= PUBLISH_PERIOD) {
lastPublish = millis();
Particle.publish("gps", buf, PRIVATE);
}
}
}
}
You need to remove TinyGPS++. There’s already a version in AssetTrackerRK and having two will cause that problem.
It didn’t remove properly. You may need to create a new project and only add AssetTrackerRK.
alright, thank you it finally compiled successfully now after flashing it where can i see results of the gps module sending location?
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.