Iot Project
Iot Project
Submitted by
ISSAC NIJISH C
JAIRUS PAUL SAMUEL A
JASWANTH S S
JERISH N
MERGIN M
MICHEAL RAHUL R
MOHAMED ANASH S
NANTHU M
SHAKEEN J H
WINNKO W S
In partial fulfillment for the award of the degree
of
BACHELOR OF ENGINEERING
IN
BONAFIDE CERTIFICATE
iii
ABSTRACT
Smart agriculture is an emerging concept which uses IOT sensors that are
capable of providing information about agriculture fields and then act upon
them based on the user input. The aim of IOT is to propose a technology which
Arduino board and display the data to the user using Network connections. The
system will continuously monitor the crops and gather data. This system can
The system has a duplex communication interface link that allows for
data inspection and manual irrigation. This System dynamically waters the
crops based on the gathered data. The system has the potential to be useful in
iv
TABLE OF CONTENTS
1 INTRODUCTION 1
1.1 EMBEDDED SYSTEMS 1
1.2 IOT SYSTEMS 4
1.3 IOT EMBEDDED SYSTEMS 9
2 OPERATION 10
2.1 INPUT DEVICES 10
2.2 OUTPUT DEVICES 13
2.3 PROCESSING UNIT 25
2.4 WORKING 27
3 OUTPUTS 20
3.1 DISPLAY 20
3.2 WEB APPLICATION 24
4 CONCLUSION 28
4.1 RESULTS 28
4.2 LIMITATION 29
4.3 SCOPE OF INNOVATIONS 30
APPENDICES 31
APPENDIX-1 31
APPENDIX-2 35
REFERENCE 38
v
LIST OF FIGURES
vi
LIST OF SYMBOLS AND ABBREVIATIONS
SYMBOLS MEANING
vii
CHAPTER 1
INTRODUCTION
1
1.1.1 Application areas of Embedded System
Mostly Embedded systems are present everywhere. We use it in our
everyday life unknowingly as in most cases it is integrated into the larger
systems. So, here are some of the application areas of Embedded systems:
Transportation
Business sector & offices
Defense sector
Agricultural Sector
2
1.1.3 Block Structure Diagram of Embedded System:
3
1.2 IOT SYSTEMS
4
1.2.1 Main Components Used in IOT
Low-power embedded systems: Less battery consumption, high
performance are the inverse factors that play a significant role during the
design of electronic systems.
Sensors: Sensors are a major part of any IOT application. It is a physical
device that measures and detects certain physical quantities and converts it
into signal which can be provided as an input to processing or control unit
for analysis purposes.
1.2.2 IOT Enablers
RFIDs: Uses radio waves in order to track physical objects.
Sensors: Devices that are able to detect changes in an environment.
Nanotechnology: Using tiny devices with dimensions usually less than
a hundred nanometers.
1.2.3 Working with IOT Devices
Collect and Transmit Data: For Data collection purposes sensors are
widely used.
Actuate device based on triggers produced by sensors or processing
devices: If certain conditions are satisfied or according to user’s
requirements if certain trigger is activated then which action to perform
that is shown by Actuator devices.
Receive Information: From network devices, users or devices can take
certain information also for their analysis and processing purposes.
Communication Assistance: Communication assistance is the
phenomenon of communication between 2 networks or communication
between 2 or more IOT devices of the same or different networks. This
can be achieved by different communication protocols like: MQTT,
Constrained Application Protocol, ZigBee, FTP, HTTP etc.
5
Figure 1.2: Working of IOT
6
1.2.5 Desired Quality of any IOT Application
Interconnectivity: It is the basic first requirement in any IOT
infrastructure. Connectivity should be guaranteed from any devices on
any network then only devices in a network can communicate with each
other.
Dynamic in Nature: IOT devices should dynamically adapt themselves to
the changing surroundings like different situations and different prefaces.
Self-adapting and self-configuring technology : For example,
surveillance cameras. It should be flexible to work in different weather
conditions and different light situations (morning, afternoon, or night).
Intelligence: Just data collection is not enough in IOT, extraction of
knowledge from the generated data is very important. For example, sensors
generate data, but that data will only be useful if it is interpreted properly.
So, intelligence is one of the key characteristics in IOT. Because data
interpretation is the major part in any IOT application because without data
processing we can’t make any insights from data. Hence, big data is also
one of the most enabling technologies in the IOT field.
Safety: Sensitive personal details of a user might be compromised when
the devices are connected to the Internet. So, data security is a major
challenge. This could cause a loss to the user. Equipment in the huge IOT
network may also be at risk. Therefore, equipment safety is also critical.
Architecture: It should be hybrid, supporting different manufacturer’s
products to function in the IOT network.
As a quick note, IOT incorporates trillions of sensors, billions of smart
systems, and millions of applications.
7
1.2.6 Advantages of IOT
Improved efficiency and automation of tasks.
Increased convenience and accessibility of information.
Better monitoring and control of devices and systems.
Greater ability to gather and analyze data.
Improved decision-making.
Cost savings.
1.2.7 Disadvantages of IOT
Security concerns and potential for hacking or data breaches.
Privacy issues related to the collection and use of personal data.
Dependence on technology and potential for system failures.
Limited standardization and interoperability among devices.
Complexity and increased maintenance requirements.
High initial investment costs.
Limited battery life on some devices.
Concerns about job displacement due to automation.
Limited regulation and legal framework for IOT, which can lead to
confusion and uncertainty.
8
1.3 IOT Embedded Systems
9
CHAPTER 2
OPERATION
10
2.1.2 Waterproof Temperature Sensor:
11
2.1.4 Ultrasonic Sensor:
12
2.2 OUTPUT DEVICES
Output devices are the components that let the system provide
information to the user. These devices convert the electrical signals into actions
or provide visualization to the user. The different output devices used in the
system are OLED Display, Submersible Mini Water Pump with Relay.
13
2.2.2 Submersible Mini Water Pump with Relay:
14
2.3 PROCESSING UNIT
The ESP8266 is a versatile and cost-effective Wi-Fi module that
has gained immense popularity among hobbyists, engineers, and IOT
enthusiasts for its capability to enable wireless communication and
connectivity in various projects.
2.3.2 Connectivity:
One of the standout features of the ESP8266 is its built-in Wi-Fi
capability, allowing seamless wireless communication with other devices
and networks.
It supports both station (STA) and access point (AP) modes,
enabling it to connect to existing Wi-Fi networks or create its own
network for other devices to connect to.
15
2.3.3 GPIO Pins:
The ESP8266 board typically comes with a number of General-
Purpose Input/Output (GPIO) pins, which can be configured and
programmed for various tasks such as reading sensor data, controlling
actuators, or interfacing with other peripherals.
These GPIO pins provide flexibility and expandability, allowing
the board to interface with a wide range of sensors, actuators, and
external modules.
16
2.3.4 Programming Interface:
Programming the ESP8266 board can be done using a variety of
development environments and programming languages, including
Arduino IDE, MicroPython, Lua, and more.
The availability of extensive documentation, tutorials, and
community support makes it relatively easy for beginners to get started
with programming and development
17
2.4 WORKING
The Arduino board is the most important part of this Embedded System.
They perform processing function. It takes the data from different sensors and
operates on the information provided by them. The block diagram of the circuit
connections can be seen below.
The Soil moisture Sensor’s A OUT pin is connected to the Arduino board’s
A0 pin. The power supply is provided to the Soil Moisture sensor from the
Arduino. The Soil moisture Sensor will transmit the current level of moisture to
the Arduino using the analog connection.
18
The display derives the power from Arduino board. The S pin from the
DA
display is connected to the D1 pin of Arduino. The S pin from the display is
CK
The Rain sensor obtains power supply from the Arduino board. The D OUT
pin from the Rain sensor is connected to the D 0 pin in the Arduino. The Rain
sensor will notify the Arduino if there is a certain amount of rain in the field.
The Ultrasonic sensor draws power from the Arduino board for operation.
T IN pin of the Ultrasonic sensor is connected to the D 4 pin of the Arduino
similarly the E OUT pin of the Ultrasonic sensor is connected to the D 5 pin of the
Arduino board. The Ultrasonic sensor transmits the water level data of the water
source to the Arduino board.
The Temperature sensor receives power from the Arduino board. The D OUT
pin from the Temperature sensor is connected to the D 7 pin in the Arduino
board. The Temperature sensor will provide field temperature data to the
Arduino board.
control the power supply to the Water Pump. When input signal is provided
from the Arduino the Water Pump will start to irrigate the field.
19
The Arduino will continuously get the data from the input devices namely
Soil Moisture sensor, Rain sensor, Ultrasonic sensor and Temperature sensor.
These data are displayed visually to the user with the help of the display device.
The same data is processed in order to transmit to web application. Transfer of
data is done with the help of the integrated Wi-Fi module present in the Arduino
board.
We can access the field data from afar by simply connecting to the IP
address provided by the Arduino board. In addition to monitoring the data, we
can also control the operation of Water pump from far away using the switch in
the web application.
20
CHAPTER 3
OUTPUTS
3.1 DISPLAY
There are various situations that may arise in the implementation of the
System. The following images show the different output seen on the display in
different scenarios.
In the idle state the field has no rain. The level at the water source in idle
state is sufficient for irrigation. The water pump is in off state. The following
figure shows the state of the display during idle state.
21
3.1.2 Rain State:
When there is rain in the field the System does not need to water the
plants. The following figure shows the display when there is rain in the field.
22
3.1.4 Pump Operation:
The user might need to know if the water pump is turned on. This will
help the user monitor the operation of the System. The following figure shows
the display when there is low water level at the source.
23
3.2 WEB APPLICATION
The web application helps the user access and monitor the data about the
field. The following images show the different output seen on the display in
different scenarios.
24
3.2.2 Rain State (Web):
Similar to that of the actual display the user can access the data about the
rain state of the system using the web application. The following figure shows
the web application in the rain state.
25
3.2.3 Water source Limitation (Web):
Similar to that of the actual display the user can access the data about the
water source of the system using the web application. The following figure
shows the web application displaying water source level alert.
26
3.2.4 Pump operation (Web):
Similar to that of the actual display the user can access the data about the
pump operation of the system using the web application. The following figure
shows the web application displaying the pump operation.
27
CHAPTER 4
CONCLUSION
4.1 RESULTS
From the above instances we can see that the Smart Agriculture
System can be used for real-time agriculture purposes. When it is raining
in the field the system will avoid irrigating the field, conserving Energy.
If the soil moisture falls below the threshold level the system will
automatically water the crops thus ensuring that the crop has sufficient
moisture level at all times. The System will make sure that the water
source has sufficient water for irrigation.
This System is very convenient to use. They can help the user to
increase the crop yield. It reduces overall costs and improves the quality
and quantity of products. It Increases the control over production, leading
to improved cost management and waste reduction. It eliminates the risk
of losing yields by tracing anomalies in crop growth.
28
4.2 LIMITATIONS
Crop Health: The System does not monitor the health of the
crops and the nutrients in the soil.
29
4.3 SCOPE OF INNOVATIONS
The provided system is very extensible and hence can be easily supplemented
with other functionalities some of the possible enhancements are as follows:
Crop Data: Improvements to the current system can allow the user to
monitor the rate of growth of the crop, the current stage of crop life
cycle, estimated time for harvest, etc.
30
APPENDICES
Appendix – 1
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <OneWire.h>
#include <DallasTemperature.h>
const int trigPin = D4; // Pin connected to the trigger pin of HC-SR04
const int echoPin = D5; // Pin connected to the echo pin of HC-SR04
OneWire oneWire(temperatureSensorPin);
DallasTemperature sensors(&oneWire);
void setup() {
pinMode(pumpPin, OUTPUT);
digitalWrite(pumpPin, LOW); // Ensure pump is initially off
31
pinMode(echoPin, INPUT);
Serial.begin(9600);
sensors.begin(); // Initialize temperature sensor
if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
Serial.println(F("SSD1306 allocation failed"));
for (;;);
}
display.display();
delay(2000);
display.clearDisplay();
}
void loop() {
display.setCursor(0, 20);
display.print("Rain Status : ");
if (rain_state == HIGH){
display.println("\n < No rainfall >");
} else {
display.println("\n < rainy >");
}
32
// Display tank water level
float duration, distance, percentage;
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);
distance = duration * 0.034 / 2;
if (distance <= tankHeight) {
percentage = ((tankHeight - distance) / tankHeight) * 100.0;
} else {
percentage = 0.0; // Tank is empty
}
display.setCursor(0, 40);
display.print("Water Level = ");
display.print(percentage);
display.println("%");
display.display();
33
// Display sensor readings on Serial Monitor
Serial.print("Soil Moisture = ");
Serial.print(moisturePercent);
Serial.println("%");
Serial.print("Water Level = ");
Serial.print(percentage);
Serial.println("%");
Serial.print("Temperature = ");
Serial.print(temperatureC);
Serial.println("C");
34
Appendix – 2
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
ESP8266WebServer server(80);
String rain_status = "NO RAIN"; // Initialize rain status
void readSensorValues() {
// Read soil moisture value
int soilMoistureValue = analogRead(soilMoisturePin);
moisturePercentGlobal = map(soilMoistureValue, airValue, waterValue, 0, 100);
35
void handleRoot() {
Serial.println(waterLevelGlobal);
String page = "<html><head><title>SMART AGRICULTURE</title>";
page += "<style>body { font-family: Arial, sans-serif; margin: 20px; background-color:
#f2f2f2; }";
page += "h1 { text-align: center; } .sensor-container { border: 2px solid #ccc; padding:
20px; ";
page += "border-radius: 10px; margin-bottom: 20px; background-color: #fff; box-shadow: 0
4px 8px 0 rgba(0, 0, 0, 0.2); }";
page += ".sensor-container p { margin-bottom: 10px; } .status { color: green; font-weight:
bold; }";
page += ".status.rainy { color: red; } .reading { font-size: 20px; } .meter { width: 100px;
height: 100px; ";
page += "border-radius: 50%; background: conic-gradient(#4caf50 0% " +
String(moisturePercentGlobal) + "%, #f0f0f0 " + String(moisturePercentGlobal) + "%
100%);";
page += "border: 5px solid #ccc; margin: 0 auto; position: relative; } .meter:after { content:
''; position: absolute;";
page += "top: 50%; left: 50%; transform: translate(-50%, -50%); width: 90px; height: 90px;
border-radius: 50%; background-color: #fff; }";
page += ".meter-value { position: absolute; top: 50%; left: 0; transform: translate(0, -50%);
width: 100%; text-align: center; ";
page += "font-size: 18px; color: #333; }</style><script>function updateMeters() {";
page += "var meters = document.getElementsByClassName('meter');";
page += "for (var i = 0; i < meters.length; i++) {";
page += "var meter = meters[i];";
page += "var reading = meter.dataset.reading;";
page += "var percentage = parseFloat(reading);";
page += "var meterValue = meter.querySelector('.meter-value');";
page += "meter.style.background = 'conic-gradient(#4caf50 0% ' + percentage + '%, #f0f0f0
' + percentage + '% 100%)';";
page += "meterValue.textContent = reading + '%'; } } setInterval(updateMeters,
200);</script></head><body>";
page += "<h1>Sensor Readings</h1>";
page += "<div class='sensor-container'>";
page += "<p><span class='reading'><strong>Soil Moisture:</strong></span> <span
class='reading'>" + String(moisturePercentGlobal) + "%</span></p>";
page += "<div class='meter' data-reading='" + String(moisturePercentGlobal) + "'><div
class='meter-value'>" + String(moisturePercentGlobal) + "%</div></div>";
page += "<p><span class='reading'><strong>Rain Status:</strong></span> <span
class='status reading'>";
page += rainStatusGlobal + "</span></p>";
page += "<p><span class='reading'><strong>Water Level:</strong></span> <span
class='reading'>" + String(waterLevelGlobal) + "%</span></p>";
page += "<div class='meter' data-reading='" + String(waterLevelGlobal) + "'><div
class='meter-value'>" + String(waterLevelGlobal) + "%</div></div>";
page += "<p><span class='reading'><strong>Temperature:</strong></span> <span
class='reading'>" + String(temperatureCGlobal) + "C</span></p>";
page += "<div class='meter' data-reading='" + String(temperatureCGlobal) + "'><div
class='meter-value'>" + String(temperatureCGlobal) + "C</div></div>";
36
page += "</div></body></html>";
server.send(200, "text/html", page);
}
void setup(){
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.println("Connecting to WiFi...");
}
Serial.println("Connected to WiFi");
server.on("/", handleRoot);
server.begin();
Serial.println("HTTP server started");
Serial.println(WiFi.localIP());
}
void loop(){
readSensorValues();
server.handleClient();
37
REFERENCE
23 Sensors for Arduino: Uses, Costs and How to Connect – Chip Wired
38