Tyagi // Engineering Log
← Back to Projects
IoT shipped

Smart Irrigation IoT System

Built an IoT-based smart irrigation system using NodeMCU and sensors for temperature, humidity, and soil moisture, with a Flutter app visualizing data and an SVM model forecasting irrigation needs.

Date 2024-08
Reading Time 2 min read
Difficulty
Stack
NodeMCU,Flutter,Dart +2
Reported

Temperature, humidity, soil moisture

Sensors monitored

Problem & Context

Manual irrigation decisions are often based on rough schedules rather than actual soil/environmental conditions, leading to over- or under-watering.

Solution & Architecture

Diagram source (mermaid)
flowchart LR
  Sensors[Soil moisture / temp / humidity sensors] --> Node[NodeMCU]
  Node --> FB[(Firebase Realtime Database)]
  FB --> App[Flutter visualization app]
  FB --> Model[SVM forecasting model]
  Model --> App

NodeMCU collected real-time sensor readings and pushed them to Firebase Realtime Database. A Flutter app visualized this data, while an SVM (support vector machine) model used the same sensor history to forecast irrigation needs rather than relying on a fixed schedule.

Key Decisions & Tradeoffs

Pushing sensor readings through Firebase Realtime Database rather than handling NodeMCU-to-app communication directly meant the forecasting model and the visualization app could each read the same data stream independently, without the NodeMCU needing to know how many consumers existed or coordinate delivery to each. The cost is a dependency on network connectivity at the sensor node — a NodeMCU with no signal can’t push readings, which matters for outdoor field deployments more than for a controlled test setup.

Choosing SVM over a more expressive model (e.g., a neural forecaster) was a deliberate fit to the problem size: three correlated sensor signals and a single binary-ish decision (water now or not) don’t need a model with a large parameter count, and a simpler model is both faster to retrain on limited field data and easier to reason about when a forecast looks wrong.

Lessons Learned

Pairing a simple, well-understood model (SVM) with a clear, narrow forecasting task (when does this plot need water) kept the system maintainable — there was no need for a more complex model given the relatively small feature set (temperature, humidity, soil moisture) driving the prediction.

Using a managed realtime store instead of a custom protocol between the NodeMCU and the app also meant offline behavior fell out almost for free: Firebase’s client SDKs already handle reconnect-and-resync, so neither the sensor firmware nor the Flutter app needed bespoke retry logic for a flaky field connection. The broader takeaway for small embedded-plus-app projects is that picking a managed sync layer over a hand-rolled one shifts effort away from plumbing (retries, offline queues, fan-out to multiple consumers) and toward the part of the project that’s actually novel — in this case, the forecasting model and what it does with the data once it arrives.