ESP32 powered weatherstation with MQTT and WebGUI

Hello,
I'm currently toying with the idea of building a weather station. I am aware that there are already many projects of this kind on the net, but most of them contain only one or two sensor values or are very specifically linked to a product. At least what I have seen so far.
On the German page of "ELEKTOR-Magazin" I have seen a similar project, but it involves an external provider and seems to be quite complicated:

What I'd like to do is this:

  • Central unit an ESP32 or ESP8266
  • WebGUI for reading the measured values and for the setup (Wifi network, MQTT settings, etc.)
  • As sensor for temperature, humidity and pressure the BME280
  • Sensors for rain quantity, wind speed and wind direction
  • Fine dust pollution SDS011
  • Brightness sensor TSL45315
  • possibly a humidity sensor so that rain is also detected correctly with the first drop
  • All data as said once in the WebGUI and as MQTT for the Smart Home
  • Code should be modular, so that it can be easily extended

The code from "ELEKTOR-Magazin" in its current form still contains a monitoring and charging regulation for a battery. In my opinion, however, this has not been properly thought through.
For example, I think it would be better to use a cheap MPPT solar charge controller directly and just let the ESP32 monitor the battery voltage.

I think that sounds great at first and shouldn't be too difficult. For most of the sensors I have listed, there are suitable libraries and for sensors like rainfall, wind speed and direction you only need to read and calculate an analog value or count and calculate triggered reed contacts.

For better understanding, here is the explanation from the "ELEKTOR-Magazine":

Rain and wind sensors
The rain sensor consists of a small tray that fills with rainwater. When it is full, it tips and briefly closes a reed switch contact that is monitored by the ESP32. According to the datasheet, each tip of the tray corresponds to 0.33 mm of precipitation.
The wind sensor consists of a wind vane for measuring the wind direction and an anemometer for measuring the wind speed. The internal resistance of the wind vane changes depending on the wind direction.
We combined a 10 kΩ resistor (R2) with this wind direction dependent resistance to form a voltage divider. The resulting voltage changes when the wind vane sensor resistance changes, and it can be measured by the ESP32.
The anemometer has a reed switch that generates two pulses for each rotation. According to the data sheet, the wind speed in m/s is equal to the pulse frequency (in Hz) multiplied by 0.33. For determination of the rotation frequency, the data sheet says that the time interval between two pulses (in seconds) should be multiplied by 2 (since the sensor generates two pules per rotation), and then the rotation frequency can be calculated as the inverse of this time interval. If you multiply that value by 0.66, you get the wind speed in meters per second. The wind speed in km/h can be calculated by multiplying the speed in m/s by 3.6. In other words, 1 rps corresponds to a wind speed of 2.4 km/h.

Okay, so what's the problem? Simple, my very rudimentary experience with Arduino and writing programs and code is not enough.

First I thought I would take the code from "ELEKTOR-Magazin" and change it a little bit to get what I want... At least that's how it worked for my projects so far. Unfortunately, the mentioned code is clearly too complicated for me and I would never be able to get something like that to work.

Maybe there is someone here who would support me? Hardware I already have almost everything, only the code is missing... :slight_smile:

Thanks a lot

Greeting
Joe

Unless you are making a commercial product for sale there is no need for a web/GUI interface to set the Wifi network and MQTT settings. These things can be set in your code as they are unlikely to ever change, and if they do then you can just upload a new version of the program.

As you are planning to use MQTT for you data output, it would make sense for also use it for inbound communication. There are plenty of user friendly apps on Window/Mac/Android that you can use for sending/receiving/displaying MQTT data. No programming required, just a configuration step.

I agree. Basically no WebGUI is necessary. However, I am a friend of redundant solutions. So I would have several possibilities.

But anyway, I think this is just "Nice to have"!

What do you mean by "inbound communication"? I know that there is already a lot of software in the MQTT area. But I still need the Arduino code for the ESP32 and the actual weather station.

Can you help me with that?

Thanks a lot

Greeting

BOSSJoe

Post your requirements to the "Gigs and Collaborations" section of this forum.