Soil Moisture Sensor
Soil moisture is basically the content of water present in soil. This can be measured using a soil moisture sensor which consists of two conducting probes that act as a probe. It can measure the moisture content in the soil based on the change in resistance between the two conducting plates.
The resistance between the two conducting plates varies in an inverse manner with the amount of moisture present in the soil.
For more information about soil moisture sensor and how to use it, refer the topic Soil Moisture Sensor in the sensors and modules section.
Soil Moisture Sensor Interfacing with NodeMCU
Measuring soil moisture in terms of percentage.
Here, the analog output of soil moisture sensor is processed using ADC. The moisture content in terms of percentage is displayed on the serial monitor.
The output of the soil moisture sensor changes in the range of ADC value from 0 to 1023. This can be represented as moisture value in terms of percentage using formula given below.
Analog Output = ADC Value / 1023
Moisture in percentage = 100 – (Analog output * 100)
For zero moisture, we get maximum value of 10-bit ADC, i.e. 1023. This in turn gives ~0% moisture.
NodeMCU ADC can be used to measure analog voltage from soil moisture sensor. To know about ADC of NodeMCU refer NodeMCU ADC with ESPlorer IDE and NodeMCU ADC with Arduino IDE.
We can write codes for NodeMCU Dev Kit in either Lua Script or C/C++ language. We are using ESPlorer IDE for writing Lua scripts and Arduino IDE for writing code in C/C++. To know more refer Getting started with NodeMCU using ESPlorer IDE (which uses Lua scripting for NodeMCU) and Getting started with NodeMCU using Arduino IDE (which uses C language based Arduino sketches for NodeMCU).
Sending data to the Cloud & Setting Up thingsai.io Account:When just logging to the serial monitor, our data isn't that useful. Once in thingsai.io, we can graph and react to the data.
Setting Up thingsai.io Account
1. visit to https://thingsai.io/ website.
2. Register Your self with Google account or Email Id.
3. Login page:
4. After Login, Click on Create New Project and Give any name of your choice. For My case it is "Irrigation System".
5. Create the Device and Now Add the Parameters, Like We are monitoring the Soil Moisture of our Pot then our Parameters will be Percentage (In Decimal).
Now Copy the code to arduino Ide and Upload the Code to the NodeMcu and Connect the NodeMcu to your home Wifi Hotspot. If all working then Data will start updating to thingsai.io Account.
Wifi Setup:
1. Start the Phone Wifi and scan for Ap name abcd.
2. Connect with this AP.
3. Now a Web page opened, Click on Wifi Configuration and type your Hotspot SSID and Password.
4. Now your Node is Connected to Network.
Note: If no any web page opened in browser then type 192.168.4.1 in your phone browser it will show the wifi configuration page.








Comments