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

——————–
WHERE TO BUY PARTS
——————–

1. Soil Moisture Sensor: http://bit.ly/SoilMoistureSensor

2. Cheap Arduino Uno: http://bit.ly/Cheap_Uno

3. Nokia 5110 LCD: http://bit.ly/NOKIA5110

4. Small Breadboard: http://bit.ly/SmallBreadboard

5. Jumper wires: http://bit.ly/JumperWiresB

6. Wires: http://bit.ly/WiresArduino

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

 

 

——————–
SUBSCRIBE ON YOUTUBE
——————–

Never miss a video: Subscribe to educ8s.tv

2017-03-31T12:18:04+00:00

3 Comments

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

    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
    #include

    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

    Adafruit_TFTLCD tft(LCD_CS, LCD_CD, LCD_WR, LCD_RD, LCD_RESET);

    // — Setup

    void setup(void) {

    Serial.begin(9600);

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

    }

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

    unsigned long testText() {
    tft.setRotation(0);
    tft.fillScreen(CYAN);
    tft.setTextColor(BLACK);
    tft.setTextSize(3);
    tft.setCursor(0, 10);
    delay(1000);

    }

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

    void printValuesToSerial()
    {
    tft.print("\n\nMoisture: ");
    tft.print(sensorValue);
    tft.print("\nPercent: ");
    tft.print(percent);
    tft.print("%");
    }

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

    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?

  3. April Libiano August 24, 2017 at 4:37 pm

    error in compiling. can somebody help me? thanks. my Nokia 5110 isn’t working.

Comments are closed.

Close