Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

ESPHome version of Elektor weather station v2

License

NotificationsYou must be signed in to change notification settings

hugokernel/esphome-weather-station

Repository files navigation

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 entitledRemake 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 firmwareGitHub - 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 kindpermission 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 anindependent 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

Electronics

The Elektor electronic board is to be used as is or, in view of its simplicity, to be reproduced on a test board.

The Elektor publication is wrong, in fact, they use GPIO 34 (wind speed) and 38 (precipitation measurement) directly without a pullup resistor,Moreover, these inputs / outputs do not integrate a pull-up resistor,so it is necessary to add a pullup resistor (~10kOhms) on GPIO34 and GPIO38.

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 OpenSCADone 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, aMAX8212 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 a30W solar panel and arelatively 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, theINA219 circuit allows the power generated by the solar panel to be measured. I plan to replace it withINA3221 in order to also measure the total consumption of the weather station and help me to refine the global consumption (a RFLink withOpenMQTTGateway 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 theBatteryStuff 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:bme280address:0x76update_interval:60siir_filter:16xtemperature:name:"${friendly_name} temperature"oversampling:16xhumidity:name:"${friendly_name} humidity"oversampling:16xpressure: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:am2320setup_priority:-100temperature:id:am2320_temperaturename:"${friendly_name} AM2320 temperature"humidity:id:am2320_humidityname:"${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:templatename:"${friendly_name} temperature"icon:"mdi:thermometer"unit_of_measurement:"°C"lambda:|-      return (        id(bme280_temperature).state        +        id(am2320_temperature).state      ) / 2;  -platform:templatename:"${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 and the ESPHomepulse_meter platform is now used to perform the measurement.

You need to add a pulling resistor on the GPIO34 (there is no internal pullup on this GPIO).

Speed calculation
  1. First, check the number of pulses by revolution ($number_of_pulses_by_revolution)
  2. Then, we need the circumference of the anemomenter, to do that, measure the radius of the anemomenter in meter.
    In the example below, the radius is 9cm.
circumference_in_meter = $radius * 2 * πcircumference_in_meter = 0.09 * 2 * 3.14circumference_in_meter = 0.565486678
  1. Now, we can found the number of rotations per seconds by counting the number of pulses for one rotation
    rotations_per_sec = pulses / $number_of_pulses_by_revolution / 60
  2. Next, we multiply circumference and rotation par second to have the wind speed.
    Note: 1.18 is a calibration factor to compensate the friction (you can adjust it).
meter_per_second = 1.18 * circumference_in_meter * $rotations_per_secmeter_per_second = 1.18 * circumference_in_meter * 1 / $number_of_pulses_by_revolution / 60meter_per_second = 1.18 * 0.565486678 / 2 / 60meter_per_second = 0.005560619

Initial formula frommkuoppa/esphomeweatherstation#2 (comment)

For more information about calculation, see#6

  -platform:pulse_meterpin:number:GPIO34mode:INPUTid:wind_speedunit_of_measurement:'m/s'name:"${friendly_name} wind speed"icon:'mdi:weather-windy'internal_filter:13ustimeout:5sfilters:      -multiply:0.005560619      -sliding_window_moving_average:window_size:5send_every:5

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:resistancesensor:source_sensorid:resistance_sensorconfiguration:DOWNSTREAMresistor:10kOhminternal:truename:Resistance Sensorreference_voltage:3.9Vaccuracy_decimals:1filters:      -median:window_size:7send_every:4send_first_at:3on_value:      -if:condition:sensor.in_range:id:resistance_sensorabove:15000below:15500then:            -text_sensor.template.publish:id:wind_dir_cardstate:"N"            -sensor.template.publish:id:wind_headingstate: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_counterpin:# Don't forget to add a pulling resistor, see READMEnumber:GPIO38mode:INPUTunit_of_measurement:'mm'name:"${friendly_name} rain gauge"icon:'mdi:weather-rainy'id:rain_gaugeinternal:truecount_mode:rising_edge:DISABLEfalling_edge:INCREMENTinternal_filter:13usupdate_interval:60sfilters:# Each 0.011" (0.2794mm) of rain causes one momentary contact closure      -multiply:0.2794accuracy_decimals:4

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

  -platform:integrationname:"${friendly_name} rainfall per min"id:rain_per_mintime_unit:minunit_of_measurement:'mm'icon:'mdi:weather-rainy'sensor:rain_gauge  -platform:total_daily_energyname:"${friendly_name} total daily rain"power_id:rain_gaugeunit_of_measurement:'mm'icon:'mdi:weather-rainy'# x60 To convert to aggregated rain amountfilters:      -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:tsl2561id:lux_metername:"${friendly_name} ambient Light"address:0x39update_interval:5sintegration_time:14msgain:1x

Files


[8]ページ先頭

©2009-2025 Movatter.jp