All Projects → hugokernel → esphome-weather-station

hugokernel / esphome-weather-station

Licence: MIT License
ESPHome version of Elektor weather station v2

Programming Languages

OpenSCAD
209 projects

Projects that are alternatives of or similar to esphome-weather-station

ESPHome-Air-Quality-Monitor
ESPHome configuration for a DIY indoor air quality monitor for CO₂ concentration, PM2.5 and PM10 concentrations, and temperature, humidity and pressure
Stars: ✭ 42 (-70%)
Mutual labels:  esp32, home-assistant, esphome
Home Assistant Config
My Home Assistant configuration & documentation.
Stars: ✭ 99 (-29.29%)
Mutual labels:  esp32, home-assistant, homeassistant
M5Stack-Air-Quality-ESPHome
ESPHome configuration for M5Stack's PM2.5 Air Quality Kit with the PMSA003 particulate matter sensor and the SHT20 temperature and humidity sensor
Stars: ✭ 19 (-86.43%)
Mutual labels:  esp32, home-assistant, esphome
ESPHome-OpenTherm
Example of how to control an opentherm boiler with esphome
Stars: ✭ 54 (-61.43%)
Mutual labels:  esp32, home-assistant, esphome
home
Monorepo for all home automation related development, including integrated firmware, PCBs, configuration, and bridges
Stars: ✭ 104 (-25.71%)
Mutual labels:  esp32, home-assistant, homeassistant
hass-livebox-component
Livebox Component for Home assistant
Stars: ✭ 24 (-82.86%)
Mutual labels:  home-assistant, homeassistant
addon-matrix
Matrix - Home Assistant Community Add-ons
Stars: ✭ 39 (-72.14%)
Mutual labels:  home-assistant, homeassistant
HomeAssistant
My Home Assistant Configuration
Stars: ✭ 71 (-49.29%)
Mutual labels:  home-assistant, homeassistant
openrgb ha
OpenRGB integration for Home Assistant
Stars: ✭ 40 (-71.43%)
Mutual labels:  home-assistant, homeassistant
homeassistant-lightwave2
Lightwave RF custom component for Home Assistant. Requires generation 2 ("Link Plus") hub, but will control both generation 1 ("Connect Series") and generation 2 ("Smart Series") devices.
Stars: ✭ 31 (-77.86%)
Mutual labels:  home-assistant, homeassistant
addon-traccar
Traccar - Home Assistant Community Add-ons
Stars: ✭ 65 (-53.57%)
Mutual labels:  home-assistant, homeassistant
addon-example
Example - Home Assistant Community Add-ons
Stars: ✭ 73 (-47.86%)
Mutual labels:  home-assistant, homeassistant
iocage-homeassistant
Home Assistant Core - TrueNAS CORE Community Plugin
Stars: ✭ 61 (-56.43%)
Mutual labels:  home-assistant, homeassistant
custom-component-store
📦 Manage your custom_components for Home Assistant
Stars: ✭ 12 (-91.43%)
Mutual labels:  home-assistant, homeassistant
decluttering-card
🧹 Declutter your lovelace configuration with the help of this card
Stars: ✭ 186 (+32.86%)
Mutual labels:  home-assistant, homeassistant
hhnl.HomeAssistantNet
No description or website provided.
Stars: ✭ 31 (-77.86%)
Mutual labels:  home-assistant, homeassistant
amshan-homeassistant
Home Assistant integrasjon for strømmålere (AMS/HAN/P1). Integrasjonen støter både streaming (serieport/TCP-IP) og MQTT (Tibber Pulse, energyintelligence.se etc)
Stars: ✭ 39 (-72.14%)
Mutual labels:  home-assistant, homeassistant
wyzesense2mqtt
Configurable WyzeSense to MQTT Gateway intended for use with Home Assistant or other platforms that use MQTT discovery mechanisms.
Stars: ✭ 55 (-60.71%)
Mutual labels:  home-assistant, homeassistant
Tuya-v2-Supported-Devices
A collection of all of the known working Tuya v2 Devices
Stars: ✭ 30 (-78.57%)
Mutual labels:  home-assistant, homeassistant
hassio
ESPHome Hass.io addon files
Stars: ✭ 175 (+25%)
Mutual labels:  esp32, home-assistant

ESPHome Weather Station

Read this in other language: French

Main photo of the weather station

Introduction

The electronic part of this weather station is based on the model described in an article in Elektor magazine published in May 2020 entitled Remake Elektor weather station (an evolution of ESP32 Weather Station described in an article in the same magazine in January 2019).

The article details the creation of a weather station based on a set of sensors referenced WH-SP-WS02 (Datasheet) whose original electronics are removed to be replaced by a sensor daughter board relaying the information to a motherboard built around an ESP32 (ESP32 Pico Kit).

An OpenSource firmware GitHub - ElektorLabs/191148-RemakeWeatherStation: RemakeWeatherStation is available to run the whole system. Unfortunately, I did not find my happiness with it, it is not yet complete enough and suffers from some shortcomings that make it very difficult to use it as is.

I therefore decided to use ESPHome as a replacement for the original program in order to simplify the development of functionality but above all to greatly extend its capabilities.

The board detailed in Elektor's article is finally limited to a voltage converter and a 5V/3V voltage adaptation for the ESP32.

It is therefore quite simple to recreate this weather station independently of Elektor's PCB. For the connections, please use the data included in the YAML file.

With the kind permission of Elektor, the schematic diagrams are available here: Schematics.

Case photo

Inspirations

Features

  • Measurement of temperature / relative humidity / atmospheric pressure
  • Wind speed / Direction
  • Precipitation daily / per minute
  • Ambient brightness
  • Input voltage
  • Solar panel:
    • Voltage
    • Current
    • Power
    • Daily accumulated power
  • RGB status led with WS2812
  • All ESPHome features

Note: On the main picture of the weather station, there is a box on top, it is an independent rain detection module.

Installation

In order to install the firmware on the ESP32, I invite you to follow the procedure described on the ESPHome website: Getting Started with ESPHome

Mechanical

For the mast, I used a metal reinforced PVC tube that you can find in any DIY store in the plumbing department. In order to fix it on a wall, I modeled it on OpenSCAD one piece that I then printed in PETG.

Here is the printed piece next to the box containing the solar panel charger controller:

Photo of the power supply box

Powering

One of the flaws that I reproach to the original Elektor board is to have linked the technology of the power source to the motherboard (in this case the lead battery), indeed, a MAX8212 used with some peripheral components allows to cut the power supply when it goes below a threshold defined by the value of 3 resistors. This threshold has been chosen to protect a lead battery.

Since a weather station is supposed to stay on all the time, I don't really understand the above choice because:

  • We use a solar panel to charge the battery but in this case we are obliged to use a charge regulator which also protects the battery and therefore the integrated protection circuit is redundant and can even cause problems.
  • The station is connected to an unlimited power source (domestic power via a regulator) and in this case the protection circuit is useless.

In the 2 cases mentioned above, a strong link is inserted on the motherboard with the battery technology, which should be done, imho, on an independent card / module.

For my part, I chose to power my weather station via a 30W solar panel and a relatively basic charge controller.

If you are using Elektor's motherboard with an independent load controller module, do not forget to lower the cut-off threshold of the MAX8212.

At the output of the solar panel, the INA219 circuit allows the power generated by the solar panel to be measured. I plan to replace it with INA3221 in order to also measure the total consumption of the weather station and help me to refine the global consumption (a RFLink with OpenMQTTGateway and a second ESP32 kit is connected to the station).

I use a 7A lead battery recovered from an old inverter.

To size the whole thing, I recommend the BatteryStuff Tools tool which is very handy.

Currently, I can't say that I have succeeded in making my weather station totally energy independent because of a bad exposure of my solar panel and a too high consumption of an additional module (rain detection module).

Explanations

Measurement of temperature / humidity / atmospheric pressure

These 3 quantities are measured by a Bosch BME280 sensor and its configuration in ESPHome is as follows:

  - platform: bme280
    address: 0x76
    update_interval: 60s
    iir_filter: 16x
    temperature:
      name: "${friendly_name} temperature"
      oversampling: 16x
    humidity:
      name: "${friendly_name} humidity"
      oversampling: 16x
    pressure:
      name: "${friendly_name} pressure"
      oversampling: 16x

The sensor is to be put inside the box containing the original sensor electronics.

Initially, I also included an AM2320 sensor to compare the sensor values with the following configuration:

  - platform: am2320
    setup_priority: -100
    temperature:
      id: am2320_temperature
      name: "${friendly_name} AM2320 temperature"
    humidity:
      id: am2320_humidity
      name: "${friendly_name} AM2320 humidity"
    update_interval: 60s

The temperatures and humidities of the sensors were averaged before being sent to Home Assistant (see below), it was of course possible to access the data of each sensor.

  - platform: template
    name: "${friendly_name} temperature"
    icon: "mdi:thermometer"
    unit_of_measurement: "°C"
    lambda: |-
      return (
        id(bme280_temperature).state
        +
        id(am2320_temperature).state
      ) / 2;

  - platform: template
    name: "${friendly_name} humidity"
    icon: "mdi:water-percent"
    unit_of_measurement: "%"
    lambda: |-
      return (
        id(bme280_humidity).state
        +
        id(am2320_humidity).state
      ) / 2;

At the end of my tests, the BME280 sensor is more reliable and more accurate than the AM2320 sensor.

Wind measurements

Speed

The wind speed sensor is connected to general input 34. The ESPHome pulse_counter platform is used to perform the measurement.

  - platform: pulse_counter
    pin:
      number: GPIO34
      mode: INPUT_PULLUP
    unit_of_measurement: 'm/s'
    name: "${friendly_name} wind speed"
    icon: 'mdi:weather-windy'
    count_mode:
      rising_edge: DISABLE
      falling_edge: INCREMENT
    internal_filter: 13us
    update_interval: 60s
    # rotations_per_sec = pulses / 2 / 60
    # circ_m = 0.09 * 2 * 3.14 = 0.5652
    # mps = 1.18 * circ_m * rotations_per_sec
    # mps = 1.18 * 0.5652 / 2 / 60 = 0,0055578
    filters:
      - multiply: 0.0055578

Direction

The wind direction is made in the sensor by means of magnets (switch reed) that switch resistors. Depending on the final value, the direction is deduced.

An example of the ESPHome configuration:

  - platform: resistance
    sensor: source_sensor
    id: resistance_sensor
    configuration: DOWNSTREAM
    resistor: 10kOhm
    internal: true
    name: Resistance Sensor
    reference_voltage: 3.9V
    accuracy_decimals: 1
    filters:
      - median:
          window_size: 7
          send_every: 4
          send_first_at: 3
    on_value:
      - if:
          condition:
            sensor.in_range:
              id: resistance_sensor
              above: 15000
              below: 15500
          then:
            - text_sensor.template.publish:
                id: wind_dir_card
                state: "N"
            - sensor.template.publish:
                id: wind_heading
                state: 0.0
[...]

Rain

The measurement of precipitation is carried out by a system of pendulum composed of 2 cups, the water runs in the funnel of the sensor and fills the high cup, once the latter is filled, it tips by gravity. This movement is detected by a magnetic sensor (reed switch) and an impulse is generated. The sensor documentation indicates that each pulse corresponds to 0.2794mm of precipitation.

  - platform: pulse_counter
    pin:
      number: GPIO38
      mode: INPUT_PULLUP
    unit_of_measurement: 'mm'
    name: "${friendly_name} rain gauge"
    icon: 'mdi:weather-rainy'
    id: rain_gauge
    internal: true
    count_mode:
      rising_edge: DISABLE
      falling_edge: INCREMENT
    internal_filter: 13us
    update_interval: 60s
    filters:
      # Each 0.011" (0.2794mm) of rain causes one momentary contact closure
      - multiply: 0.2794
    accuracy_decimals: 4

In order to have more relevant information, these measurements are converted into precipitation per minute and the daily total is calculated.

  - platform: integration
    name: "${friendly_name} rainfall per min"
    id: rain_per_min
    time_unit: min
    unit_of_measurement: 'mm'
    icon: 'mdi:weather-rainy'
    sensor: rain_gauge

  - platform: total_daily_energy
    name: "${friendly_name} total daily rain"
    power_id: rain_gauge
    unit_of_measurement: 'mm'
    icon: 'mdi:weather-rainy'
    # x60 To convert to aggregated rain amount
    filters:
      - multiply: 60

Brightness

Remember to position the brightness sensor as high as possible on your weather station so that it is not shaded by the mast or any part of the weather station.

  - platform: tsl2561
    id: lux_meter
    name: "${friendly_name} ambient Light"
    address: 0x39
    update_interval: 5s
    integration_time: 14ms
    gain: 1x

Files

  • weatherstation.yaml: The ESPHome configuration file
  • network.yaml: Your network information
  • secrets.yaml: The secret information about your network.
  • wall_pipe_support.scad: The OpenSCAD file for mat support.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].