Skip to content

Repository files navigation

WeatherStation Outdoor 🌡️

ESP32-based outdoor environmental monitoring device with BLE connectivity to the indoor WeatherStation.

Features

  • Environmental Monitoring: BME280 sensor for temperature, humidity, and pressure
  • Battery Management: LC709203F fuel gauge for LiPo battery monitoring
  • BLE Client: Connects to indoor WeatherStation to transmit data
  • Power Efficient: Deep sleep operation with configurable intervals
  • Low Power: Optimized for battery-powered outdoor operation

Hardware Requirements

  • ESP32 development board
  • BME280 environmental sensor
  • LC709203F battery fuel gauge
  • 18650 Li-ion battery (3.7V, 3000mAh typical)
  • Weatherproof enclosure

Pin Connections

Component ESP32 Pin Description
BME280 SDA GPIO 21 I2C data line
BME280 SCL GPIO 22 I2C clock line
LC709203F SDA GPIO 21 I2C data line (shared)
LC709203F SCL GPIO 22 I2C clock line (shared)

Configuration

All settings are configurable in src/config.h:

Sleep Configuration

#define SLEEP_DURATION_SECONDS 300  // 5 minutes (300 seconds)

BLE Configuration

#define BLE_SERVICE_UUID "4fafc201-1fb5-459e-8fcc-c5c9c331914b"
#define BLE_CHARACTERISTIC_UUID "beb5483e-36e1-4688-b7f5-ea07361b26a8"
#define BLE_SCAN_INTERVAL 1349            // 1.35 seconds between scans
#define BLE_SCAN_WINDOW 134               // 10% duty cycle (134ms/1349ms)
#define BLE_SCAN_DURATION 5               // 5 seconds max scan time
#define BLE_SCAN_ACTIVE false             // Passive scanning (lower power)
#define BLE_POWER_LEVEL ESP_PWR_LVL_P3    // +3 dBm - good range, lower power

Battery Configuration

// 18650 Battery Settings
#define BATTERY_CAPACITY LC709203F_APA_3000MAH  // 3000mAh typical for 18650
#define BATTERY_ALARM_VOLTAGE 3.2               // 3.2V minimum for 18650
#define BATTERY_PROFILE LC709203_ICR18650_SAMSUNG  // Samsung 18650 profile

I2C Configuration

#define I2C_SDA 21
#define I2C_SCL 22

Operation

  1. Boot: Initialize sensors and BLE client
  2. Sensor Reading: Read BME280 data (temperature, humidity, pressure)
  3. Battery Check: Monitor battery voltage and percentage
  4. Data Serialization: Pack data into binary format
  5. BLE Connection: Connect to indoor WeatherStation
  6. Data Transmission: Send serialized data
  7. Deep Sleep: Enter configurable sleep cycle

Data Format

The device sends serialized data in this format:

struct {
    float temperature;    // 4 bytes
    float humidity;       // 4 bytes  
    float pressure;       // 4 bytes
    float batteryVoltage; // 4 bytes
    float batteryPercent; // 4 bytes (changed from int to float for compatibility)
} // Total: 20 bytes

Power Management

  • Deep Sleep: Configurable sleep duration (default: 5 minutes)
  • Battery Monitoring: Real-time voltage and percentage tracking
  • Low Power Mode: Optimized BLE settings for minimal power consumption
  • Wake-up: Timer-based wake-up from deep sleep

Power Optimizations Applied

The WeatherStation_outdoor is optimized for maximum battery life:

  1. BME280 Sensor: 4x oversampling (60% power reduction)
  2. BLE Configuration: +3 dBm power, 10% scan duty cycle (75% power reduction)
  3. Deep Sleep: 5-minute sleep cycles minimize active time
  4. 18650 Battery: Proper voltage monitoring and alarm settings

Estimated Battery Life Improvement: 3-5x longer operation compared to default settings

Integration

This device works as a BLE client that connects to the indoor WeatherStation:

  • Indoor station acts as BLE server
  • Outdoor data is integrated into the web interface
  • Available through the indoor station's API
  • Compatible with Home Assistant integration

Data Compatibility

The outdoor station sends data in a format that perfectly matches the indoor station's expectations:

  • All sensor values are transmitted as 32-bit floats
  • Data structure is optimized for reliable BLE transmission
  • Battery percentage is sent as float for precise monitoring

Building and Uploading

  1. Clone the repository
  2. Configure settings in src/config.h
  3. Connect hardware according to pin diagram
  4. Build and upload:
    pio run -t upload

Customization

Adjusting Sleep Duration

Change SLEEP_DURATION_SECONDS in src/config.h:

  • 60 seconds = 1 minute
  • 300 seconds = 5 minutes (default)
  • 600 seconds = 10 minutes

Battery Capacity

Update BATTERY_CAPACITY for your battery:

  • LC709203F_APA_1000MAH for 1000mAh
  • LC709203F_APA_2000MAH for 2000mAh
  • LC709203F_APA_3000MAH for 3000mAh (18650 default)

Battery Profile

For 18650 batteries, use:

  • LC709203_ICR18650_SAMSUNG for Samsung 18650 (default)
  • LC709203_ICR18650_PANASONIC for Panasonic 18650

BME280 Sensor Settings

The BME280 is configured for optimal outdoor performance:

  • Oversampling: 4x for all sensors (good accuracy, lower power)
  • Mode: Forced mode (on-demand reading)
  • Filter: 4x filtering (reduces outdoor noise)
  • I2C Address: 0x76 (standard)

Benefits of this configuration:

  • Power Savings: ~60% reduction in sensor power consumption
  • Faster Readings: ~4x faster sensor response time
  • Better Stability: Filtering reduces outdoor environmental noise
  • Maintained Accuracy: Still excellent resolution for weather monitoring

BLE Settings

The BLE configuration is optimized for battery life:

  • Power Level: +3 dBm (good range, lower power consumption)
  • Scan Duty Cycle: 10% (134ms scan window every 1.35s)
  • Scan Duration: 5 seconds maximum
  • Passive Scanning: Lower power consumption

Benefits of this configuration:

  • Power Savings: ~75% reduction in BLE power consumption
  • Faster Connection: Shorter scan duration (5s vs 10s)
  • Sufficient Range: +3 dBm covers typical outdoor-indoor distances
  • Better Battery Life: Significant improvement in overall power efficiency

Modify scan parameters for different environments:

  • BLE_SCAN_INTERVAL: Scan interval (higher = less power)
  • BLE_SCAN_WINDOW: Scan window (lower = less power)
  • BLE_SCAN_DURATION: How long to scan (seconds)

Documentation

Troubleshooting

Device Not Connecting

  • Check BLE UUIDs match indoor station
  • Verify indoor station is powered and advertising
  • Check battery voltage is above alarm threshold

Sensor Reading Issues

  • Verify I2C connections (SDA/SCL)
  • Check BME280 sensor is properly powered
  • Ensure I2C address is correct (0x76 or 0x77)

Battery Issues

  • Verify battery capacity setting matches actual battery
  • Check battery profile setting for your cell chemistry
  • Monitor battery voltage through serial output

License

This project is licensed under the MIT License.

About

ESP32-based outdoor environmental monitoring device with BLE connectivity

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages