{"id":24382937,"url":"https://github.com/umerghafoor/precision-farming-robot","last_synced_at":"2026-02-14T05:03:44.916Z","repository":{"id":266465352,"uuid":"898424785","full_name":"umerghafoor/Precision-Farming-Robot","owner":"umerghafoor","description":"Precision Farming Robot using ESP32 for motor control and live video streaming. Controlled via MQTT and a GUI, this system aims to automate farming tasks for smart agriculture.","archived":false,"fork":false,"pushed_at":"2025-01-26T13:13:45.000Z","size":775,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-24T21:51:09.672Z","etag":null,"topics":["esp32","iot","mqtt","opencv","precision-farming","robot-control","smart-agriculture"],"latest_commit_sha":null,"homepage":"https://umerghafoor.github.io/Precision-Farming-Robot/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/umerghafoor.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-12-04T11:20:27.000Z","updated_at":"2025-01-08T00:18:02.000Z","dependencies_parsed_at":"2024-12-04T12:30:21.071Z","dependency_job_id":"de27ff12-8174-4bce-a3e5-6f0cb5489be6","html_url":"https://github.com/umerghafoor/Precision-Farming-Robot","commit_stats":null,"previous_names":["umerghafoor/precision-farming-robot"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/umerghafoor%2FPrecision-Farming-Robot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/umerghafoor%2FPrecision-Farming-Robot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/umerghafoor%2FPrecision-Farming-Robot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/umerghafoor%2FPrecision-Farming-Robot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/umerghafoor","download_url":"https://codeload.github.com/umerghafoor/Precision-Farming-Robot/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248322600,"owners_count":21084337,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["esp32","iot","mqtt","opencv","precision-farming","robot-control","smart-agriculture"],"created_at":"2025-01-19T10:10:59.179Z","updated_at":"2026-02-14T05:03:44.877Z","avatar_url":"https://github.com/umerghafoor.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Precision-Farming-Robot\n\nThis repository contains the code and instructions for controlling a precision farming robot using an **ESP32** microcontroller. The robot can be controlled via a **GUI** and **MQTT** communication for movement control, live video streaming, and servo operation. This project aims to help automate tasks like farming and environmental monitoring using robotics.\n\n## Table of Contents\n\n1. [Features](#features)\n2. [Dependencies](#dependencies)\n   - [Firmware](#firmware)\n   - [Software](#software)\n   - [Hardware](#hardware)\n3. [Setup Instructions](#setup-instructions)\n   - [Firmware Setup](#1-firmware-setup)\n   - [Software Setup](#2-software-setup)\n   - [Application Setup](#3-application-setup)\n4. [Usage](#usage)\n   - [Robot Control](#robot-control)\n   - [Video Streaming](#video-streaming)\n   - [Motor Control](#motor-control)\n   - [MQTT Commands](#mqtt-commands)\n5. [Folder Structure](#folder-structure)\n6. [License](#license)\n7. [TODO](#todo)\n\n## Features\n\n- **Robot Control**: Control the robot's movement using a GUI and MQTT-based commands.\n- **Live Video Feed**: Stream video from the robot to the control application via MQTT.\n- **Wi-Fi and MQTT Communication**: Connect the ESP32 to Wi-Fi and communicate with a broker for control and feedback.\n- **Robot Motor Control**: Control up to four motors for movement and a servo for additional movement or functionality.\n\n## Dependencies\n\n### Firmware\n\n- **ESP32 Board Support** for Arduino IDE or PlatformIO.\n- **Required Libraries**:\n  - `WiFi.h` (for Wi-Fi connectivity)\n  - `PubSubClient` (for MQTT communication)\n  - `controller.h` (for actuator control)\n  - `mqtt_broker.h` (for MQTT setup)\n\n### Software\n\n- **Python 3.x**\n- **OpenCV** (for video processing)\n- **Paho MQTT** (for MQTT communication)\n- **NumPy** (for handling video data)\n\n### Hardware\n\n- **ESP32 Development Board**\n- **DC Motors** (4 Motors for M1, M2, M3, M4)\n- **Servo Motor**\n- **Motor Driver** (L298N or similar)\n- **Power Supply** for Motors and ESP32\n- **Camera Module** (for video streaming)\n\n## Setup Instructions\n\n### 1. Firmware Setup\n\n1. **Configure Wi-Fi credentials**: Edit the `mqtt_broker.h` file to add your Wi-Fi credentials and MQTT broker details.\n2. **Upload firmware**: Upload the firmware to the ESP32 using Arduino IDE or PlatformIO.\n3. **Connect hardware**: Connect the motors, motor driver, and camera according to the pin configuration found in the `Hardware/` folder.\n\n### 2. Software Setup\n\n1. **Install Python dependencies**:\n\n   ```bash\n   pip install opencv-python paho-mqtt numpy\n   ```\n\n2. **Run the Publisher (`pub.py`)** script to start streaming video from the robot.\n\n3. **Run the Subscriber (`sub.py`)** script to view the live video stream.\n\n### 3. Application Setup\n\n1. **Install required libraries** for the GUI application:\n\n   ```bash\n   pip install PyQt6 paho-mqtt opencv-python\n   ```\n\n2. **Run the RobotCarControlApp** script to control the robot and view the video feed:\n\n   ```bash\n   python RobotCarControlApp.py\n   ```\n\n## Usage\n\n### Robot Control\n\n- Use the GUI to move the robot in four directions (up, down, left, right) and control its speed.\n- Press the **Stop** button to halt the robot.\n- Toggle the **Auto** button for autonomous control.\n\n### Video Streaming\n\n- The **Publisher** (`pub.py`) captures video from the robot’s camera and sends it to the MQTT broker.\n- The **Subscriber** (`sub.py`) receives the video stream and displays it in a window.\n\n### Motor Control\n\n- Control the robot's four motors through the GUI, using buttons for directional movement and a slider for speed control.\n\n### MQTT Commands\n\nControl the robot using the following MQTT commands.\n\n```shell\n.\\mosquitto_pub.exe -t robot/control -h \u003cBROKER_IP\u003e -m JSON_MESSAGE\n.\\mosquitto_sub.exe -t robot/control -h \u003cBROKER_IP\u003e\n```\n\n---\n\n#### 1. **Forward Movement**\n\n```json\n{\"command\": \"FORWARD\", \"speed\": 100, \"continuous\": true, \"stearAngle\": 0}\n```\n\n#### 2. **Backward Movement**\n\n```json\n{\"command\": \"BACKWARD\", \"speed\": 100, \"continuous\": true, \"stearAngle\": 0}\n```\n\n#### 3. **Rotate Left**\n\n```json\n{\"command\": \"LEFT\", \"speed\": 100, \"continuous\": true, \"stearAngle\": 0}\n```\n\n#### 4. **Rotate Right**\n\n```json\n{\"command\": \"RIGHT\", \"speed\": 100, \"continuous\": true, \"stearAngle\": 0}\n```\n\n#### 5. **Turning Forward Right**\n\n```json\n{\"command\": \"FORWARD_RIGHT\", \"speed\": 100, \"continuous\": true, \"stearAngle\": 30}\n```\n\n#### 6. **Turning Forward Left**\n\n```json\n{\"command\": \"FORWARD_LEFT\", \"speed\": 100, \"continuous\": true, \"stearAngle\": 30}\n```\n\n#### 7. **Turning Backward Left**\n\n```json\n{\"command\": \"BACKWARD_LEFT\", \"speed\": 100, \"continuous\": true, \"stearAngle\": 30}\n```\n\n#### 8. **Turning Backward Right**\n\n```json\n{\"command\": \"BACKWARD_RIGHT\", \"speed\": 100, \"continuous\": true, \"stearAngle\": 30}\n```\n\n#### 9. **Stopping the Motors**\n\n```json\n{\"command\": \"STOP\"}\n```\n\n#### 10. **Controlling the Servo**\n\n```json\n{\"command\": \"SERVO\", \"angle\": 45}\n```\n\n## Folder Structure\n\n```plaintext\n├── Application/        # GUI application for robot control and video streaming\n├── Firmware/           # ESP32 firmware for motor control and MQTT communication\n├── Hardware/           # Pin configuration and hardware setup\n├── Software/           # MQTT video streaming publisher and subscriber\n└── README.md           # This file\n```\n\n## License\n\nThis project is licensed under the **MIT License** - see the [LICENSE](LICENSE) file for details.\n\n---\n\n## TODO\n\n- [ ] Implement autonomous pathfinding using sensors (e.g., ultrasonic, IR).\n- [ ] Integrate additional sensors for environmental data (temperature, soil moisture).\n- [ ] Develop and test the robot in real-world farming environments.\n- [ ] Add features for battery monitoring and power-saving modes.\n- [ ] Create an Android or iOS app for mobile control.\n- [ ] Add advanced motor control algorithms for smoother movement.\n- [ ] Implement a camera feed streaming feature with adjustable resolution.\n- [ ] Optimize the GUI for better user experience.\n- [ ] Add unit tests for the firmware and software components.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fumerghafoor%2Fprecision-farming-robot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fumerghafoor%2Fprecision-farming-robot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fumerghafoor%2Fprecision-farming-robot/lists"}