Introduction: LORA Rain Sensor

In order to make my automated greenhouse I needed some sensors. This rain sensor I will use to decide if sprinklers should be turned on or not.

I will explain this rain sensor in two ways.

  • using the digital port
  • using the analog port

When using the digital pin you can use the potentiometer to regulate when the digital pin will be high.
When using the analog pin you can measure how hard it's raining.

The first one I will use as a very low power rain detector in later projects. This way my LORA sensor only sends a 1 when it's raining.

Step 1: Needed



    Step 2: Making the Antenna

    For the antenna I use some leftover cable of my 2x2x0.8mm or 2x2 20awg bus cable.
    On the things network you can choose your tranceiver and antenna frequency band by country.
    These are the lengths per frequencie:

    • 868mhz 3.25 inches or 8.2 cm (this is the one I use)
    • 915mhz 3 inches or 7.8 cm
    • 433mhz 3 inches or 16.5cm

    Step 3: Soldering the Esp Shield

    • Remove the resistors of the esp shield (see R1 to R3 in the red field)
    • Solder the rfm95 chip onto the esp shield.
    • Solder the pinheaders onto the esp shield
    • Solder the antenna onto the esp shield. Don't use without an antenna you can damage the shield.
    • If the pinheaders aren't soldered onto the arduino solder these too

    Step 4: Coding

    I know I can use the DTR to automatically reset the arduino but in my case I had errors uploading the code. Therefore I also used a manual reset in this instructable so if you have the same problem you can solve it by a manual reset.

    • Wire the arduino to the CP2102 as following:
      • CP2102 txd -> Arduino pro mini rx
      • CP2102 rxd -> Arduino pro mini tx
      • CP2102 gnd -> Arduino pro mini gnd
      • CP2102 3.3 -> Arduino pro mini vcc
    • Open the schetch in the arduino ide
    • Select board arduino pro mini
    • Select atmega 328p 3.3v 8mhz under processor
    • Select your com port
    • Click the upload button
    • While the code is compiling at the moment you see the bautrate (see picture) press the reset button on the arduino pro mini (the cp2102 doesn't reset the board) also be sure to close your serial monitor while programming.

    The lorarainsensoranalog code sends a value from 0-1023 onto the tranceiver. The less the value is the more rain there is. 1023 is no rain.

    The lorarainsensordigital code sends only a value of 0 and 1 onto the trainceiver. 0 means rain and the value of the trimpot is reached 1 means that there is no rain and the value set on the trimpot isn't reached.

    Step 5: Wiring

    • In the first image you see the wiring for when you are using the digital output
    • In the second image you see the wiring for when you are using the analog output
    • In the third picture I zoom in on the wiring of the LORA ship.

    Step 6: Conclusion

    In this instructable you learned how to use a rain sensor in two ways (analog and digital). This sensor will be used in later projects like an automatic greenhouse and an automatic sprinkler system.