initialization

This commit is contained in:
Dodit Suprianto 2024-10-15 10:13:01 +07:00
parent 4476154912
commit fcfc355380

144
README.MD
View File

@ -1,31 +1,28 @@
Heres a README documentation tailored to your GitLab project:
---
# IoT Smart Farming System # 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 ## 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. - **BH1750**: Measures light intensity.
- **DHT11**: Measures temperature and humidity. - **DHT11**: Measures temperature and humidity.
- **Two NPK sensors**: Measure soil nutrient levels (Nitrogen, Phosphorus, and Potassium). - **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 ## Code Structure
The project includes six files, with the final and most updated version being: This 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. - **Mfarming_read_rev8**: The final version of the code. This is the file to flash onto your ESP32 device for deployment.
## Features ## Features
- **Light Intensity Monitoring**: Publishes data from the BH1750 sensor. - **Light Intensity Monitoring**: Data from the BH1750 sensor is published via MQTT.
- **Temperature and Humidity Monitoring**: Publishes data from the DHT11 sensor. - **Temperature and Humidity Monitoring**: Data from the DHT11 sensor is published via MQTT.
- **Soil Nutrient Monitoring**: Publishes data from two NPK sensors. - **Soil Nutrient Monitoring**: Data from the two NPK sensors is published via MQTT.
- **Relay Control**: Supports controlling devices like irrigation systems and lights through MQTT topics. - **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 ## MQTT Topics
@ -42,98 +39,17 @@ The project includes six files, with the final and most updated version being:
- **relay5**: Controls the second relay. - **relay5**: Controls the second relay.
- **relay6**: Controls the second relay. - **relay6**: Controls the second relay.
## Hardware Requirements ## CloudAMQ Configuration
- **Microcontroller**: ESP32
- **Sensors**:
- BH1750 for light
- DHT11 for temperature and humidity
- Two NPK sensors
- **Relays**: For controlling external devices
- **LCD**: For display the result
## Getting Started 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.
1. **Clone the Repository**:
```bash
git clone <repository-url>
```
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 brokers 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.Heres 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.
## Hardware Requirements ## Hardware Requirements
- **Microcontroller**: ESP32 - **Microcontroller**: ESP32
- **Sensors**: - **Sensors**:
- BH1750 for light - BH1750 for light intensity
- DHT11 for temperature and humidity - 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 - **Relays**: For controlling external devices
## Getting Started ## Getting Started
@ -143,32 +59,36 @@ The project includes six files, with the final and most updated version being:
git clone <repository-url> git clone <repository-url>
``` ```
2. **Use the Final Code**: 2. **Final Code**:
The `Mfarming_read_rev8` file is the final version of the code. Flash this file to your ESP32 device. The `Mfarming_read_rev8` file is the final version of the code. Use this file to flash onto your ESP32.
3. **Set Up MQTT**: 3. **Configure CloudAMQ**:
Configure your ESP32 to connect to your MQTT broker by entering the brokers details (IP address, port, username, and password) in the code. Update the code with your CloudAMQ broker details (address, username, and password).
4. **Run the System**: 4. **Use the LCD Display**:
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. 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 ## Dependencies
- **ESP32** board and development environment - **ESP32** board
- Required Libraries: - Libraries:
- **Adafruit_BH1750** for light sensor - **Adafruit_BH1750** for the BH1750 sensor
- **DHT sensor library** for temperature and humidity - **DHT sensor library** for the DHT11 sensor
- **ModbusMaster** for NPK sensor communication - **ModbusMaster** for NPK sensor communication
- **PubSubClient** for MQTT communication - **PubSubClient** for MQTT communication
- **LiquidCrystal_I2C** for the LCD display
## Future Enhancements ## Future Enhancements
- Additional MQTT topics for more device control (e.g., `relay3`, `relay4`). - Add additional MQTT topics for controlling more devices (e.g., `relay3`, `relay4`).
- Expansion to other sensors or automation systems. - Expansion to more sensors or automated farming systems.
## Contributing ## 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 ## License