Interface soil moisture sensor with NodeMCU


  • Interface soil moisture sensor with NodeMCU
  • View the sensor readings of the soil moisture sensor


  1. NodeMCU board (quantity: 1 no.)
  2. Micro USB cable A to B (quantity: 1 no.)
  3. Breadboard (quantity: 1 no.)
  4. Soil moisture sensor (quantity: 1 no.)
  5. Jumper wire – male to female (quantity: 3 no.)
  6. Arduino IDE on your computer

Let’s begin!

The soil moisture sensor consists of two parts.

  • Probe
  • Board

The probe consists of two long electrodes which will be dipped into the soil to check the moisture. The board takes readings from both electrodes and compares the voltages to check the amount of moisture present in the soil.

The analog output of the board gives a measure of the moisture level. The board also has a digital output which gives a HIGH signal if the moisture level is above a certain threshold and a LOW signal if the moisture is below the threshold. The threshold can be set by changing the value of the potentiometer present on the board.

Interfacing soil moisture sensor with NodeMCU


Interfacing soil moisture sensor with NodeMCU


Final Code

To copy the code, right click on view raw at the bottom of the code, click on open link in new tab and then copy the code.

There you go!


Loader Loading...
EAD Logo Taking too long?
Reload Reload document
| Open Open in new tab

We would love to see what you build out of these learnings!

Click here to submit your projects, share it with the world and stand a chance to be rewarded.


Knowledge and Content by Li2 Technologies | © 2021 NASSCOM Foundation | All rights reserved