Arduino Soil Moisture Sensor along with a Nokia 5110 LCD

Home/Arduino Projects, Robot Projects/Arduino Soil Moisture Sensor along with a Nokia 5110 LCD

Arduino Soil Moisture Sensor along with a Nokia 5110 LCD

Arduino Soil Moisture Sensor along with a Nokia 5110 LCD display

Using the Arduino soil moisture sensor with an Arduino can’t be easier. Adding a Nokia 5110 LCD display makes things more professional since we can visually check the moisture levels of the soil.

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$.


1. Soil Moisture Sensor:

2. Cheap Arduino Uno:

3. Nokia 5110 LCD:

4. Small Breadboard:

5. Jumper wires:

6. Wires:

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.

Download the code




Never miss a video: Subscribe to



  1. vandenbrande January 25, 2016 at 12:52 pm - Reply

    Hey nice tutorial, I need some help with a TFT lcd I got the Values and stuff right.
    But somehow it overlaps my text. my code is below.

    #include // Graphics library
    #include // Hardware library

    int soil_sensor = A5;
    int sensorValue = 0;
    int percent = 0;

    #define LCD_CS A3
    #define LCD_CD A2
    #define LCD_WR A1
    #define LCD_RD A0

    #define LCD_RESET A4

    #define BLACK 0x0000
    #define BLUE 0x001F
    #define RED 0xF800
    #define GREEN 0x07E0
    #define CYAN 0x07FF
    #define MAGENTA 0xF81F
    #define YELLOW 0xFFE0
    #define WHITE 0xFFFF


    // — Setup

    void setup(void) {


    tft.begin(0x9341); // SDFP5408
    tft.setRotation(0); // Need for the Mega, please changed for your choice or rotation initial
    Serial.println (percent);


    void loop(void) {
    sensorValue = analogRead (soil_sensor);
    percent = convertToPercent(sensorValue);
    tft.setCursor(0, 10);
    for(uint8_t rotation=0; rotation<1; rotation++) {

    unsigned long testText() {
    tft.setCursor(0, 10);


    int convertToPercent(int value)
    int percentValue = 0;
    percentValue = map(value, 1023, 465, 0, 100);
    return percentValue;

    void printValuesToSerial()
    tft.print("\n\nMoisture: ");
    tft.print("\nPercent: ");

  2. Bengt Sjölin January 12, 2017 at 8:59 pm - Reply

    I have built this together with an automatic watering system, However I get very short lifetime on the soil sensor, after about two weeks the sensor is “rusted” away and I get strange values. Am I doing something wrong here?

Leave A Comment