I wanted to get a rain sensor so that I could check what happen in my remote garden. With Google I saw only few printed circuit with some electronic around. Looks simple enough, so why not doing it myself out of scraps from my workbench. And as it seems that nobody else has done this thing before, let's publish it.
Step 1: The Sensor
The sensor itself is a (badly soldered) set of 2 rakes with parallel fingers (See picture and drawing).
I connected to it an unused telephone line then I'll be able to place the sensor far from the electronic: one has to get wet while the other one has to stay dry.
Step 2: The Electronic
I am no good with electronic (and soldering). But after a few trial and error, I came with this schematic. The two wires coming from the sensor are soldered on a small board. One wire will be the signal going to the Arduino ADC. It is maintained at 5V by a 10Kohms pull up resistor. The second wire is connected to the ground via a 100Ohm resistor (see schematic). When moist or water connected the two rakes the gap become a resistance and we have a voltage divider. I said moist or water because the sensor does not act as a switch but rather as a resistor varying from open circuit to resistance to close circuit depending on the quantity of water (droplets, mist, larges drops). If I don't put the 100Ohms but instead a direct connection to ground, I see 5V on the ADC when the sensor is shortened.
You can see two 3 pins connectors. There are wired the same. It is just more convenient when using jumper cables to have the choice between a male or female connection. Wish they would do it for all pre-wired sensors : one sets up everything with a shield and when it come to redo the final wiring without it one has to change all cables.
Step 3: Testing
As no DIY is complete without some LED. I have added a yellow one in parallel with the 10KOhms. The more humidity the brightest shine the led. I tested it with my wet finger, then a slightly wet sponge, the drop of water from the same sponge and finally a short circuit (a screw driver). This test can be done without the software, just connect 5V and ground
The connections to the Arduino are with 3 wires, the signal from the 10KOhms to an analog pin (A4), +5V to the other side of the said resistor, and the ground to the 100Oms resistor.
For the fun I added the display with some animation when it rains. The value displayed is the output of the ADC : 1023 when open circuit and down with the humidity.
The way the sensor is built any drop of water will stay there for a while. The sensor will take a few minute to dry.
Step 4: the Sketch
Here is the sketch to read the sensor and then some display and serial print. I tried some animation on the display just to see if it' possible (not very pretty). As one can see on the picture the wiring of the display is also somewhat a dirty job. But I managed to salvage a grey ribbon from an old PC Joystick (16 pins), cut 2 pins and now I have a display which I can plug quickly on a UNO shield, or slowly with jumper cables.
Step 5: Conclusion
This sensor is part of a bigger project : the arduino is connected to a Raspberry Pi with I2c. The Raspberry log the value of the sensors, turn the camera a few degrees and send info and pictures periodically to the cloud and a private web side. I want to check how my garden is doing when I am not there and " send back" some water when it's very dry. The picture above (taken from another place) is just an illustration of the current stage of the project.