ESP8266 with a GPS module (such as the popular NEO-6M) and a BMP280 sensor, along with a web server to display the data

#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <TinyGPS++.h>
#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BMP280.h>

#define WIFI_SSID "Hogwarts LANister"
#define WIFI_PASSWORD "Password#123"
#define SERVER_PORT 80

const char *ssid = WIFI_SSID;
const char *password = WIFI_PASSWORD;

ESP8266WebServer server(SERVER_PORT);

#define BMP_SDA D2
#define BMP_SCL D1

#define GPS_RX_PIN 13 // GPIO pin 13 (RX)
#define GPS_TX_PIN 15 // GPIO pin 15 (TX)

TinyGPSPlus gps;
Adafruit_BMP280 bmp;

#define SEALEVELPRESSURE_HPA (1013.25) // Sea level pressure in hPa

void setup() {
Serial.begin(115200);

// Connect to WiFi
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}

// Start BMP280 sensor
if (!bmp.begin()) {
Serial.println("Could not find a valid BMP280 sensor, check wiring!");
while (1);
}

// Start GPS
Serial.println("Starting GPS");
Serial1.begin(9600); // Assuming NEO-6M GPS module connected to Serial1

// Set up routes for web server
server.on("/", handleRoot);

server.begin();
}

void loop() {
server.handleClient();

while (Serial1.available() > 0) {
char c = Serial1.read();
Serial.write(c); // Print raw GPS data for debugging
if (gps.encode(c)) {
if (gps.location.isValid()) {
// Print latitude, longitude, and satellite count
Serial.print("Latitude: ");
Serial.println(gps.location.lat(), 6);
Serial.print("Longitude: ");
Serial.println(gps.location.lng(), 6);
Serial.print("Satellite Count: ");
Serial.println(gps.satellites.value());
}
}
}

float temperature = bmp.readTemperature();
float pressure = bmp.readPressure() / 100.0;

delay(1000);
}

void handleRoot() {
float temperature = bmp.readTemperature();
float pressure = bmp.readPressure() / 100.0;
float altitude = bmp.readAltitude(SEALEVELPRESSURE_HPA);
int satelliteCount = gps.satellites.value();
double latitude = gps.location.lat();
double longitude = gps.location.lng();

String page = "ESP8266 Weather Station";
page += "

Weather Station

";
page += "

Temperature: ";
page += temperature;
page += " *C

";
page += "

Pressure: ";
page += pressure;
page += " hPa

";
page += "

Altitude: ";
page += altitude;
page += " meters

";
page += "

Latitude: ";
page += String(latitude, 6);
page += "

";
page += "

Longitude: ";
page += String(longitude, 6);
page += "

";
page += "

Satellite Count: ";
page += satelliteCount;
page += "

";
page += "";

server.send(200, "text/html", page);
}
OUTPUT IS : Weather Station
Temperature: 27.91 *C

Pressure: 1008.57 hPa

Altitude: 39.04 meters

Latitude: 0.000000

Longitude: 0.000000

Satellite Count: 0 Why GPS Data Not Showing

Welcome to the forum

You started a topic in the Uncategorised category of the forum

Your topic has been moved to a relevant category. Please be careful in future when deciding where to start new topics

Please follow the advice given in the link below when posting code, in particular the section entitled 'Posting code and common code problems'

Use code tags (the < CODE/ > icon above the compose window) to make it easier to read and copy for examination

https://forum.arduino.cc/t/how-to-get-the-best-out-of-this-forum

@anon72622179 Why did you PM me ?

Are you saying that your life is at risk if you don't get this project working ? I find that hard to believe

So far you have started a topic in the wrong place, not used code tags when advised to do so and have not even told us what the problem is with your code

Start by using Edit/Auto Format in the IDE then Edit/Copy for Forum to copy and add the code tags and post the code into a new reply here. In that reply tell us the problems that you have with the code

@UKHeliBob why the Command line tools category?

I moved it to Programming then subsequently @anon72622179 moved it to Command Line Tools

I will move it back

@anon72622179 Do not move the topic again or you risk will be suspended from the forum. Your behaviour so far has been unacceptable. If you want help then you must help us to help you

ok sure i am new here

I appreciate that you are new here, but that is even more of a reason to follow the advice given to you

As previously suggested

don't talk rubbish solved my problem (SALA MC)

Exactly which part of my reply is rubbish ?

this part are you DON

No, sorry, I am still not getting what you mean

If you want to insult me then do it in plain English

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.