Push a capacitive soil moisture sensor into a plant pot and light a red LED when the soil gets too dry. Read the value in the Serial Monitor first to find your own dry threshold.
const int sensorPin = A0; const int ledPin = 8; const int dryLevel = 600; // adjust after watching the Serial Monitor void setup() { pinMode(ledPin, OUTPUT); Serial.begin(9600); } void loop() { int moisture = analogRead(sensorPin); // higher = drier on most capacitive sensors Serial.println(moisture); digitalWrite(ledPin, moisture > dryLevel ? HIGH : LOW); delay(2000); }