Page 1 of 1

Capacitive Rain Sensor

Posted: 15 Mar 2019, 23:50
by Shardan
The usual cheap rain sensors from AliExpress and other platforms have some disadvantages.

They work by conductance so the electrodes must have direct contact to the water.
Dirt and aging can influece this, the water conductance may differ depending on
what a raindrop collected on it's way through the air.

Worse, these sensors mostly use DC. Over time the sensor gets corroded by electrolysis.

This design uses a capacitive sensor. It is covered by solder resist, on top I sprayed a thin
urethane film for better environment resistance.
RainSensor_Cpl.jpg (382.92 KiB) Viewed 1699 times
The complete sensor fits into a box of 83x58x33mm soit's about half size compared to usual sensors.
RainSensor_Open.jpg (713.45 KiB) Viewed 1699 times
The sensor itself is built around an ATtiny 2313 CPU as it needs more speed then ESP8266 and ESPEasy can deliver.
It measures the capacitance of the sensor by measuring the loading time of the sensors capacitance.
Capacitance varies due to the dielectric constant of the isolation. The sensor board itself has a
dielectric constant of around 4, pure water is around 80 so water on the sensor makes the
capacitance bigger, it takes longer do load it. This difference is measured.

The ATTiny gives three signals for "a bit", "rainy" and "really wet".
The signals are connected to switch inputs of the ESP-07S, LEDs on the PCB show the signal states.
Internally the ATTiny uses a "Meridian" calculation to keep the measurement stable.
Threshholds can be changed in the source of ATTiny firmware.
On top there is a DS18B20 in the box. As it gets warm in the box it is not suitable to
gather environment temperature. It is used to switch the sensor heating on if temperature
gets under a certain level to avoid water freezing on the sensor or snow settling on the surface.
The sensor is heated if it gets wet or temperature is low.

If anyone wants firmware and/or PCBs message me.
(PCB's, ATTiny firmware and schematic designed by me)

Re: Capacitive Rain Sensor

Posted: 15 Mar 2019, 23:52
by grovkillen
Awesome! Let's start sell them! 8-)

Re: Capacitive Rain Sensor

Posted: 16 Mar 2019, 00:07
by Shardan
I still want to make some changes to the firmware.
It works nice, the ESP does the heating control well...
But the setting of threshhold values by recompiling and flashing firmware isn't to my likings.

It should be possible to read the values from serial and store them into the EEprom area of the chip.
The usual progger for the ESP and a terminal program should do.
The serial interface is already implemented, I use it for calibrating, it sends the actual timecounter value.
The serial receiving part still has to be done.
If ESPEasy gets a real serial for controlling some day, setting of these values should be possible
even via ESPEasy. Just read the value from the ATTiny and set threshhold values accordingly, that would be perfect.

But when setting thershholds via serial is done selling is possible I think.

Re: Capacitive Rain Sensor

Posted: 22 Jun 2019, 11:06
by SzuR
Great project can you please send me pcb's and sketch?
My email is

Re: Capacitive Rain Sensor

Posted: 22 Jun 2019, 12:00
by Shardan
SzuR wrote:
22 Jun 2019, 11:06
Great project can you please send me pcb's and sketch?
My email is
I can't send a sketch, as it is not based on the Arduino IDE.
All PCB's can be obtained from me, later maybe from Grovkillen's shop.

Re: Capacitive Rain Sensor

Posted: 02 Dec 2019, 08:33
by Maxime28
Just discover a rain sensor created with a normal rain sensor and a smart home water sensor on Not sure it would be a good model or not cause it's just a 3d printing share. :D

Re: Capacitive Rain Sensor

Posted: 02 Dec 2019, 08:38
by TD-er
It is a nice idea.
Only thing I see which strikes me as odd, is that it has the "cover" over the edge of the sensor at the bottom.
This will keep some water in it and that will break during winter.

ShardanX sent me such a sensor which is basically a PCB with solder mask covering the entire "collecting" surface of the PCB.
So far it is working just great.