IoT Based Smart Gardening and Smart Agriculture Using ESP32

Introduction: IoT Based Smart Gardening and Smart Agriculture Using ESP32

About: i am electronic Hobbyist. I like to make the things and also make it available to people who need it. Please visit and subscribe my youtube channel for more Embedded related videos. https://www.youtube.com/c...

World is changing as time and so agriculture.
Nowadays, People are integrating electronics in every field and agriculture is not exception for this. This merging of electronics in agriculture is helping farmers and people who manages gardens.

In this article we will see how to monitor and how to manage gardening and agriculture. We will use (ESP32) controlling module for IoT and we will update the data on cloud and based on readings we will take the appropriate action.

In this project we have used sensors like LDR(Light depedent Resistor), Temperature sensor, Soil Moisture level sensor and we will use water pump to react on the sensors data. Apart from this we can use lots of sensors to monitor.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Required Components

Below are the required components,

ESP32
ESP32 in India - https://amzn.to/2NpbsE2

ESP32 in UK - https://amzn.to/34g0SWX

ESP32 in USA - https://amzn.to/34g0SWX

Soil Moisture Sensor
Soil Moisture Sensor in India- https://amzn.to/2PyAi7l

Soil Moisture Sensor in UK - https://amzn.to/2PyAi7l

Soil Moisture Sensor in USA - https://amzn.to/2PyAi7l

NTC Temperature Sensor
NTC Temperature Sensor in India- https://amzn.to/34f87hD

NTC Temperature Sensor in UK - https://amzn.to/34hVSkt

NTC Temperature Sensor in USA - https://amzn.to/34hVSkt

LDR Sensor

LDR Sensor in India - https://amzn.to/32XcePf

LDR Sensor in UK - https://amzn.to/32XcePf

LDR Sensor in USA - https://amzn.to/32XcePf

DC Water Pump +5v
DC Water Pump +5v in India - https://amzn.to/2qZavuI

DC Water Pump +5v in UK - https://amzn.to/3359PC0

DC Water Pump +5v in USA - https://amzn.to/3359PC0

BreadBoard
BreadBoard in India- https://amzn.to/2MW0Opb

BreadBoard in USA- https://amzn.to/32WZZSV

BreadBoard in UK- https://amzn.to/32WZZSV


Transistor

Resistors

Few Wires

Step 2: Working Principle

ESP32 controlling module is used for gathering the data from sensors like LDR(Light depedent Resistor), Temparature sensor, Soil Moisture level sensor. If the soil moisture level is very low then we will turn ON the water Pump. We are monitoring the motor status as well for the feedback to confirm the motor status.

We are using temparature sensor to regulate the water on crop's root which will keep the crop fresh. ESP32 is gathering the data from all sensors and sending/publishing all the data to MQTT server and subscribing for the motor control topic.

Step 3: Projects Pics

Step 4: Code Explaination:

And from the mqtt server or other node (from where we are observing or controlling motor). In our case we are using mobile as node and we have subscribe for the following topic.


Topics to subscribe from controlling node (mobile) and ESP32 will publish for the topic

stechiez/agree/light

stechiez/agree/temp

stechiez/agree/soil

stechiez/agree/mstatus

Publish the topic from controlling node and ESP32 will subscribe for the topic

stechiez/agree/motor

In the setup_wifi function we are connecting to wifi and control will be stop there till wifi connection.

In the reconnect function ESP32 will try to connect to MQTT server and wait till connection.

callback is the function which will get invoke or will get execute once subscribed topic is available.

In the setup function we are initilizing Serial communication, Wifi connection and MQTT connection.

getTemperature,getMoisturePercentage and getLightPercentage function is reading the data from sensor and returning the value which has to publish over MQTT.

And in the loop function which gets executed continously, ESP32 will send the collected data over mqtt.

Step 5: Schematic

Step 6: Code

Step 7: Tutorial

Be the First to Share

    Recommendations

    • Magnets Challenge

      Magnets Challenge
    • Raspberry Pi Contest 2020

      Raspberry Pi Contest 2020
    • Wearables Contest

      Wearables Contest

    Discussions