Arduino Hygrometer or humidity sensor

Recently I’ve acquired a hygrometer – humidy – sensor for a project I’m working on . I’ve bought it from .

To really know when to water the garden, tests needed to be made.

I’ve started with 3 cups fill with dirt – all equal with the same type of soil – from the garden I’m going to water


Next, I pored water in two of them – one half of water and the other until water is above the dirt

Test cups


Connecting the sensor



The hygrometer itself only has 2 pins to connect to another sensor. The next sensor has 4 PINS – Vcc, GND, D0 (digital) and A0 (analog).

I’ve connected GND, VCC and Analog. Analog will give more exact values and digital.

After connecting the sensor, I start reading the values.

When the hygrometer is not inserted in any cup, the values returned are 1023 – this is the max value.

Dry soil


With the sensor inserted in the dry soil cup, the sensor returned values around 968. That will my control value – dry soil will return values around 968.

Soil with some water


After pouring water in the cup – not getting wet – I get values around 344 – This is the target value after watering the garden.

Wet soil


This is the worst case scenario – probably after it rains – never let the watering system to reach this state. Like this, the sensor ┬áreturns values around 270 !

After analyzing these results, I’m targeting for values between 500 and 300 !

Arduino sketch

More information about Constrain and Map in the Arduino playgound .


3 Replies to “Arduino Hygrometer or humidity sensor

    1. Hello !

      They are set like that because of the tests I’ve made with the type of soil I have… I was calibrating my sensor so I could know when it was dry, 50% wetter or was really really wet. I explain that in the post.

      Your values could be different. Just test the sensor with different soil with different water content in it and see !

  1. Hi feiticeir0 !
    Very good statement. After I read your article about the soil moisture sensor, i was finally able to build my one automatic water solution.
    Does the interface always put power on the sensor, when its on ?
    If it is so, the sensor wont last long, because of the electrolyze of the wet soil.

    Nice project anyway !
    Greeting, Dom from

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.