Note
Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts.
Why Join?
Expert Support: Solve post-sale issues and technical challenges with help from our community and team.
Learn & Share: Exchange tips and tutorials to enhance your skills.
Exclusive Previews: Get early access to new product announcements and sneak peeks.
Special Discounts: Enjoy exclusive discounts on our newest products.
Festive Promotions and Giveaways: Take part in giveaways and holiday promotions.
👉 Ready to explore and create with us? Click [here] and join today!
Lesson 45: Plant Monitor
This project intelligently automates plant watering by triggering a water pump whenever the soil’s moisture level dips below a predetermined threshold. It also features an LCD display that showcases the temperature, humidity, and soil moisture levels, offering users valuable insights into the plant’s environmental conditions.
Required Components
In this project, we need the following components.
It’s definitely convenient to buy a whole kit, here’s the link:
Name |
ITEMS IN THIS KIT |
LINK |
|---|---|---|
Universal Maker Sensor Kit |
94 |
You can also buy them separately from the links below.
Component Introduction |
Purchase Link |
|---|---|
Arduino UNO R3 or R4 |
|
- |
|
- |
|
- |
|
- |
Wiring
Note
The kit may contain different versions of the DHT11 module. Please confirm the wiring method according to the module you have.
Code
Code Analysis
The code is structured to seamlessly manage plant watering by monitoring environmental parameters:
Library Inclusions and Constants/Variables:
Incorporate
Wire.h,LiquidCrystal_I2C.h, andDHT.hlibraries for functionality. Specify pin assignments and settings for the DHT11 sensor, soil moisture sensor, and water pump.setup():Configure pin modes for the moisture sensor and pump. Initially deactivate the pump. Initialize and backlight the LCD. Activate the DHT sensor.
loop():Measure humidity and temperature via the DHT sensor. Gauge soil moisture through the soil moisture sensor. Display the temperature and humidity on the LCD, then show soil moisture levels. Assess soil moisture to decide on water pump activation; if soil moisture is under 500 (adjustable threshold), run the pump for 1 second.