Arduino Projects

NRF24L01 Arduino Based Soil Moisture Monitoring System with Feedback

NRF24L01 Arduino:

 

NRF24L01 Arduino Based Soil Moisture Monitoring System with Feedback– In this article, you will learn how to make a Wireless Soil Moisture Monitoring System for Plants using NRF24L01 transceiver modules, a pair of Arduino boards, a DC water pump, 1-channel relay module, a switch, SSD1306 Oled display Module, DS18B20 waterproof temperature sensor, and the soil moisture Sensor.

 

allpcb circuit

 

nrf24L01 Arduino

If you don’t have this particular type of the soil moisture sensor, no worries at all, you can use any other type of soil moisture sensor, you are not bound to use only the resistive type soil moisture sensors, you can also use the capacitive type soil moisture sensors. The reason I am using this soil moisture sensor is; because the sensor probes are long, waterproofed, and are made of highly corrosion-resistant material to ensure a long lifetime up to 6 months after being plugged into the soil. Due its long sensor probes, it digs deeper into the Soil.




Ever since I got Long Range LoRa transceiver modules, since then I didn’t use these NRF24L01 transceiver modules. There were times when I was using NRF24L01 radio modules in all of my wireless projects. Links to all the related NRF24L01 based projects are given at the end of this article.

nrf24L01 Arduino

The Soil Moisture Monitoring System which I am going to make, can be built using the Long Range LoRa transceiver modules and can also be built using the NRF24L01 transceiver modules. If the distance between the Transmitter and Receiver is over 800 meters then go far LoRa transceiver modules. And if the distance is between 100 meters and 800 meters then you can use the PA + LNA versions of the NRF24L01, and if the distance is less than 100 meters then you can use these low-cost NRF24L01 modules.

Since in my house, the maximum distance between the transmitter and receiver can be up to 40 meters so that’s why I selected these low-cost short range NRF24L01 Transceiver modules.

nrf24L01 Arduino

This is the transmitter’s side, along which a soil moisture sensor, NRF24L01 Transceiver module, a 1-channel relay module, DS18B20 temperature sensor, and a 220 Vac light bulb, are connected. I am using a bulb instead of a water pump so that at the time of carrying out a practical demonstration, you can clearly see for yourself how I turn this bulb ON or OFF. You can also use a 220 Vac water pump and you can also use a DC water pump; it all depends on your choice. If you have to control a large water pump, then you better use a power relay. I have written a separate article on IoT Power Relay, in which I have practically demonstrated how to control a large water pump. The DS18B20 temperature sensor is optional, if you do not want to measure the temperature then there is no need to connect the temperature sensor. The reason I am using it, is to explain that we can send multiple sensor values.

nrf24L01 Arduino

And this is the receiver’s side. It has been connected with a button, an Oled display module, and NRF24L01 transceiver module. Now I am going to explain it’s working a bit, and then we will kick off our practical demonstration.

The transmitter will send values related to the soil moisture, temperature, and motor status, which will show on the Oled display module fitted on the receiver’s side. The Button on the receiver side is used to control the water pump. When the control signal is sent, the receiver side turns ON or turns OFF the Motor and at the same time, the transmitter also sends a feedback message whether the motor is turned ON or Not. So, it’s a two-way communication system. Now, let us go ahead and start our practical demonstration.



nrf24L01 Arduino

I have powered up the transmitter as well as the receiver’s side. You can see soil moisture, temperature, and motor status on the Oled display module. Now, if I press the button, the light will turn ON, which will indicate that the motor has turned ON and at the same time I also receive a feedback that the motor has powered ON. You can see the motor status has changed from 0 to 1 on the display.

nrf24L01 Arduino

Now, I am going to add some water and you will see an increase in the soil moisture value.

nrf24L01 Arduino

Let’s say, this soil moisture value is enough, so now I can press the button and turn OFF the water pump wirelessly.

nrf24L01 Arduino

It is so simple, isn’t it?   All we need is to read the soil moisture value on the display and then accordingly control the water pump on the remote side. It can also be used as a wireless soil moisture meter; this way you can move around and measure the soil moisture of different plants while the supervisor in the control room keeps an eye on the soil moisture values. I am sure by now, you might have got an idea of how does this system work. So, without any further delay let’s get started!!!



Amazon Links:

Arduino Nano USB-C Type (Recommended)

SSD1306 Oled display Module

One-channel relay module

Soil Moisture Sensor

DS18b20 Temperature sensor

NRF24L01 from Amazon

NRF24L01 from SunFounder

*Disclosure: These are affiliate links. As an Amazon Associate I earn from qualifying purchases.

Soil moisture Sensor:

This soil moisture sensor provides data in both digital and analog form. The two probes on the sensor act as variable resistors. Use it in a home automated watering system, hook it up to IoT, or just use it to find out when your plant needs water.

nrf24L01 Arduino

The soil moisture sensor consists of two probes which are used to measure the volumetric content of water. The two probes allow the current to pass through the soil and then it gets the resistance value to measure the moisture value.

When there is more water, the soil will conduct more electricity which means that there will be less resistance. Therefore, the moisture level will be higher. Dry soil conducts electricity poorly, So when there will be less water, then the soil will conduct less electricity which means that there will be more resistance. Therefore, the moisture level will be lower.

Wiring Connection

VCC: 3.3V-5V
GND: GND
DO: Digital output interface (0 and 1)
AO: Analog output interface

Features:

  1. Dual output mode, analog output more accurate
  2. A fixed bolt hole for easy installation
  3. With power indicator (red) and digital switching output indicator (green)
  4. Having LM393 comparator chip, stable.



DS18B20 Temperature sensor:

One-wire temperature sensors like the DS18B20 are devices that can measure temperature with a minimal amount of hardware and wiring.  These sensors use a digital protocol to send accurate temperature readings directly to your development board without the need for an analog to digital converter or other extra hardware. You can get one-wire sensors in different form factors like waterproof and high-temperature probes–these are perfect for sensing temperature in many different projects and applications.  And since these sensors use the one-wire protocol you can even have multiple of them connected to the same pin and read all their temperature values independently.

nrf24L01 Arduino

The DS18B20 Waterproof Temperature Sensor has three wires

  • The red wire is the VCC wire: the operating voltage is 3 to 5 volts.
  • Yellow Wire is the Data wire: we usually connect a resistor between the data wire and VCC wire.
  • The black wire is the Ground wire.

This temperature sensor is capable of measuring the temperature ranging from -55°C to 125°C




NRF24L01 Arduino Transmitter Circuit:

nrf24L01 Arduino

This is the transmitter circuit diagram. The VCC and GND pins of the NRF24L01 are connected with the 3.3v and GND pins of the Arduino. Don’t forget to add a 10uF capacitor between the VCC and GND pins of the NRF24L01 module. The CE, SCN, SCK, MOSI, and MISO pins of the NRF24 module are connected with the Arduino pins 9, 10, 13, 11, and 12 respectively.

The VCC and GND pins of the DS18B20 are also connected with the 3.3V and GND pins of the Arduino. While the data pin is connected with D2 pin of the Arduino. There is also a 330 ohm resistor connected between the data wire and VCC.

The analog output pin of the Soil Moisture interface board is connected with the A0 pin of the Arduino, while the VCC and GND pins of the interface circuit are connected with the 5V and GND pins of the Arduino.

The one-channel relay module is controlled using the Arduino pin D3.

I am using a separate 12V power supply for the DC water pump. The ground wire is directly connected with the GND wire of the DC water pump. While the 12V wire is connected with the Water pump through the relay. So, by turning ON and turning OFF this relay we can turn ON and turn of the water pump. Now, let’s take a look at the receiver’s side circuit diagram.

NRF24L01 Arduino Receiver Circuit:

nrf24L01 Arduino

The NRF24L01 connection with the Arduino remains exactly the same. A switch is connected to pin D2. The SSD1306 Oled display module SDA and SCL/SCK pins are connected with the A4 and A5 pins while the VDD/VCC and GND pins are connected with the Arduino’s 3.3V and GND pins.



PCBs from JLCPCB:

nrf24L01 Arduino

These are the NRF24L01 development boards which I just received from the JLCPCB. I will be using these boards for testing my NRF24L01 transceiver based projects. On the left and right side you can add different types of sensors and displays. I am really impressed with the PCBs quality. The silk screen is quite clear and the white color solder mask looks pretty amazing.

nrf24L01 Arduino

This is how the PCB boards look after soldering. You can use any of these boards as the transmitter or receiver as the NRF connections on both the development boards are exactly the same. Next, I connected everything as per the circuit diagrams. And now let’s take a look at the programming.



Project Codes:

Before you start the programming, first of all, make sure you download the NRF24 and NRF24Network libraries, DallasTemperature, Adafruit_GFX, and Adafruit_SSD1306 libraries.

NRF24L01 Transmitter Code:

 



NRF24L01 Receiver Code:

 

Watch Video Tutorial:




NRF24L01 Related Projects:

NRF24L01 with Arduino, basics

Wireless Sensor Network using NRF24L01 Transceiver modules

NRF24L01 based project for Deaf People

NRF24L01 Multiple Transmitters and Single Receiver

Arduino, Android, and NRF24L01 based 12V battery monitoring system

Industrial temperature monitoring using NRF24L01 PA + LNA versions

How to control RC Plane using NRF24L01

Related Articles

One Comment

  1. I appreciate your knowledge and skills.
    I read an article and a project that controls the pump based on soil moisture.
    From a practical point of view, however, the transmitter should only measure and transmit soil moisture and temperature data to the receiver.
    The receiver should turn on the pump based on specific soil moisture thresholds.
    Could you modify the circuit and code so that the receiver turns on the pump?

    Can I count on answer.
    Greetings from Poland

Leave a Reply

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

Back to top button