Introduction: DIY Soil Moisture Monitor With Arduino and a Nokia 5110 Display

About: I am Nick Koumaris from Sparta, Greece. I'm extremely passionate about electronics, making things and design. I love teaching what I know and sharing my experiences with you. I put out new YouTube videos every…

In this Instructable we are going to see how to build a very useful Soil Moisture Monitor with a big Nokia 5110 LCD display using Arduino. Easily measure the moisture levels of your plant’s soil from your Arduino and build interesting devices with this project!

Building a soil moisture monitor is a great learning experience. When you finish building this project you will have a better understanding of how the soil moisture sensor works, you will know how to wire a Nokia 5110 lcd display and you are going to see in action how powerful the Arduino platform can be. With this project as a base and the experience gained, you will be able to easily build more complex projects in the future.

We can use this project to measure the Soil Moisture of a pot in Real Time and have the Arduino to water the plant automatically when needed! It is a very useful sensor that opens up great project possibilities.

Without any further delay, let's get started!

Step 1: Get All the Parts

The parts needed in order to build this project are these:

1. Soil Moisture Sensor ▶

2. Nokia 5110 LCD ▶

3. Arduino Uno ▶

4. Small Breadboard ▶

5. Wires ▶

The cost of the project is very low, it is about 10$.

Step 2: The Soil Moisture Sensor

The Soil Moisture Sensor is a very interesting sensor. Also, its usage is very simple.

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. So, in order to get the soil moisture of the soil, all we have to do is to read that analog value with a microcontroller, it this case with an Arduino.

We can set a threshold in order to enable the digital output at a certain moisture level using the potentiometer in the small PCB module. But in this Instructable we are using only the analog output of the sensor module.

Step 3: Nokia 5110 LCD Display

The Nokia 5110 is my favorite display for my Arduino Projects.

The Nokia 5110 is a basic graphic LCD screen which was originally intended for as a cell phone screen. It uses the PCD8544 controller which is a low power CMOS LCD controller/driver. Because of this this display has an impressive power consumption. It uses only 0.4mA when it is on but the backlight is disabled. It uses less than 0.06mA when in sleep mode! That's one of the reasons that make this display my favorite. The PCD8544 interfaces to microcontrollers through a serial bus interface. That makes the display very easy to use with Arduino.

You only need to connect 8 wires and use the following library:

This impressive library is developed by Henning Karlsen who has put a huge amount of effort to help the Arduino community move forward with his libraries.

I have prepared a detailed tutorial on how to use the Nokia 5110 LCD display with Arduino. I have attached that video in this Instructable, it will provide many useful information about the display, so I encourage you to watch it carefully.

Now, let's move on!

Step 4: Building the Soil Moisture Monitor

Let's now connect all the parts together.

At first we connect the Soil Moisture sensor module. It only has 4 pins and we are going to connect three of them.

Connecting the Soil Moisture Sensor

Vcc Pin goes to Arduino's 5V

GND pin goes ton Arduino's GND

A0 pin goes to Arduino's A0 pin

The next step is to connect the Nokia 5110 LCD display.

Connecting the Nokia 5110 LCD Display

RST goes to Digital Pin 12 of the Arduino

CE goes to Digital Pin 11 of the Arduino

DC goes to Digital Pin 10 of the Arduino

DIN goes to Digital Pin 9 of the Arduino

CLK goes to Digital Pin 8 of the Arduino

VCC goes to Arduino 3.3V

LIGHT goes to Arduino GND (backlight on)

GND goes to Arduino GND

Now that we have connected all the parts together, all we have to do is to load the code. Now we can start measuring the moisture of the soil in Real Time!

Step 5: The Code of the Project

The code of the project consists of 2 files.

1. ui.c

2. MoistureSensorNokia.ino

ui.c Code - The User Interface

In the file ui.c, there are the binary values of user interface that appears after the the project boots up. Please watch the attached video I have prepared in order to see how to load your custom graphics to your Arduino Project.

MoistureSensorNokia.ino Code - Main Program

The main code of the project is very simple. We need to include the Nokia 5110 library. Next we declare some variables. We initialize the display and we print the ui icon once. Then we read the analog value from the sensor second. All the magic happens in the loop function:

<p>void loop() {<br>  </p><p>lcd.clrScr();
lcd.drawBitmap(0, 0, ui, 84, 48);
</p><p>sensorValue = analogRead(sensorPin);  <strong>//We read the sensor here</strong>
</p><p>percent = convertToPercent(sensorValue);
percentString = String(percent);
stringLength = percentString.length();

In the loop function we first clear the display and we print the UI icon. We then read the sensor value. After this, we covert the analog value we read in percentage value, and this value we convert it into a String variable in order to display it on the screen. This procedure is repeated every second.

I have attached the code to this Instructable. In order to download the latest version of the code you can visit the project's webpage:

Step 6: Testing the Project

Now that the code is loaded we can test the Soil Moisture Monitor and see the moisture levels of the soil in real time on the Nokia 5110 LCD display.

As you can see in the attached photos, the Soil Moisture Monitor works fine!

I placed a cup in front of me with dry soil. When I placed the sensor in the cup we read a low soil moisture value at the Nokia 5110 display. When I poured some water in the cup you can clearly see that the moisture levels rose.

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.

As you can see, this project is a great demonstration of what open source hardware and software is capable of. Within a few minutes one can build such an impressive project! This project is ideal for beginners and as I said in the beginning, this project is a great learning experience. I would love to hear your opinion on this project. Do you find it useful? Are there any improvements that can be implemented to this project? Please post your comments or ideas in the comments section below!

Circuits Contest 2016

Participated in the
Circuits Contest 2016