agmue:
Ich habe die notwendige Hardware nicht, weshalb ich das längliche Programm nicht ausprobieren kann und sehe daher die Datenströme nicht. Daher wäre es hilfreiuch, das Problem in kleine Teilprobleme zu zerlegen:
- In der Zeile sats = GPGGAdata.substring(39,41); wird der String GPGGAdata auf die Anzahl der Sateliten untersucht. Sowas benötigst Du auch für die von Dir gesuchten Werte. Wie sieht beispielsweise der Inhalt von GPGGAdata aus? Mit Serial.print(GPGGAdata); wird Dir das angezeigt.
- Wo findest Du die gesuchten Werte innerhalb des Strings?
- Wie kann man den String hinsichtlich der gesuchten Werte zerlegen?
Hier ein Zitat von der Webseite des Autors: (die hatte ich oben verlinkt)
Leider hatte ich nie Englisch gelernt, daher ist das für mich immer ein Stochern im Nebel.
----- Zitat------
Reading the GPS module data to extract the number of Satellites detected
When the GPS module starts receiving satellite data it provides a constant stream of data sentences which are know as NMEA sentences. Within this data stream the most important NMEA sentences include the GGA which provides the current Fix data, the RMC which provides the minimum GPS sentences information, and the GSA which provides the Satellite status data. In our project we will use the GGA data stream to extract the number of satellites detected and locked on to.
Below is an example of a typical GGA data sentence:
$GPGGA,123519.00,4807.03830,N,01131.00000,E,1,08,0.9,545.4,M,46.9,M,,*47
Where:
GGA Global Positioning System Fix Data
123519.00 Fix taken at 12:35:19 UTC (current time)
4807.03830,N Latitude 48 deg 07.038′ N
01131.00000,E Longitude 11 deg 31.000′ E
1 Fix quality: 0 = invalid, 1 = GPS fix (SPS), 2 = DGPS fix, 3 = PPS fix, 4 = Real Time Kinematic,
5 = Float RTK, 6 = estimated (dead reckoning) (2.3 feature), 7 = Manual input mode,
8 = Simulation mode
08 Number of satellites being tracked
0.9 Horizontal dilution of position
545.4,M Altitude, Meters, above mean sea level
46.9,M Height of geoid (mean sea level) above WGS84 ellipsoid
(empty field) time in seconds since last DGPS update
(empty field) DGPS station ID number
*47 the checksum data, always begins with *
We will be using the data highlighted above to show the number of satellite on our LCD. In order to extract this information we will set up a second Software Serial port.
First we need to identify the NMEA data we need to capture and we do this with the flowing code:
char gpsin[8] = “$GPGGA,”; //define a character string “$GPGGA,”
if (GPSreceiver.find(gpsin)) { //if serial data starts with the characters “$GPGGA,”
GPGGAdata = GPSreceiver.readStringUntil(‘\n’); //read data until carriage return
When the characters “$GPGGA,” are detected it starts reading the remainder of the string data in to the buffer. So the captured data starts from the first digit of the ‘time’ data (and not from the $ character). The captured data then looks as follows:
123519.00,4807.03830,N,01131.00000,E,1,08,0.9,545.4,M,46.9,M,,*47
With in the main loop we will use the substring command to extract the number of satellites from the GGA data sentence. This is a simply and easy way of extracting the data you wish to use. The substring command is defined as follows:
substring(index, to) – this returns a string with the characters starting from index and ending at the character location before the to
So to extract the number of satellites (highlighted in read) from the GGA data sentence below
NMEA_data_stripped
We use the following code:
sats = GPGGAdata.substring(39,41);
The string “sats” now is equal to “08”
If you wanted to extract other data you simply need to change the “index, to” numbers in the substring. For example to extract the current time to a string labeled time then you would use:
time = GPGGAdata.substring(7,13); //the string “time” now is equal to “123519”
------ Zitat ende --------
agmue:
Die Punkte 1 und 2 kannst Du selbst lösen, bei 3 kann ich dann gerne helfen.
Mich irritiert z.B. die letzte Zeile, dort schreibt er ja, dass man durch Ersetzen der Zeile mit "sats" mit dieser Zeile die Zeitinformation bekommt. Bei mir hagelt es dann (für mich) unverständliche Fehlermeldungen.
Das ich die Daten in dieser NMEA-Zeile ab Pos. 0 finde, sehe ich ja, doch dann?
Wie schon geschrieben, ich bin noch ganz am Anfang....
Old-Papa