SAKSHAM
Smart Adaptive Knowledge-based Soil Hydration & Automation Module
Smart Agriculture • Climate-Adaptive Irrigation • Embedded Systems • Water Conservation
SAKSHAM is a climate-adaptive smart plant water-management project designed to monitor soil and environmental conditions and automate irrigation decisions. Its documented objective is to reduce unnecessary watering while supporting healthy plant growth and more efficient water use.
Project Overview
Water availability and plant requirements change with soil moisture and environmental conditions. SAKSHAM addresses this by combining soil-moisture sensing with temperature, humidity, rainfall, light and water-tank monitoring so that irrigation can be adjusted according to current conditions.
The documented system continuously reads sensors, checks water availability, applies irrigation decision logic, controls a pump, displays information locally, stores data and can send alerts when required.
Objectives
Reference Hardware Architecture
The project materials identify soil and environmental sensing, pump control, a local display, data storage and alert capability. The reference implementation in this OpenSource Section uses the following representative modules.
Documented Irrigation Decision Logic
The following soil-moisture ranges are taken from the SAKSHAM project presentation and are shown here as the core decision framework.
| Soil Moisture | Condition | Documented Action |
|---|---|---|
| 0–20% | Very dry | High watering |
| 20–50% | Slightly dry | Pulse watering |
| 50–70% | Optimal | No watering |
| Above 70% | Wet | No watering |
Circuit / Interconnection Diagram
The diagram below is an OpenSource Section reference interconnection diagram based on the modules and operating functions documented for SAKSHAM. It is not presented as a reproduction of an unreleased original schematic.
System Operation Flow
Arduino Reference Implementation
Download .inoThe project presentation states that original code and a circuit diagram are intended to be available through the OpenSource Section, but the supplied presentation does not contain the source code itself. The file below is therefore clearly labelled as a reference implementation aligned with the documented logic rather than claimed as the unretrieved original firmware.
/*
SAKSHAM — Smart Adaptive Knowledge-based Soil Hydration & Automation Module
OpenSource Section | SB.Chetak Innovation
REFERENCE IMPLEMENTATION
---------------------------------------------------------------------------
This sketch is a reference implementation created from the documented
SAKSHAM operating logic. Calibrate all sensors and verify module datasheets
before practical use.
Documented logic represented here:
- Soil 0–20% : very dry -> high watering
- Soil 20–50% : slightly dry -> pulse watering
- Soil 50–70% : optimal -> no watering
- Soil >70% : wet -> no watering
- Rain detected -> watering stops
- High temperature -> watering demand may increase
- High humidity -> watering demand may decrease
- Strong sunlight -> watering may be deferred
- Empty tank -> pump OFF and alert
- LCD display + SD logging + GSM alert capability
*/
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <DHT.h>
#include <SPI.h>
#include <SD.h>
// ---------------------------------------------------------------------------
// Pin configuration — Arduino Mega 2560 reference mapping
// ---------------------------------------------------------------------------
const uint8_t PIN_SOIL = A0;
const uint8_t PIN_RAIN = A1;
const uint8_t PIN_LIGHT = A2;
const uint8_t PIN_TANK = A3;
const uint8_t PIN_DHT = 22;
const uint8_t PIN_RELAY = 7;
const uint8_t PIN_SD_CS = 53;
#define DHTTYPE DHT22
DHT dht(PIN_DHT, DHTTYPE);
LiquidCrystal_I2C lcd(0x27, 16, 2);
// Arduino Mega Serial1: RX1 = 19, TX1 = 18
#define gsm Serial1
// ---------------------------------------------------------------------------
// Calibration values — MUST be calibrated for the actual sensors
// ---------------------------------------------------------------------------
const int SOIL_DRY_RAW = 850; // example calibration point
const int SOIL_WET_RAW = 350; // example calibration point
const int RAIN_THRESHOLD_RAW = 500; // example only
const int LIGHT_STRONG_RAW = 780; // example only
const int TANK_EMPTY_RAW = 180; // example only
const bool RELAY_ACTIVE_LOW = true;
const bool AVOID_STRONG_SUN = true;
// Example controlled watering windows. Adjust after testing.
const unsigned long HIGH_WATER_MS = 12000UL;
const unsigned long PULSE_WATER_MS = 5000UL;
const unsigned long CYCLE_DELAY_MS = 5000UL;
// Optional environmental modifiers
const float HIGH_TEMP_C = 32.0;
const float HIGH_HUMIDITY_PERCENT = 80.0;
unsigned long lastLogTime = 0;
const unsigned long LOG_INTERVAL_MS = 15000UL;
// ---------------------------------------------------------------------------
// Utility helpers
// ---------------------------------------------------------------------------
void setPump(bool on) {
if (RELAY_ACTIVE_LOW) {
digitalWrite(PIN_RELAY, on ? LOW : HIGH);
} else {
digitalWrite(PIN_RELAY, on ? HIGH : LOW);
}
}
int soilPercentFromRaw(int raw) {
long mapped = map(raw, SOIL_DRY_RAW, SOIL_WET_RAW, 0, 100);
return constrain((int)mapped, 0, 100);
}
void sendGsmLine(const String &line) {
gsm.println(line);
delay(150);
}
void sendSms(const String &message) {
// Enter a verified recipient number before enabling practical SMS alerts.
const char PHONE_NUMBER[] = "+000000000000";
sendGsmLine("AT");
sendGsmLine("AT+CMGF=1");
gsm.print("AT+CMGS=\"");
gsm.print(PHONE_NUMBER);
gsm.println("\"");
delay(250);
gsm.print(message);
gsm.write(26); // Ctrl+Z
delay(1200);
}
void showStatus(int soil, float temperature, bool pumpOn) {
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Soil:");
lcd.print(soil);
lcd.print("% T:");
if (isnan(temperature)) {
lcd.print("--");
} else {
lcd.print((int)temperature);
}
lcd.setCursor(0, 1);
lcd.print("Pump:");
lcd.print(pumpOn ? "ON " : "OFF");
}
void logToSd(
int soil,
int rainRaw,
int lightRaw,
int tankRaw,
float temperature,
float humidity,
const String &decision
) {
if (millis() - lastLogTime < LOG_INTERVAL_MS) return;
lastLogTime = millis();
File file = SD.open("saksham.csv", FILE_WRITE);
if (!file) return;
file.print(millis()); file.print(',');
file.print(soil); file.print(',');
file.print(rainRaw); file.print(',');
file.print(lightRaw); file.print(',');
file.print(tankRaw); file.print(',');
file.print(temperature); file.print(',');
file.print(humidity); file.print(',');
file.println(decision);
file.close();
}
// ---------------------------------------------------------------------------
// Setup
// ---------------------------------------------------------------------------
void setup() {
pinMode(PIN_RELAY, OUTPUT);
setPump(false);
Serial.begin(115200);
gsm.begin(9600);
dht.begin();
lcd.init();
lcd.backlight();
if (SD.begin(PIN_SD_CS)) {
File file = SD.open("saksham.csv", FILE_WRITE);
if (file && file.size() == 0) {
file.println("ms,soil_percent,rain_raw,light_raw,tank_raw,temp_c,humidity_percent,decision");
file.close();
}
}
lcd.setCursor(0, 0);
lcd.print("SAKSHAM");
lcd.setCursor(0, 1);
lcd.print("Initializing...");
delay(1500);
}
// ---------------------------------------------------------------------------
// Main control loop
// ---------------------------------------------------------------------------
void loop() {
const int soilRaw = analogRead(PIN_SOIL);
const int rainRaw = analogRead(PIN_RAIN);
const int lightRaw = analogRead(PIN_LIGHT);
const int tankRaw = analogRead(PIN_TANK);
const int soil = soilPercentFromRaw(soilRaw);
const float temperature = dht.readTemperature();
const float humidity = dht.readHumidity();
const bool rainDetected = rainRaw < RAIN_THRESHOLD_RAW;
const bool strongSun = lightRaw > LIGHT_STRONG_RAW;
const bool tankEmpty = tankRaw < TANK_EMPTY_RAW;
String decision = "NO_WATER";
unsigned long wateringTime = 0;
// Safety / stop conditions have priority.
if (tankEmpty) {
decision = "TANK_EMPTY";
setPump(false);
showStatus(soil, temperature, false);
sendSms("SAKSHAM alert: Water tank is empty. Pump stopped.");
}
else if (rainDetected) {
decision = "RAIN_STOP";
setPump(false);
showStatus(soil, temperature, false);
}
else if (AVOID_STRONG_SUN && strongSun) {
decision = "STRONG_SUN_DEFER";
setPump(false);
showStatus(soil, temperature, false);
}
else if (soil < 20) {
decision = "HIGH_WATER";
wateringTime = HIGH_WATER_MS;
// Documented qualitative modifier: high temperature may increase watering.
if (!isnan(temperature) && temperature > HIGH_TEMP_C) {
wateringTime += 3000UL;
}
// Documented qualitative modifier: high humidity may reduce watering.
if (!isnan(humidity) && humidity > HIGH_HUMIDITY_PERCENT && wateringTime > 3000UL) {
wateringTime -= 3000UL;
}
setPump(true);
showStatus(soil, temperature, true);
delay(wateringTime);
setPump(false);
}
else if (soil < 50) {
decision = "PULSE_WATER";
wateringTime = PULSE_WATER_MS;
if (!isnan(temperature) && temperature > HIGH_TEMP_C) {
wateringTime += 2000UL;
}
if (!isnan(humidity) && humidity > HIGH_HUMIDITY_PERCENT && wateringTime > 2000UL) {
wateringTime -= 2000UL;
}
setPump(true);
showStatus(soil, temperature, true);
delay(wateringTime);
setPump(false);
}
else {
// 50–70% optimal and >70% wet are both no-watering states.
decision = (soil <= 70) ? "OPTIMAL" : "WET";
setPump(false);
showStatus(soil, temperature, false);
}
Serial.print("Soil: "); Serial.print(soil); Serial.print("% | ");
Serial.print("RainRaw: "); Serial.print(rainRaw); Serial.print(" | ");
Serial.print("LightRaw: "); Serial.print(lightRaw); Serial.print(" | ");
Serial.print("TankRaw: "); Serial.print(tankRaw); Serial.print(" | ");
Serial.print("Temp: "); Serial.print(temperature); Serial.print(" C | ");
Serial.print("Humidity: "); Serial.print(humidity); Serial.print("% | ");
Serial.print("Decision: "); Serial.println(decision);
logToSd(
soil,
rainRaw,
lightRaw,
tankRaw,
temperature,
humidity,
decision
);
delay(CYCLE_DELAY_MS);
}
Open-Source Resources
Download the SAKSHAM reference firmware and circuit/interconnection diagram for educational and research study.
OpenSource Section — SB.Chetak Innovation
This project resource is shared for educational and research purposes. Calibrate sensors for the actual soil and hardware, verify component specifications, and clearly identify modified versions of the published reference implementation.