説明なし

svalavuo e0d61aed59 Update power_analysis to Wemos 1 ヶ月 前
.pio 4ae33b57ff Initial Commit 1 ヶ月 前
README.md 184dba913e esp32 to Wemos and adding pattery and solar apnel 1 ヶ月 前
info.txt 6d5c44ca64 Initial Commit 1 ヶ月 前
platformio.ini 184dba913e esp32 to Wemos and adding pattery and solar apnel 1 ヶ月 前
power_analysis.md e0d61aed59 Update power_analysis to Wemos 1 ヶ月 前
schematics.md 184dba913e esp32 to Wemos and adding pattery and solar apnel 1 ヶ月 前
solar_battery_system.md 184dba913e esp32 to Wemos and adding pattery and solar apnel 1 ヶ月 前
solar_schematics.md 184dba913e esp32 to Wemos and adding pattery and solar apnel 1 ヶ月 前
weather_station_diagram.jpg 6d5c44ca64 Initial Commit 1 ヶ月 前
weatherstation.ino 184dba913e esp32 to Wemos and adding pattery and solar apnel 1 ヶ月 前
wemos_d1mini_analysis.md 184dba913e esp32 to Wemos and adding pattery and solar apnel 1 ヶ月 前

README.md

Wemos D1 Mini Weather Station

A compact weather monitoring system built on Wemos D1 Mini with multiple sensors and MQTT connectivity for IoT integration.

Features

  • Temperature and humidity monitoring (DHT11)
  • Atmospheric pressure measurement (BMP180)
  • Rain detection sensor (analog)
  • Light detection (LDR) with LED status indicator
  • WiFi connectivity with automatic reconnection
  • MQTT data publishing with JSON format
  • Automatic MQTT reconnection with random client ID
  • Non-blocking timer-based sensor readings
  • Error handling with LED status indication
  • Serial debugging output (115200 baud)
  • Battery-friendly low power design
  • Compact form factor

Hardware Requirements

  • Wemos D1 Mini development board
  • DHT11 temperature/humidity sensor
  • BMP180 pressure sensor
  • Rain sensor module (analog output)
  • LDR (Light Dependent Resistor)
  • LED (for system status indication)
  • 10kΩ resistor (for LDR pull-down)
  • 220Ω resistor (for LED current limiting)
  • Breadboard and jumper wires

Software Dependencies

  • DHT sensor library
  • SFE BMP180 Breakout Library
  • PubSubClient

Configuration

Update the following constants in weatherstation.ino:

  • ssid: Your WiFi network name
  • password: Your WiFi password
  • mqtt_server: Your MQTT broker address
  • mqtt_port: MQTT broker port (default 1883)
  • mqtt_topic: MQTT topic for data publishing (default: weather/station)

Pin Configuration (Wemos D1 Mini)

  • DHT11 Sensor: D4 (GPIO2)
  • LDR Sensor: D3 (GPIO0) - Digital input
  • Rain Sensor: A0 (Analog input only)
  • Status LED: D5 (GPIO14)
  • I2C (SDA): D1 (GPIO5) - for BMP180
  • I2C (SCL): D2 (GPIO4) - for BMP180

MQTT Data Format

The station publishes JSON data to the configured topic:

{
  "temperature": 23.45,
  "humidity": 67.89,
  "pressure": 1013.25,
  "rainLevel": 15,
  "lightDetected": true
}

LED Status Indication

  • Steady ON: Light detected by LDR
  • Steady OFF: No light detected
  • Rapid Blinking: Sensor error detected

Serial Output Format

Temp: 23.45°C, Humidity: 67.89%, Rain: 15%, Pressure: 1013.25 hPa, Light: YES

Installation

  1. Install PlatformIO
  2. Set up MQTT broker (Mosquitto, HiveMQ, AWS IoT, etc.)
  3. Connect hardware according to pin configuration
  4. Update WiFi and MQTT credentials in sketch
  5. Run pio run to build
  6. Run pio run --target upload to flash
  7. Run pio device monitor to view serial output
  8. Subscribe to MQTT topic to receive weather data

MQTT Broker Setup

  1. Install Mosquitto broker or use cloud service
  2. Configure broker for client connections on port 1883
  3. Create topic structure: weather/station (or custom)
  4. Test broker connectivity with MQTT client tools
  5. Configure firewall if using local broker
  6. Verify broker allows anonymous connections or add authentication

Operation Schedule

  • Sensor readings: Every 2 seconds (2000ms)
  • MQTT data publishing: Every 30 seconds (30000ms)
  • LED status updates: With each sensor reading
  • WiFi connection attempts: 20 attempts (10 seconds timeout)
  • MQTT reconnection: Every 5 seconds if disconnected

Troubleshooting

  • Sensor errors: Check wiring connections and power supply
  • WiFi connection: Verify SSID and password credentials
  • MQTT connection: Ensure broker is accessible and running
  • DHT11 readings: Look for NaN values in serial output
  • BMP180 sensor: Verify initialization and I2C connection
  • Rain sensor: Check analog pin assignment (Pin 34)
  • LDR/LED: Verify digital pin assignment (Pin 35 for LDR, Pin 2 for LED)
  • LED status: Rapid blinking indicates sensor errors

Code Architecture

  • Modular design: Separate functions for each sensor
  • Non-blocking operations: Timer-based without delays
  • Structured data: WeatherData struct for sensor values
  • Error handling: Validation and status reporting
  • Automatic recovery: WiFi and MQTT reconnection logic

Technical Specifications

  • Microcontroller: ESP32 (Dual Core, 240MHz)
  • Memory: 520KB SRAM, 4MB Flash
  • Wireless: WiFi 802.11 b/g/n
  • Sensors: DHT11 (±2°C, ±5%RH), BMP180 (±1hPa), Rain sensor, LDR
  • Power: 5V via USB or external supply (battery-friendly)
  • Communication: I2C, WiFi, MQTT
  • Status: LED indicator for system status

Schematics and Wiring

Quick Reference Diagram

Wemos D1 Mini Weather Station Wiring
┌─────────────────────────────────────┐
│ Wemos D1 Mini                      │
│ ┌─────┐ ┌─────┐ ┌─────┐ ┌─────┐   │
│ │ D5  │ │ D4  │ │ D1  │ │ D2  │   │
│ │ LED │ │DHT11│ │ SDA │ │ SCL │   │
│ └─────┘ └─────┘ └─────┘ └─────┘   │
│ ┌─────┐ ┌─────┐                     │
│ │ A0  │ │ D3  │                     │
│ │Rain │ │ LDR │                     │
│ └─────┘ └─────┘                     │
└─────────────────────────────────────┘

Complete Wiring Guide

  • DHT11 Sensor: D4 (Data), 3.3V, GND
  • BMP180 Sensor: SDA→D1, SCL→D2, 3.3V, GND
  • Rain Sensor: AO→A0, 3.3V, GND
  • LDR: D3 with 10kΩ pull-down, 3.3V
  • LED: D5 with 220Ω resistor, GND

Detailed Schematics

For complete circuit diagrams, component layouts, and assembly instructions, see schematics.md.

Bill of Materials

  • Wemos D1 Mini Development Board
  • DHT11 Temperature & Humidity Sensor
  • BMP180 Pressure Sensor
  • Rain Sensor Module (analog)
  • LDR (Light Dependent Resistor)
  • LED (5mm) + 220Ω resistor
  • 10kΩ resistor (for LDR)
  • Breadboard and jumper wires

Battery Operation

For power analysis and battery operation guidelines, see power_analysis.md.