diff --git a/README.MD b/README.MD index eb950d4..744b242 100644 --- a/README.MD +++ b/README.MD @@ -1,31 +1,28 @@ -Here’s a README documentation tailored to your GitLab project: - ---- - # IoT Smart Farming System -This repository contains the code for an IoT-based smart farming system. The project uses sensors to monitor environmental conditions and communicates via MQTT for real-time data transmission and control. +This repository contains the code for an IoT-based smart farming system. It integrates multiple sensors for environmental monitoring and uses MQTT for real-time communication, facilitated by the **CloudAMQ** provider. ## Overview -The system utilizes the ESP32 microcontroller to collect data from the following sensors: +The system employs an **ESP32** microcontroller to gather data from the following sensors: - **BH1750**: Measures light intensity. - **DHT11**: Measures temperature and humidity. - **Two NPK sensors**: Measure soil nutrient levels (Nitrogen, Phosphorus, and Potassium). -The system supports MQTT communication with three data publishing topics and six control subscribing topics. +An **LCD display** is used to visualize data locally, where the right bottom corner shows the number of connected sensors. ## Code Structure -The project includes six files, with the final and most updated version being: -- **Mfarming_read_rev8**: The final version of the code. Use this file for deployment to the ESP32. +This project includes six files, with the final and most updated version being: +- **Mfarming_read_rev8**: The final version of the code. This is the file to flash onto your ESP32 device for deployment. ## Features -- **Light Intensity Monitoring**: Publishes data from the BH1750 sensor. -- **Temperature and Humidity Monitoring**: Publishes data from the DHT11 sensor. -- **Soil Nutrient Monitoring**: Publishes data from two NPK sensors. -- **Relay Control**: Supports controlling devices like irrigation systems and lights through MQTT topics. +- **Light Intensity Monitoring**: Data from the BH1750 sensor is published via MQTT. +- **Temperature and Humidity Monitoring**: Data from the DHT11 sensor is published via MQTT. +- **Soil Nutrient Monitoring**: Data from the two NPK sensors is published via MQTT. +- **Relay Control**: MQTT subscriptions enable controlling external devices like irrigation systems and lighting through defined topics. +- **LCD Display**: The LCD shows sensor data, and the number of sensors is displayed in the right bottom corner. ## MQTT Topics @@ -42,98 +39,17 @@ The project includes six files, with the final and most updated version being: - **relay5**: Controls the second relay. - **relay6**: Controls the second relay. -## Hardware Requirements -- **Microcontroller**: ESP32 -- **Sensors**: - - BH1750 for light - - DHT11 for temperature and humidity - - Two NPK sensors -- **Relays**: For controlling external devices -- **LCD**: For display the result +## CloudAMQ Configuration -## Getting Started - -1. **Clone the Repository**: - ```bash - git clone - ``` - -2. **Use the Final Code**: - The `Mfarming_read_rev8` file is the final version of the code. Flash this file to your ESP32 device. - -3. **Set Up MQTT**: - Configure your ESP32 to connect to your MQTT broker by entering the broker’s details (IP address, port, username, and password) in the code. - -4. **Run the System**: - Once the ESP32 is running, sensor data will be automatically published to the corresponding MQTT topics, and you can control the relays via the subscribe topics. - -## Dependencies - -- **ESP32** board and development environment -- Required Libraries: - - **Adafruit_BH1750** for light sensor - - **DHT sensor library** for temperature and humidity - - **ModbusMaster** for NPK sensor communication - - **PubSubClient** for MQTT communication - -## Future Enhancements - -- Additional MQTT topics for more device control (e.g., `relay3`, `relay4`). -- Expansion to other sensors or automation systems. - -## License - -This project is licensed under the MIT License. - ---- - -This documentation gives a clear structure and guides users through the setup and use of the project, with a focus on the final `Mfarming_read_rev8` file. You can adjust the repository URL and further customize the instructions as needed.Here’s a README documentation tailored to your GitLab project: - ---- - -# IoT Smart Farming System - -This repository contains the code for an IoT-based smart farming system. The project uses sensors to monitor environmental conditions and communicates via MQTT for real-time data transmission and control. - -## Overview - -The system utilizes the ESP32 microcontroller to collect data from the following sensors: -- **BH1750**: Measures light intensity. -- **DHT11**: Measures temperature and humidity. -- **Two NPK sensors**: Measure soil nutrient levels (Nitrogen, Phosphorus, and Potassium). - -The system supports MQTT communication with three data publishing topics and six control subscribing topics. - -## Code Structure - -The project includes six files, with the final and most updated version being: -- **Mfarming_read_rev8**: The final version of the code. Use this file for deployment to the ESP32. - -## Features - -- **Light Intensity Monitoring**: Publishes data from the BH1750 sensor. -- **Temperature and Humidity Monitoring**: Publishes data from the DHT11 sensor. -- **Soil Nutrient Monitoring**: Publishes data from two NPK sensors. -- **Relay Control**: Supports controlling devices like irrigation systems and lights through MQTT topics. - -## MQTT Topics - -### Publish Topics (Sensor Data) -- **farm/bht**: Publishes light intensity data from the BH1750 sensor. -- **farm/npk1**: Publishes soil nutrient data from NPK sensor 1. -- **farm/npk2**: Publishes soil nutrient data from NPK sensor 2. - -### Subscribe Topics (Relay Control) -- **relay1**: Controls the first relay. -- **relay2**: Controls the second relay. -- **Future Topics**: More control topics will be added to support additional devices. +The system uses **CloudAMQ** as the MQTT broker provider. Ensure you configure your credentials (broker address, username, and password) in the code to enable MQTT communication. ## Hardware Requirements - **Microcontroller**: ESP32 - **Sensors**: - - BH1750 for light + - BH1750 for light intensity - DHT11 for temperature and humidity - - Two NPK sensors + - Two NPK sensors for soil nutrients +- **LCD Display**: For visualizing sensor data and indicating the number of sensors - **Relays**: For controlling external devices ## Getting Started @@ -143,33 +59,37 @@ The project includes six files, with the final and most updated version being: git clone ``` -2. **Use the Final Code**: - The `Mfarming_read_rev8` file is the final version of the code. Flash this file to your ESP32 device. +2. **Final Code**: + The `Mfarming_read_rev8` file is the final version of the code. Use this file to flash onto your ESP32. -3. **Set Up MQTT**: - Configure your ESP32 to connect to your MQTT broker by entering the broker’s details (IP address, port, username, and password) in the code. +3. **Configure CloudAMQ**: + Update the code with your CloudAMQ broker details (address, username, and password). -4. **Run the System**: - Once the ESP32 is running, sensor data will be automatically published to the corresponding MQTT topics, and you can control the relays via the subscribe topics. +4. **Use the LCD Display**: + The LCD will display real-time sensor data, with the sensor count visible in the bottom-right corner. + +5. **Run the System**: + Once deployed, the ESP32 will publish sensor data to the specified MQTT topics and receive commands from the subscribed relay topics. ## Dependencies -- **ESP32** board and development environment -- Required Libraries: - - **Adafruit_BH1750** for light sensor - - **DHT sensor library** for temperature and humidity +- **ESP32** board +- Libraries: + - **Adafruit_BH1750** for the BH1750 sensor + - **DHT sensor library** for the DHT11 sensor - **ModbusMaster** for NPK sensor communication - **PubSubClient** for MQTT communication + - **LiquidCrystal_I2C** for the LCD display ## Future Enhancements -- Additional MQTT topics for more device control (e.g., `relay3`, `relay4`). -- Expansion to other sensors or automation systems. +- Add additional MQTT topics for controlling more devices (e.g., `relay3`, `relay4`). +- Expansion to more sensors or automated farming systems. ## Contributing -If you'd like to contribute to this project, feel free to open issues or submit pull requests. +Contributions are welcome! Please submit any issues or pull requests to help improve the system. ## License -This project is licensed under the MIT License. +This project is licensed under the MIT License. \ No newline at end of file