Smart Irrigation using ESP8266 and IoT | IoT plant monitoring system | IoT | Esp8266
Vložit
- čas přidán 7. 09. 2024
- In this in-depth tutorial, we will walk you through the steps to create a Smart Plant Watering System using the robust ESP8266, a precise Soil Moisture Sensor, a Relay Module, a Water Pump, and the user-friendly Blynk App. This project is perfect for ensuring your plants receive the right amount of water, even when you’re not at home, making it ideal for plant enthusiasts with busy schedules or frequent travelers.
Video Chapters:
0:00 - Components
0:33 - Connections
1:35 - Blynk setup
3:38 - Code
4:04 - Working
4:20 - Outro
Don’t forget to like, comment, and subscribe to stay updated with our latest projects and tutorials. Hit the bell icon to get notified whenever we upload a new video. Share your thoughts, questions, and project ideas in the comments below - we love hearing from you!
Wow super
Here's the code:
#define BLYNK_TEMPLATE_ID ""
#define BLYNK_TEMPLATE_NAME ""
#define BLYNK_AUTH_TOKEN ""
#include
#include
char auth[] = ""; // Blynk Auth Token
char ssid[] = ""; // WiFi Network Name
char pass[] = ""; // WiFi Password
int sensorPin = A0; // Soil Moisture Sensor Pin
int relayPin = D0; // Relay Pin
int threshold = 40; // Moisture threshold percentage
BLYNK_WRITE(V3) {
int buttonState = param.asInt();
Serial.print("Button state: ");
Serial.println(buttonState);
if (buttonState == 1) {
digitalWrite(relayPin, LOW);
Serial.println("Water pump turned ON");
} else {
digitalWrite(relayPin, HIGH);
Serial.println("Water pump turned OFF");
}
}
void setup() {
Serial.begin(115200);
Blynk.begin(auth, ssid, pass);
pinMode(sensorPin, INPUT);
pinMode(relayPin, OUTPUT);
digitalWrite(relayPin, HIGH);
Serial.println("Setup complete. Connecting to Blynk...");
}
void loop() {
Blynk.run();
int moistureValue = analogRead(sensorPin);
int moisturePercentage = map(moistureValue, 1023, 0, 0, 100);
Blynk.virtualWrite(V2, moisturePercentage);
Serial.print("Raw Sensor Value: ");
Serial.println(moistureValue);
Serial.print("Moisture Level: ");
Serial.print(moisturePercentage);
Serial.println("%");
if (moisturePercentage < threshold) {
Blynk.logEvent("lowmoisture", "Low Moisture Detected!");
Serial.println("Low moisture detected, alert sent.");
}
delay(1000);
}
How can we get the code?
Here's the code:
#define BLYNK_TEMPLATE_ID ""
#define BLYNK_TEMPLATE_NAME ""
#define BLYNK_AUTH_TOKEN ""
#include
#include
char auth[] = ""; // Blynk Auth Token
char ssid[] = ""; // WiFi Network Name
char pass[] = ""; // WiFi Password
int sensorPin = A0; // Soil Moisture Sensor Pin
int relayPin = D0; // Relay Pin
int threshold = 40; // Moisture threshold percentage
BLYNK_WRITE(V3) {
int buttonState = param.asInt();
Serial.print("Button state: ");
Serial.println(buttonState);
if (buttonState == 1) {
digitalWrite(relayPin, LOW);
Serial.println("Water pump turned ON");
} else {
digitalWrite(relayPin, HIGH);
Serial.println("Water pump turned OFF");
}
}
void setup() {
Serial.begin(115200);
Blynk.begin(auth, ssid, pass);
pinMode(sensorPin, INPUT);
pinMode(relayPin, OUTPUT);
digitalWrite(relayPin, HIGH);
Serial.println("Setup complete. Connecting to Blynk...");
}
void loop() {
Blynk.run();
int moistureValue = analogRead(sensorPin);
int moisturePercentage = map(moistureValue, 1023, 0, 0, 100);
Blynk.virtualWrite(V2, moisturePercentage);
Serial.print("Raw Sensor Value: ");
Serial.println(moistureValue);
Serial.print("Moisture Level: ");
Serial.print(moisturePercentage);
Serial.println("%");
if (moisturePercentage < threshold) {
Blynk.logEvent("lowmoisture", "Low Moisture Detected!");
Serial.println("Low moisture detected, alert sent.");
}
delay(1000);
}
Where is the code
Here's the code:
#define BLYNK_TEMPLATE_ID ""
#define BLYNK_TEMPLATE_NAME ""
#define BLYNK_AUTH_TOKEN ""
#include
#include
char auth[] = ""; // Blynk Auth Token
char ssid[] = ""; // WiFi Network Name
char pass[] = ""; // WiFi Password
int sensorPin = A0; // Soil Moisture Sensor Pin
int relayPin = D0; // Relay Pin
int threshold = 40; // Moisture threshold percentage
BLYNK_WRITE(V3) {
int buttonState = param.asInt();
Serial.print("Button state: ");
Serial.println(buttonState);
if (buttonState == 1) {
digitalWrite(relayPin, LOW);
Serial.println("Water pump turned ON");
} else {
digitalWrite(relayPin, HIGH);
Serial.println("Water pump turned OFF");
}
}
void setup() {
Serial.begin(115200);
Blynk.begin(auth, ssid, pass);
pinMode(sensorPin, INPUT);
pinMode(relayPin, OUTPUT);
digitalWrite(relayPin, HIGH);
Serial.println("Setup complete. Connecting to Blynk...");
}
void loop() {
Blynk.run();
int moistureValue = analogRead(sensorPin);
int moisturePercentage = map(moistureValue, 1023, 0, 0, 100);
Blynk.virtualWrite(V2, moisturePercentage);
Serial.print("Raw Sensor Value: ");
Serial.println(moistureValue);
Serial.print("Moisture Level: ");
Serial.print(moisturePercentage);
Serial.println("%");
if (moisturePercentage < threshold) {
Blynk.logEvent("lowmoisture", "Low Moisture Detected!");
Serial.println("Low moisture detected, alert sent.");
}
delay(1000);
}