Friday, December 5, 2025

Real‑Time Crop Monitoring and Remote Irrigation via ThingSpeak

Modern agriculture requires efficient resource management and real-time monitoring to ensure optimal crop growth. However, traditional methods often rely on labour-intensive manual checks, which are impractical for remote or large-scale farms. This results in inefficient irrigation, reduced crop yields, and wasted resources.

The IoT ThingSpeak Dashboard and Controller project solves these issues by leveraging the IndusBoard Coin’s built-in Wi-Fi and sensors to create a smart agriculture solution. Integrated with a soil moisture sensor, onboard temperature and light sensors, and a relay module, the system collects real-time data on soil moisture, temperature, and light intensity. This data is uploaded to a ThingSpeak channel every 15 seconds.

Using an intuitive ThingSpeak dashboard, farmers can monitor environmental conditions and remotely control a water pump via React and ThingHTTP apps. This enables efficient irrigation management from anywhere—boosting crop productivity and conserving resources.

- Advertisement -
ThingSpeak dashboard and sensor planted in the soil
Fig 1. Real‑Time Crop Monitoring and Remote Irrigation via ThingSpeak

Bill of Materials

ComponentsQuantity
IndusBoard Coin (ESP32-S2)1
Soil Moisture Sensor1
Relay Module1
USB Type-C Cable1
3.3V Battery / 3.3V–5V Power Supply1
3D Printed Case for Device1

ThingSpeak Configuration

Before writing the code for your device, you need to configure the ThingSpeak dashboard. Follow these steps:

Sign Up and Create a Channel

  1. Visit ThingSpeak and sign up or log in.
  2. Navigate to Channels > My Channels and click New Channel.
  3. Configure the channel:
    • Name: e.g., “Soil Monitoring”
    • Field 1: Soil Moisture (%)
    • Field 2: Light Intensity (Lux)
    • Field 3: Temperature (°C)
    • Field 4: Relay Status (0 = OFF, 1 = ON)
  4. Save the channel.
  5. Note the Channel ID and Write API Key from the API Keys tab.

Add Visualizations

  1. Go to the Private View or Public View tab of your channel.
  2. Click Add Visualisations and create charts:
    • Field 1: Line chart for soil moisture (%)
    • Field 2: Line chart for light intensity (Lux)
    • Field 3: Line chart for temperature (°C)
    • Field 4: Gauge or status indicator for relay status
Setting up ThingSpeak dashboard channels
Fig 2. Setting up dashboard channels
Creating ThingSpeak API key
Fig 3. Creating ThingSpeak API key

Coding

Once the ThingSpeak dashboard is set up and the API is configured, you can write the code. Start by entering your Wi-Fi SSID and password in the code. Then, input your ThingSpeak Write API Key in the API section of the code and upload it to the IndusBoard.

- Advertisement -

A complete version of the code can be downloaded at the end of this article.

Connection

Soil Moisture Monitoring System Circuit diagram
Fig 4. Soil Moisture Monitoring System Circuit Diagram

Testing

After powering the device, go to your ThingSpeak channel dashboard. You should see real-time data displayed as:

  • Line charts for soil moisture, light intensity, and temperature
  • A gauge or status indicator for the relay status (0 for OFF, 1 for ON)

These values update every 15 seconds.

Testing the Relay

  • Click the ON button in the dashboard to write 1 to Field 4. This should activate the water pump, and the Serial Monitor will log:
    "Relay set to: ON"
  • Click the OFF button to write 0 to Field 4. The pump should turn off, and the Serial Monitor will confirm:
    "Relay set to: OFF"

Troubleshooting

  • No Data on ThingSpeak?
    Check Wi-Fi credentials, internet connectivity, and the Write API Key. Ensure your network has stable internet access.
  • Relay Not Responding?
    Verify the ThingHTTP URL, IndusBoard IP and port, and the relay’s wiring and HIGH/LOW logic configuration.
  • Incorrect Sensor Readings?
    If the soil moisture readings fall outside the 0–100% range, consider calibrating the sensor or checking the wiring for loose connections.


Ashwini Sinha
Ashwini Sinha
A tech journalist at EFY, with hands-on expertise in electronics DIY. He has an extraordinary passion for AI, IoT, and electronics. Holder of two design records and two times winner of US-China Makers Award.

SHARE YOUR THOUGHTS & COMMENTS

Most Popular DIY Projects

EFY Prime

Unique DIY Projects

Electronics News

Truly Innovative Electronics

Latest DIY Videos

Electronics Components

Electronics Jobs

Calculators For Electronics

×