I am using a neo 7m as GPS for my project.
Getting garbage output like this:
⸮⸮⸮⸮⸮⸮⸮ repeated infinitely.
Here is the code:
#include <TinyGPSPlus.h>
#include <SoftwareSerial.h>
static const int RXPin = 0, TXPin = 1;
static const uint32_t GPSBaud = 115200;
double LAT;
double LON;
String ATsendString = "AT+SEND=0";
String LAT2 = "LAT";
String LON2 = "LON";
String LatString1 = ATsendString + ", " + String(LAT).length() + String(LAT) + "\r";
String LonString1 = ATsendString + ", " + String(LAT).length() + String(LAT) + "\r";
// The TinyGPS++ object
TinyGPSPlus gps;
// The serial connection to the GPS device
SoftwareSerial ss(RXPin, TXPin);
SoftwareSerial lora(2, 3);
void setup()
{
Serial.begin(115200);
ss.begin(GPSBaud);
lora.begin(115200);
}
void loop()
{
while (ss.available() > 0)
if (gps.encode(ss.read()))
if (gps.location.isValid()) {
LAT = (gps.location.lat(), 6);
LON = (gps.location.lng(), 6);
Serial.println(LAT);
Serial.println(LON);
}else{
Serial.println(F("INVALID"));
}
if (millis() > 5000 && gps.charsProcessed() < 10)
{
Serial.println(F("No GPS detected: check wiring."));
//Serial.println("AT+ADDRESS?\r");
while(true);
}
}
Here is the picture:
That looks like mismatched baudrates.
My NEO6-M Uses 9600 but I don't know the NEO7. Read the datasheet and check it up. It looks odd to me.
Personally I use this stuff:
#include <SoftwareSerial.h>
#include <TinyGPS++.h>
#include <Wire.h>
#include <hd44780.h>
#include <hd44780ioClass/hd44780_I2Cexp.h>
//#define BACKLIGHT_PIN 13
hd44780_I2Cexp mylcd; // declare lcd object: auto locate & config exapander chip
// LCD geometry
#define LCD_COLS 20
#define LCD_ROWS 4
// The TinyGPS++ object
TinyGPSPlus gps;
TinyGPSCustom vdop(gps, "GPGSA", 17);//Pick upVdop
//Create GPS channel using digital i/o
#define RX 2
#define TX 3
SoftwareSerial mySerial(RX, TX); // pick any 2 unused digital pins (not pins 0 or 1)
I might be wrong, being an UNO guy, but on an UNO Serial runs on pin 0 and 1 but You try to also run SoftwareSerial on the same pins. That can't work. Use pin 4 and 5 for SS, or any other free digital pins.
Software serial hardly works at that speed. I've seen here that 38400 sometimes makes trouble. Use a lower baudrate. Starting with the default 9600 is a good idea. And please don't write "urgent". That's bad. Every member asking a question is considered the same important. Using elbows is not rewarded.
1 Like
I think you’re being very optimistic using SoftwareSerial at 115200 on any device.
Will not work with SoftwareSerial. As you have discovered.
J-M-L
November 14, 2022, 10:23am
7
and according to the image, the GPS does not seem to be connected to 0 and 1 anyway (there is nothing plugged in there)
What did you expect the ", 6" to do? You can't specify the number of decimal digits in a 'float'. That only works in Serial.print() and Serial.println().
Try:
LAT = gps.location.lat();
LON = gps.location.lng();
system
Closed
May 13, 2023, 4:38pm
9
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.