I've disassembled a drone and found a GPS module. I want to use it. I haven't found any information about the architecture and the Serial.begin
value I have to use. Could I break it if I tried different values of Serial.begin
as 4800, 9600 and different types of architecture like NMEA with TinyGPS?
The module: https://www.aliexpress.us/item/3256805691773977.html
I've tried this sketch and ss.available()
is constantly false, why aren't any chars available?
#include <SoftwareSerial.h>
#include <TinyGPS.h>
/* This sample code demonstrates the normal use of a TinyGPS object.
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).
*/
TinyGPS gps;
SoftwareSerial ss(4, 3);
void setup()
{
Serial.begin(115200);
ss.begin(4800);
Serial.print("Simple TinyGPS library v. "); Serial.println(TinyGPS::library_version());
Serial.println("by Mikal Hart");
Serial.println();
}
void loop()
{
bool newData = false;
unsigned long chars;
unsigned short sentences, failed;
// For one second we parse GPS data and report some key values
for (unsigned long start = millis(); millis() - start < 1000;)
{
while (ss.available())
{
char c = ss.read();
// Serial.write(c); // uncomment this line if you want to see the GPS data flowing
if (gps.encode(c)) // Did a new valid sentence come in?
newData = true;
}
}
if (newData)
{
float flat, flon;
unsigned long age;
gps.f_get_position(&flat, &flon, &age);
Serial.print("LAT=");
Serial.print(flat == TinyGPS::GPS_INVALID_F_ANGLE ? 0.0 : flat, 6);
Serial.print(" LON=");
Serial.print(flon == TinyGPS::GPS_INVALID_F_ANGLE ? 0.0 : flon, 6);
Serial.print(" SAT=");
Serial.print(gps.satellites() == TinyGPS::GPS_INVALID_SATELLITES ? 0 : gps.satellites());
Serial.print(" PREC=");
Serial.print(gps.hdop() == TinyGPS::GPS_INVALID_HDOP ? 0 : gps.hdop());
}
gps.stats(&chars, &sentences, &failed);
Serial.print(" CHARS=");
Serial.print(chars);
Serial.print(" SENTENCES=");
Serial.print(sentences);
Serial.print(" CSUM ERR=");
Serial.println(failed);
if (chars == 0)
Serial.println("** No characters received from GPS: check wiring **");
}
-
1No, the module will not break because of an incorrect baudrate.chrisl– chrisl12/02/2023 10:26:40Commented Dec 2, 2023 at 10:26
-
What do you mean? Do you want an explanation of the modules protocol? We also can only google for the datasheet of the module. Without a part number that is also impossible. Though such modules often send human readable data (in ASCII format) over serial. So you can look at the data in the Serial Monitor and check, how to read it. Thats something, that you need to test yourself (we don't have your module)chrisl– chrisl12/02/2023 14:47:11Commented Dec 2, 2023 at 14:47
-
Probably a nice clear picture of this GPS module would help. FWIW, the GPS modules I have worked with start out running at either 9600 or 15200. If you want to learn about GPS it may be better to get a known good GPS module from the likes of sparkfun or adafruit. Either supplier/manufacturer have good web presence, support and community. All good assets for people w/lots of questions.st2000– st200012/02/2023 15:05:30Commented Dec 2, 2023 at 15:05
-
1BTW, serial protocols such as RS232 have been around likely before you were born (no offense). Back when a few things had to be everything to everybody. It's been called "the standard that isn't". That said, the major knobs are speed, number of data bits, number of stop bits and parity. You should be able to fiddle w/all that w/little concern about damaging what is connected. The thing you need to worry about: True RS232 swings from -12 Volts to 12 Volts. That will certainly be cause for alarm. But most Arduinos will pump out RS232 like pulses that swing from 0 to 5 Volts or 0 to 3 Volts.st2000– st200012/02/2023 15:16:59Commented Dec 2, 2023 at 15:16
-
ok thanks, last thing, the gps module is connected correctly but no data is available with the SoftwareSerial library, i've modified the question why that happens, should i pass some data to the tx pin of the module before receiving data at the rx?drMAIN– drMAIN12/02/2023 18:17:39Commented Dec 2, 2023 at 18:17
1 Answer 1
The GPS module you link to is UART-I2C dual mode. You switch between these 2 modes by (de)soldering resistors. Check first which mode the module is in.
Most GPS these days are in 9600 baud, when in UART mode. Try that too. enter image description here