This project aims to automate various agricultural processes to create a self-sustaining environment. It controls devices like UV lights, water pumps, air pumps, and fans based on real-time environmental conditions and predefined time schedules. The system uses sensors to monitor temperature, humidity, water levels, light intensity, and vibrations to make informed decisions.
Automatic Control: Automatically manages actuators based on sensor data and time.
Manual Override: Allows manual control of devices via serial commands.
Real-Time Monitoring: Displays current time, temperature, humidity, and water levels on an OLED screen.
Modular Design: Organized into separate modules for better maintainability and scalability.
Arduino Board
DHT11 Temperature and Humidity Sensor
LDR Sensor (Light-Dependent Resistor)
Vibration Sensor
Water Level Sensor
UV Light
Air Pump
Fan
Water Pump
RTC Module (DS3231)
OLED Display (SSD1306)
Arduino.h
Wire.h
SPI.h
Adafruit_GFX.h
Adafruit_SSD1306.h
RTClib.h
dht.h
main.cpp: Main program that initializes hardware and runs the control loop.
hardware.h / hardware.cpp: Manages hardware initialization and actuator control.
sensors.h / sensors.cpp: Handles sensor data acquisition.
constants.h: Contains configuration constants and pin definitions.
Arduino IDE installed on your computer.
Required Arduino libraries installed:
Adafruit GFX Library
Adafruit SSD1306 Library
RTClib
DHT Sensor Library
Clone or download the repository to your local machine.
Open the project in the Arduino IDE.
Ensure all the hardware components are connected to the correct pins as defined in constants.h.
Compile and upload the code to your Arduino board.
By default, the system operates in automatic mode, controlling all devices based on sensor readings and time schedules.
You can manually control the devices using serial commands sent via the Arduino IDE's Serial Monitor or any serial terminal.
Serial Commands
A or a: Toggle automatic control mode.
B or b: Toggle UV light.
C or c: Toggle air pump.
D or d: Toggle fan.
E or e: Toggle water motor.
Defines all the pin configurations and constant values used throughout the project. This makes it easy to change hardware connections or configuration settings from a single file.
Contains functions responsible for initializing hardware components and controlling actuators like the UV light, air pump, fan, and water motor based on sensor readings and time schedules.
Manages all sensor readings, including temperature, humidity, water level, LDR value, and vibration value. Provides getter functions to access these readings from other modules.
The entry point of the program. It initializes the system and contains the main control loop. The loop reads sensor data, updates actuator statuses, handles serial input for manual control, and updates the OLED display.