Reading NMEA data coming in over http port 5502
Posted: Thu May 19, 2016 4:12 pm
Hi all, thanks in advance for any help. I have a Sprint Wifi hotspot with a built-in GPS that I got from Freedompop. I want to read the GPS data from the hotspot on my ESP8266. There are two ways that may work
1. Parse the landing page of the device at http://192.168.0.1, deep in the HTML the lat/lon are coded. This feels slow and above the capabilities of the ESP8266 without having something more powerful available
2. If I navigate my laptop browser to http://sprinthotspot:5502, I will get the data in NMEA format like this every few seconds:
$GPGSV,3,1,10,03,35,292,22,22,42,258,16,31,65,029,16,32,35,125,14*71
$GPGSV,3,2,10,14,42,118,,16,28,202,,23,10,307,,25,16,042,*7D
$GPGSV,3,3,10,26,59,192,,29,21,073,*76
$GPGGA,140359.1,4045.576754,N,07358.430937,W,1,03,666.6,-4.7,M,,,,*3F
$GPVTG,,T,,M,,N,,K,N*2C
$GPRMC,140359.1,A,4045.576754,N,07358.430937,W,,,190516,,,A*79
$GPGSA,A,3,03,22,31,,,,,,,,,,666.6,666.6,666.6*33
$PSTIS,*61
I have tried the code below
but it doesn't seem to be able to connect to 5502, only port 80, and I get "connection failed" if I set the port to 5502.
Any thoughts or help great appreciated!
1. Parse the landing page of the device at http://192.168.0.1, deep in the HTML the lat/lon are coded. This feels slow and above the capabilities of the ESP8266 without having something more powerful available
2. If I navigate my laptop browser to http://sprinthotspot:5502, I will get the data in NMEA format like this every few seconds:
$GPGSV,3,1,10,03,35,292,22,22,42,258,16,31,65,029,16,32,35,125,14*71
$GPGSV,3,2,10,14,42,118,,16,28,202,,23,10,307,,25,16,042,*7D
$GPGSV,3,3,10,26,59,192,,29,21,073,*76
$GPGGA,140359.1,4045.576754,N,07358.430937,W,1,03,666.6,-4.7,M,,,,*3F
$GPVTG,,T,,M,,N,,K,N*2C
$GPRMC,140359.1,A,4045.576754,N,07358.430937,W,,,190516,,,A*79
$GPGSA,A,3,03,22,31,,,,,,,,,,666.6,666.6,666.6*33
$PSTIS,*61
I have tried the code below
Code: Select all
#include <ESP8266WiFi.h>
const char* ssid = "my-ssid";
const char* password = "my-password";
void setup() {
Serial.begin(115200);
delay(10);
// We start by connecting to a WiFi network
Serial.println();
Serial.println();
Serial.print("Connecting to ");
Serial.println(ssid);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi connected");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());
}
int value = 0;
void loop() {
delay(5000);
++value;
Serial.print("connecting to ");
Serial.println(host);
// Use WiFiClient class to create TCP connections
WiFiClient client;
const int httpPort = 5502;
if (!client.connect(host, httpPort)) {
Serial.println("connection failed");
return;
}
// Read all the lines of the reply from server and print them to Serial
while(client.available()){
String line = client.readStringUntil('\r');
Serial.print(line);
}
Serial.println();
Serial.println("closing connection");
} - See more at: http://www.esp8266.com/viewtopic.php?p=13806
but it doesn't seem to be able to connect to 5502, only port 80, and I get "connection failed" if I set the port to 5502.
Any thoughts or help great appreciated!