Hello, I am working on a agriculture application, the machine should drive at a speed of 700 mtr/hour.
This should be controlled by the gps receiver and a Arduino Nano.
As a test I use the following code:
#include <TinyGPS++.h>
#include <SoftwareSerial.h>
/*
This sample code demonstrates just about every built-in operation of TinyGPS++ (TinyGPSPlus).
It requires the use of SoftwareSerial, and assumes that you have a
4800-baud serial GPS device hooked up on pins 4(rx) and 3(tx).
*/
static const int RXPin = 3, TXPin = 2;
static const uint32_t GPSBaud = 9600;
// The TinyGPS++ object
TinyGPSPlus gps;
// The serial connection to the GPS device
SoftwareSerial ss(RXPin, TXPin);
// For stats that happen every 5 seconds
unsigned long last = 0UL;
void setup()
{
Serial.begin(115200);
ss.begin(GPSBaud);
Serial.println(F("GPS motor driver.ino"));
Serial.println(F("by Rien Brand"));
Serial.println();
}
float Speedval=0;
void loop()
{
// Dispatch incoming characters
while (ss.available() > 0)
gps.encode(ss.read());
if (gps.speed.isUpdated())
{
Speedval = (gps.speed.value());
Serial.print(F("SPEED km/h="));
Serial.println(gps.speed.kmph());
Serial.print(F(" Speedvalue "));
Serial.println(Speedval);
}
else if (millis() - last > 5000)
{
Serial.println();
if (gps.location.isValid())
Serial.print(F("DIAGS Chars="));
Serial.print(gps.charsProcessed());
Serial.print(F(" Sentences-with-Fix="));
Serial.print(gps.sentencesWithFix());
Serial.print(F(" Failed-checksum="));
Serial.print(gps.failedChecksum());
Serial.print(F(" Passed-checksum="));
Serial.println(gps.passedChecksum());
if (gps.charsProcessed() < 10)
Serial.println(F("WARNING: No GPS data. Check wiring."));
last = millis();
Serial.println();
}
}
This works well, but only when I drive first say 3 km/hour and then reduce the speed until the desired speed of 700mtr/uur.
If I start to drive with a lower speed than 1 km/hour, the indicated speed is approximately zero.
Does anyone have an idea?
Regards,
Rien
Ultimate GPS
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: Ultimate GPS
Does the speed ever become accurate, or does it remain 0 for as long as you drive?
- Rien
- Posts: 24
- Joined: Mon Jun 02, 2014 3:57 pm
Re: Ultimate GPS
As long as I drive below the 1 km the value stay to 0 -0.04 km, when I increase the speed to 2 km then the value become accurate even when I decrease the speed below the 1km.
If I start to drive again from 0 km the same happend, I have tried with reset the arduino, the GPS module and the seriele monitor with the same results.
If I start to drive again from 0 km the same happend, I have tried with reset the arduino, the GPS module and the seriele monitor with the same results.
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: Ultimate GPS
This may b a limitation of the onboard speed algorithm. You may have to develop your own algorithm. However, at such slow speeds, the inherent positional inaccuracies may make this difficult.
- Rien
- Posts: 24
- Joined: Mon Jun 02, 2014 3:57 pm
Re: Ultimate GPS
Hi, In the mean time I have tried the Venus GPS receiver with the same results, so I think I am on the end with the GPS posibilities.
Thanks for your help.
Regards,
Rien
Thanks for your help.
Regards,
Rien
- Rien
- Posts: 24
- Joined: Mon Jun 02, 2014 3:57 pm
Re: Ultimate GPS
Hy, can someone help to set the Nav Speed threshold, or better disable them. I have the command packet for this ($PMTK,0*3F<CR><LF>) but how can I use this in the code?
Thanks!
Thanks!
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: Ultimate GPS
That doesn't look like a complete PMTK command. There should be a number after "PMTK" and before the comma, like this:
"$PMTKnnn,0*3F"
The way you send a PMTK command is with the gps.sendCommand function:
gps.sendCommand("$PMTKnnn,0*3F");
"$PMTKnnn,0*3F"
The way you send a PMTK command is with the gps.sendCommand function:
gps.sendCommand("$PMTKnnn,0*3F");
- Rien
- Posts: 24
- Joined: Mon Jun 02, 2014 3:57 pm
Re: Ultimate GPS
Then I recieve a error: 'class TinyGPSPlus' has no member named 'sendCommand'
Can I use a additional liberary to resolve this?
Nou I see the problem, it must be: GPS.sendCommand("$PMTKnnn,0*3F");
Can I use a additional liberary to resolve this?
Nou I see the problem, it must be: GPS.sendCommand("$PMTKnnn,0*3F");
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: Ultimate GPS
OK - I looked up the Set Nav Speed Threshold command. The command number is 397, so to disable it, you would send
"$PMTK397,0*23"
"$PMTK397,0*23"
- Rien
- Posts: 24
- Joined: Mon Jun 02, 2014 3:57 pm
Re: Ultimate GPS
Hi,
With the TinyGPS Lib the
ss.println("$PMTK397,0*23");
command work correct
Now I have the correct speed from start (without delay) to 1Kpm, very nice!
Thanks for help!!
Rien
With the TinyGPS Lib the
ss.println("$PMTK397,0*23");
command work correct
Now I have the correct speed from start (without delay) to 1Kpm, very nice!
Thanks for help!!
Rien
- Rien
- Posts: 24
- Joined: Mon Jun 02, 2014 3:57 pm
Re: Ultimate GPS
Hi, I have still a problem, with the extarnal antenna I had to first move faster than 1,3 km/hour, If I then reduce the speed I get the right value, after a short break, the problem repeated itself.adafruit_support_rick wrote:Nice!
But if I use the GPS unit without the external antenna I get direct a correct value from 0-700Mtr/uur, Is it possible that the external antenna cable are to long or do search for a better antenna ?
Thanks for help,
Rien
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: Ultimate GPS
Maybe you need a better antenna. Do you get fewer satellites with the antenna?
- Rien
- Posts: 24
- Joined: Mon Jun 02, 2014 3:57 pm
Re: Ultimate GPS
Today I have a FGPANE Series antenna purchased at GlobalTop, I hope this work.
There is no difference in the number of satellites, with or without the included external antenna.
I have asked the GTop engineer but have no answer on my question or the lengt of the antenna wire make the difference.
Be continued!
There is no difference in the number of satellites, with or without the included external antenna.
I have asked the GTop engineer but have no answer on my question or the lengt of the antenna wire make the difference.
Be continued!
Please be positive and constructive with your questions and comments.