## Introduction: Alternative Weather Station

Another weather station, yes, but of a different kind!

I have already published, see a previous article, a probe that measures air quality.

The station described here includes additions and modifications.

• Measuring temperature, humidity and atmospheric pressure (module BME280).
• Measuring the amount of rain.

Changes from the previous project:

• Measurement of the battery voltage.
• Compact housing that encompasses all elements.
• Changes in the electronic diagram.

Reminder of the objectives:

• Minimize power consumption.
• Minimize the Wifi connection. (30s every 30 minutes).
• Sealed environment.
• Automatic battery charging.

The real peculiarity lies in the probe which measures the amount of rain. It is based on a capacitive measurement.

## Step 1: Principle of Capacitive Level Measurement

The principle of capacitive level measurement is based on the variation in capacitance of a capacitor.
The assembly is composed of a metal tube and an insulated metal rod placed in the center of the tube.

The rod and the wall of the tube form a capacitor, whose capacitance depends on the amount of water in the tube: The vacuum tube has a lower capacity and with water capacity will increase.

An electronic device measures the increase in capacity and generates a voltage proportional to the water level.

Rq: The rod being isolated no current crosses the water.

Evaluation of variables involved.

The receiving surface of the funnel is approximately 28 cm2 (4.3 sq in). That of the tube is about 9 cm2 (1.4 sq in). The area ratio is about 3. So a centimeter of water on the funnel will fill the tube with 3cm This multiplication provides better accuracy. In the case of our mounting the measured capacitance is about 100pF.

Calibration:

Once the assembly is complete, we will proceed to the calibration with a measuring glass. We will proceed cm by cm at the level of the funnel. We will adjust R8 and R13 to calibrate the minimum and maximum value. (see following diagram)

## Step 2: Diagram of Mounting the Analog Water Level Indicator

This pattern is inspired by the Site http://njhurst.com/electronics/watersensor/

The monostable is a 555. The pulse width of the 555 is proportional to the level of the water. R7 and C5 form a low-pass filter to smooth the DC value of the pulse train.

The voltage offset at the output of 555 is eliminated in the differential stage formed by a quad amplifier LM324.

The station being powered by 5V a voltage converter was added to produce 12V. This is to ensure optimal operation of the level indicator. The output voltage is adjusted to provide a maximum of 3.7V at the input of the control board.

## Step 3: Diagram of the Steering Equipment

The device is controlled by an ESP8266 Wemos D1 mini controller.

Supports battery and water levels:

The A0 input supports up to 3.3V. It is used alternately to measure voltages.

For the battery by activating the GPIO2 Port (D4).

For the water level by activating the GPIO14 Port (D5). Activation of this port energizes the capacitive measuring stage. This is to limit the power consumption.

Measuring the air quality is done by energizing the module by the SDS011 GPIO15 (D8). The GPIO12 entry (D6) reads the serial data. At the same time the BME280 module is energized. Communication is by GPIO4 and GPIO5 (D1, D2) in order to recover the temperature, humidity and atmospheric pressure.

Finally the solenoid valve that will drain the pipe at the end of the day is activated by GPIO13 (D7).

The controller is programmed with EspEasy by the following code.

## Step 4: ESPEASY Rule

on System#Boot do
gpio,15,1

gpio,13,1

gpio,2,0

gpio,14,1

timerSet,1,20

let,1,0

endon

On System#Wake do

gpio,15,1

gpio,13,1

gpio,2,0

gpio,14,1

timerSet,1,20

let,1,0

endon

on Wifi#Disconnected do

if [VAR#2]=0

let,2,1

let,3,180

endif

endon

on Wifi#Connected do

// notify 1,system_is_started

let,2,0

let,3,1800

endon

On SDS011#PM10 do

SendToHTTP 192.168.1.231,8082,/json.htm?type=command¶m=udevice&idx=63&nvalue=0&svalue=[SDS011#PM10]

SendToHTTP 192.168.1.231,8082,/json.htm?type=command¶m=udevice&idx=62&nvalue=0&svalue=[SDS011#PM25]

endon

On Rules#Timer=1 do // Battery level

let,1,[TENS#A0]

let,1,[VAR#1]*0.004

SendToHTTP 192.168.1.231,8082,/json.htm?type=command¶m=udevice&idx=60&nvalue=0&svalue=%v1%

gpio,2,1 // switch off battery voltage capture

gpio,14,0 // switch on water level capture

timerSet,2,10

endon

On Rules#Timer=2 do // water level

let,1,[TENS#A0]

let,1,[VAR#1]-60

if %v1%<0

let,1,0

else

let,1,[VAR#1]*0.0625

endif

SendToHTTP 192.168.1.231,8082,/json.htm?type=command¶m=udevice&idx=68&nvalue=0&svalue=%v1%

gpio,14,1 // switch off water level capture

timerSet,3,5

endon

On Rules#Timer=3 do // purge water

if %syshour%=23 // 23h

if %sysmin%>=30 // >30mn

notify 1,ecoulement

gpio,15,0 // switch off SDS

gpio,13,0 // switch on drain valve

timerSet,4,240

else

timerSet,4,5

endif

else

timerSet,4,5

endif

endon

On Rules#Timer=4 do // its time to sleep

gpio,13,1 // switch off drain valve

deepsleep,%v3%

endon

## Step 5: Component Arrangement in a PVC Tube

The capacitive probe, even if it is not complex, deserves attention because its finish and its adjustment will have to be treated.

Control boards and the SDS011 probe are mounted on a support in order to facilitate their introduction in the PVC tube.

Conclusion:

This assembly, like the previous one, does not represent any particular difficulty for people with knowledge of Domoticz and ESPEasy software.

It can effectively measure

• The presence of fine particles,
• Atmospheric pressure,
• The humidity level,
• Temperature,
• The rain height,

And this close to your home.

The project also comes up with technical ideas:

Power control by reed relay, PNP or MOSFET transistor. The use of GPIO2 and GPIO15. The use of port A0 by multiplexing. Programming (Rule) of the ESP8266 controller.

Project also published on https://dangasdiy.top/ (multilingual)