Arduino Tutorial: Using the Soil Moisture Sensor along with a Nokia 5110 LCD display

Dear friends welcome back! This is Nick from and today we are going to see how to use the very interesting soil moisture
sensor with an Arduino board. Let’s get started.
I wanted to use this sensor for a long time since I find it quite an interesting one.
The sensor is very cheap, it costs around 2$. You can find a link for the sensor in
the description of the video. The sensor can measure the levels of moisture in the soil.
So it can be extremely useful if you want to monitor the soil moisture of your plants
or automate the watering procedure. Let’s see the project we are going to build today.
I have one cup in front of me with dry soil. If I place the sensor in the cup we can read
a low soil moisture value at the Nokia 5110 display. If I pour some water in the cup you
can clearly see that the moisture levels rise. The project is working fine and we can visually
check the moisture levels of the soil. Of course this is just a demonstration of the
sensor, I am going to build more useful projects in the future with this sensor. Let’s now
see how to build this simple project. The two large exposed pads function as probes
for the sensor. The more water in the soil, the better the conductivity between the pads.
That results in a lower resistance. The sensor is an analog one, so in the analog output
we get a voltage. As the soil gets drier we get more voltage at the analog output since
the resistance between the probes gets higher. We can set a threshold in order to enable
the digital output at a certain moisture level using this potentiometer. But in this video
we are using only the analog output of the sensor module.
The connection to Arduino is extremely easy. We connect GND to Arduino Ground and Vcc to
Arduino 5V. Next we connect the analog output of the sensor to Analog pin 0 of the Arduino
board. Then all we have to do is to connect the Nokia 5110 LCD display. Watch the detailed
tutorial I have prepared on how to connect the Nokia 5110 display to Arduino, it is very
easy. After everything is connected, we power up Arduino, and as you can see after a few
seconds in the display we can see the moisture value of the soil. Now let’s see the code
of the project. I have prepared two sketches for you. The
first one does not use the Nokia 5110 lcd display, it just prints at the serial monitor
the moisture levels from the sensor. The second sketch uses the Nokia 5110 lcd display and
it prints out the value in percent. The code is very simple. We read the analogue value
from the sensor and we convert it to a value from 0 to 100 where 0 is dry soil and 100
is the wet soil. Then all we do is to print that value on the Nokia display. As always
you can find the code of the project in the description of the video.
That’s how easy it is to measure the moisture of the soil using this sensor. It is a very
interesting sensor, and very useful as well. I am going to build many projects around this
sensor in the future so stay tuned! Before we go I would like to show you the
latest Android game I have developed. It is a Quiz Game and it is called Quiz of Knowledge.
It contains thousands of questions divided into 16 categories and it is completely free.
It is now live on Google Play Store and it supports 5 languages, English, Spanish, German,
Greek and Indonesian. If you like quiz games I am sure you will enjoy this. If you wish
to download it you can click here or in a link in the description of the video. Thank
you very much for your support! If this is your first time here, I would love
to have you subscribed. In this channel I post videos about DIY projects every Saturday.
I love making things and I believe that anyone can make things, anyone can become a maker.
That’s why I created this channel, in order to share my knowledge with the community and
learn from the community. I hope you will join us. Until next Saturday, Watch, Learn,

49 thoughts on “Arduino Tutorial: Using the Soil Moisture Sensor along with a Nokia 5110 LCD display

  1. Hi Nick and thanks very much for this video.
    I want to place a sensor in the soil of my plant pot. The plant pot is 10 meters away from my arduino. I can not move my arduino any closer. What do you advise please? Thank you. PJ
    Would you advise to extend the cable between the sensor and the circuit board OR extend the cable between the circuit board and the arduino OR does it matter? Thanx

  2. You develop android apps, that's really nice !
    I just have a question, How do you connect an app with an arduino ? is that possible through a serial connection through OTG ?
    I just want to know the best library I could use for that.
    and Thanks for spending your time to make such awesome videos !

  3. Nice, do you have any idea how long those probes might last in damp soil? I suppose you could always replace them with titanium wire instead.

  4. Hi;
    I'm working at this project for a long time but I couldn't get any fix voltage table in every calibration in the same situation I mean the same soil type, fix water adding and same temperature. so I decided to have just 4 points. How do you do that? and what is your recommendation if I want to make the wireless one?

  5. Thanks for a god video. This is exactly what I needen, had already started to program this, but your way is easier.
    I have also aded a relay and solinoid valve connected to a water bottle so now the vatering of one of my plants is automatic.
    Now to my question: I do not quit understand following line in code: percent = convertToPercent(sensorValue); Please explain

  6. Μπράβο ρε Νίκο, πολύ καλή δουλειά!
    Έχεις ασχολειθεί καθόλου με τα nrf24l01;
    Έχω κάνει ένα εξωτερικό weather station αλλά θέλω να συλλέγω τα δεδομένα σύρματα.
    Θα χαρώ πολύ στα επόμενα βίντεο σου να συμπεριλάβεις και nrf24l01 modules.

  7. Hi ,

    I feel dumb aswell as i am getting frustrated,
    Tried to build the moisture sensor project but i keep getting
    MoistureSensorNokia/MoistureSensorNokia.ino:32: undefined reference to `ui' "
    I think it has to do with the graphics interface lirary, but here in the comments everyone seems to be able to let the thing work.
    Can you explain and teach me how to solve this problem.


  8. Hello. I love all  your videos. this one is awesome. but I will need a relay for my water pump. Can you help me, please?

  9. Hello.Nice project.Am and I tried to do and I successful.What have to change the code to write another text instead of MOISTURE. Am beginner in programming. Thank you.

  10. You have a great video. But I have question, what if I want to display the output value in an smartphone via bluetooth? Do you happen to know how to do that?

  11. As LM393 comparator is used..what is the threshold value with which input is compared ??
    How values are mapped in %??

  12. hello, why it does not show percentage of moisture on Nokia 5110 LCD, only blue light is on without any result. what can I do?

  13. i did everything it isnt working, the sensor has a green led light up when water touches the lcd doesnt function

  14. Hi! There are lots of questions around rust on the sensor, have you done any projects with the Watermark Sensor (or Gypsum Block) – used widely in the agriculture industry?
    There is some more information about it here:

  15. Hi, for converting the values to percentage, why your map function is map(value, 1023, 465, 0, 100) and not map(value, 1023, 0, 0, 100)?

  16. I'm Very new to this and finally got all the parts needed.Once I added the sketch " exit status 1 Error compiling for board Aduino/Genuino Uno." appears when try to verify I'm lost and need help.

  17. Hello Nick
    Well done your tutorial is very good. Do you have any project or code where moisture measurements are collected every hour and are then retrieved? I have a project where I would like to display 12 measurements per day and I don't know the code. If you have some clue for me it would be great.
    Thanks in advance!

  18. hi is there any kind of sensor that helps you determine what kind of nutrients soil have? for my research only im getting hard time finding one ..

  19. great project but the code isn't working. It keeps saying "undefined reference to ""ui"". Can you plz tell me who to define ui, thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *