Professional Documents
Culture Documents
Wemos D1 Mini Weather Station
Wemos D1 Mini Weather Station
Creating a weather station using the Wemos D1 Mini is a great project. The Wemos
D1 Mini is based on the ESP8266 WiFi module, making it suitable for connecting your
weather station to the internet for remote monitoring. Here's a basic example using
the Wemos D1 Mini, DHT22 for temperature and humidity, and BMP180 for pressure
sensors:
Components needed:
Here's an example code for a weather station using the Wemos D1 Mini:
#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BMP085_U.h>
#include <DHT.h>
#include <ESP8266WiFi.h>
#define DHT_PIN D2 // Define the pin for the DHT sensor (change as needed)
#define DHT_TYPE DHT22 // Use DHT22 sensor; change to DHT11 if using that
void setup() {
Serial.begin(9600);
delay(1000);
WiFi.begin(ssid, password);
Serial.println("Connected to WiFi");
dht.begin();
if (!bmp.begin()) {
Serial.println("Could not find a valid BMP085 sensor, check wiring!");
while (1);
}
}
void loop() {
sensors_event_t event;
bmp.getEvent(&event);
Serial.print("Temperature: ");
Serial.print(temperature);
Serial.println(" °C");
Serial.print("Humidity: ");
Serial.print(humidity);
Serial.println(" %");
Serial.print("Pressure: ");
Serial.print(pressure);
Serial.println(" hPa");
his code is similar to the previous example, but it also connects to your WiFi network
using the ESP8266WiFi library, allowing you to upload data to an online service or
display it on a web page. Don't forget to replace "your_SSID" and "your_PASSWORD"
with your actual WiFi credentials.
You can enhance this project further by adding a web server to display weather data,
using a cloud service for data storage, or integrating other sensors like a rain gauge or
wind speed sensor for a more comprehensive weather station.