├── Images
├── BlynkWorking.png
└── CircuitDiagram.jpg
├── README.md
└── Code.ino
/Images/BlynkWorking.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Shubham-Bhoite/Plant-Monitoring-System/main/Images/BlynkWorking.png
--------------------------------------------------------------------------------
/Images/CircuitDiagram.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Shubham-Bhoite/Plant-Monitoring-System/main/Images/CircuitDiagram.jpg
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Plant Monitoring System Using IoT
2 | ## Overview
3 | - The aim of this project is to automate agriculture using IoT.
4 | - In this project we used different type of sensors for collecting data from Agriculture.
5 | - I Used Blynk Cloud for accessing sensors from anywhere from world.
6 | - We can autom automate Water pump.
7 |
8 | ## How It Works
9 | - I Used Soil Moisture Sensor, DHT11 Sensor(Tempereture And Humidity) for collecting Data.
10 | - After collecting data from sensor it will send to Blynk Cloud
11 | - Blynk can control Hardware devices from remotely, it can display sensor data, it can store data, vizualize it and do many other cool things.
12 |
13 | - Soil Moisture Sensor collects moiture presents in soil i.e how much quantity of water present in the water.
14 | - DHT11 Sensor is collecting Tempereture and Humidity present in the air surround the agriculture.
15 | - Blynk Cloud will show all collected data in the form of Graphs and Charts so we can easily monitor our plants from anywhere.
16 | ### Working Of Blynk
17 |
18 | 
19 |
20 | ## Hardware and Softwares We Need
21 | 1) NodeMCU ESP8266
22 | 2) Soil Moisture Sensor
23 | 3) DHT11 Sensor
24 | 4) 5v Relay Module
25 | 5) BreadBoard
26 | 6) Jumper Wires
27 | 7) Water Pump 12v
28 | 8) 12v Battery
29 | 9) Blynk Cloud Account
30 | 10) Arduino IDE
31 |
32 | ## Circuit Diagram
33 |
34 | 
35 |
36 | ## How To Configure System
37 | 1. Connect The Hardwares According To Circuit Diagram.
38 | 2. Download Code From This Repository.
39 | 3. Download Required Libraries Into Arduino IDE
40 | 4. Connect NodeMCU to PC & Upload The Code into it.
41 | 5. Open Blynk Web App Or Mobile App and Create New Device.
42 | 6. Create Template and Add DataStreams:
43 | Pin V2,V5,V5 & D0 for Soil Moisture,Humidity,Tempereture and Motor Pump Respectively.
44 | 7. Create Web/Mobile Dashboard Using DataStreams Like Charts, Graphs,etc.
--------------------------------------------------------------------------------
/Code.ino:
--------------------------------------------------------------------------------
1 | //https://github.com/arjun-kadam/plant-monitoring-system-using-iot
2 | // IOT Smart Plant Monitoring System
3 |
4 | #define BLYNK_PRINT Serial
5 | //Paste Your Blynk Templete ID and Name Here
6 |
7 | #include
8 | #include
9 | #include
10 | #include
11 | #include
12 | #define BLYNK_PRINT Serial
13 | #include
14 | #include
15 | #define ONE_WIRE_BUS D2
16 | OneWire oneWire(ONE_WIRE_BUS);
17 | DallasTemperature sensors(&oneWire);
18 |
19 | char ssid[] = ""; //WiFi SSID
20 | char pass[] = ""; //WiFi Password
21 | char auth[] =""; //Authentication code sent by Blynk
22 |
23 | #define sensorPin D3
24 | int sensorState = 0;
25 | int lastState = 0;
26 | #define DHTPIN 2
27 | #define DHTTYPE DHT11
28 | DHT dht(DHTPIN, DHTTYPE);
29 | SimpleTimer timer;
30 | void sendSensor()
31 | {
32 | float h = dht.readHumidity();
33 | float t = dht.readTemperature();
34 |
35 | if (isnan(h) || isnan(t)) {
36 | Serial.println("Failed to read from DHT sensor!");
37 | return;
38 | }
39 |
40 | Blynk.virtualWrite(V5, h); //V5 is for Humidity
41 | Blynk.virtualWrite(V6, t); //V6 is for Temperature
42 | }
43 | void setup()
44 | {
45 | Serial.begin(9600);
46 | Blynk.begin(auth, ssid, pass);
47 | pinMode(sensorPin, INPUT);
48 | dht.begin();
49 |
50 | timer.setInterval(1000L, sendSensor);
51 | Serial.begin(115200);
52 | Blynk.begin(auth, ssid, pass);
53 | sensors.begin();
54 | }
55 | int sensor=0;
56 | void sendTemps()
57 | {
58 | sensor=analogRead(A0);
59 | sensors.requestTemperatures();
60 | float temp = sensors.getTempCByIndex(0);
61 | Serial.println(temp);
62 | Serial.println(sensor);
63 | Blynk.virtualWrite(V1, temp);
64 | Blynk.virtualWrite(V2,sensor);
65 | delay(1000);
66 | }
67 | void loop()
68 | {
69 | Blynk.run();
70 | timer.run();
71 | sendTemps();
72 | sensorState = digitalRead(sensorPin);
73 | Serial.println(sensorState);
74 |
75 | if (sensorState == 1 && lastState == 0) {
76 | Serial.println("needs water, send notification");
77 | Blynk.notify("Water your plants");
78 | lastState = 1;
79 | delay(1000);
80 | //send notification
81 |
82 | }
83 | else if (sensorState == 1 && lastState == 1) {
84 | //do nothing, has not been watered yet
85 | Serial.println("has not been watered yet");
86 | delay(1000);
87 | }
88 | else {
89 | //st
90 | Serial.println("does not need water");
91 | lastState = 0;
92 | delay(1000);
93 | }
94 |
95 | delay(100);
96 | }
--------------------------------------------------------------------------------