{"id":23697004,"url":"https://github.com/sabermahjoub/smartgarden","last_synced_at":"2026-02-17T13:02:58.538Z","repository":{"id":268138643,"uuid":"873002996","full_name":"Sabermahjoub/SmartGarden","owner":"Sabermahjoub","description":"IoT project for a smart garden featuring a web application (Angular + Flask) and leveraging ML/DL algorithms.","archived":false,"fork":false,"pushed_at":"2024-12-14T16:32:58.000Z","size":70676,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-11T13:11:29.564Z","etag":null,"topics":["angular","esp32","flask","iot","ml","plant-monitoring","smartgarden","web"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","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/Sabermahjoub.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-10-15T12:50:52.000Z","updated_at":"2024-12-14T16:33:02.000Z","dependencies_parsed_at":null,"dependency_job_id":"f907f4cd-23a8-47b5-bf7b-7fc709b36e7d","html_url":"https://github.com/Sabermahjoub/SmartGarden","commit_stats":null,"previous_names":["sabermahjoub/smartgarden"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Sabermahjoub/SmartGarden","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sabermahjoub%2FSmartGarden","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sabermahjoub%2FSmartGarden/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sabermahjoub%2FSmartGarden/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sabermahjoub%2FSmartGarden/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Sabermahjoub","download_url":"https://codeload.github.com/Sabermahjoub/SmartGarden/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sabermahjoub%2FSmartGarden/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29545295,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-17T13:00:00.370Z","status":"ssl_error","status_checked_at":"2026-02-17T12:57:14.072Z","response_time":100,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["angular","esp32","flask","iot","ml","plant-monitoring","smartgarden","web"],"created_at":"2024-12-30T06:27:31.345Z","updated_at":"2026-02-17T13:02:58.515Z","avatar_url":"https://github.com/Sabermahjoub.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ✨ IoT Project with Angular 13, Flask, MQTT, and ML/DL Algorithms\n\nSee the app demo ? Consult this link : https://drive.google.com/file/d/1Utyq1ixwL_11p-BXn7cv6J7kePKY8KZW/view?usp=drive_link\n\nNote : To be able to to extract : wind speed, lowest and highest temperature of the day, UV index, you should create an account at : weather.visualcrossing.com\nAnd use your own key : \n```bash\nprivate weatherUrl = \"https://weather.visualcrossing.com/VisualCrossingWebServices/rest/services/timeline/YOURCITY?key=YOURKEY\";\n```\n\nHardware setup :\n\n![screenshot](Demo_images/hardware_setup.jpg)\n\n## Table of Contents\n1. [Project Overview](#project-overview)\n2. [Technology Stack](#technology-stack)\n3. [Features](#features)\n4. [Architecture](#architecture)\n5. [Installation and Setup](#installation-and-setup)\n6. [Project Structure](#project-structure)\n7. [Usage](#usage)\n8. [MQTT Configuration](#mqtt-configuration)\n9. [ML/DL Algorithms](#ml-dl-algorithms)\n10. [API Endpoints](#api-endpoints)\n11. [Testing](#testing)\n12. [Contributing](#contributing)\n13. [License](#license)\n\n---\n\n## Project Overview\nThis project is an IoT-based system that integrates real-time sensor data, machine learning, and deep learning algorithms. The front end is developed using **Angular 13**, while the backend uses **Flask**. Communication between IoT devices and the server happens via the **MQTT protocol**. Data processing and analysis leverage **ML/DL algorithms** to deliver intelligent insights.\n\n### Key Goals\n- Real-time sensor data collection and visualization.\n- Efficient communication using MQTT.\n- Backend support for data processing and machine learning.\n- Web-based interface for data interaction and insights visualization.\n\n---\n\n### Key App functionalities\n- Get sensors and external api data and inform farmer of the potential risks for the plant.\n- Managing list of plants.\n- Managing daily tasks.\n- Inform farmer of possible storm for the next hour to come.\n- Managing logs.\n- Predicting health of plant.\n\n---\n\n## Technology Stack\n### Frontend\n- **Framework**: Angular 13\n- **UI Library**: Angular Material / TailWind\n\n### Backend\n- **Web Framework**: Flask\n- **Protocol**: MQTT (via `paho-mqtt` library)\n- **Data Processing**: Pandas, NumPy\n- **ML/DL**: Scikit-learn, TensorFlow/Keras\n- **Database**: MYSQL \n\n### IoT Communication\n- **Protocol**: MQTT\n- **MQTT Configuration**: HiveMQ broker\n\n---\n\n## Features\n- Real-time sensor data acquisition via MQTT.\n- Dynamic dashboards to visualize sensor data.\n- Machine learning models to process and analyze incoming data.\n- RESTful APIs for backend communication and plant/tasks management\n- Notifications/alerts based on intelligent thresholds.\n- Deep learning algorithms for anomaly detection or prediction.\n\n---\n\nWhen a moderate risk of storm is predicted : \n![screenshot](Demo_images/Moderate_Storm_Risk.PNG)\n\nWhen a moderate risk of storm is predicted : \n![screenshot](Demo_images/High_Storm_Risk.PNG)\n\n## Architecture\n```\n                +-------------------------------+\n                |       IoT Devices            |\n                |    (Sensors/Actuators)       |\n                +---------------+---------------+\n                                |\n                                | MQTT\n                                v\n                +-------------------------------+\n                |           Flask Backend       |\n                |  - MQTT Broker Integration   |\n                |  - Data Preprocessing        |\n                |  - ML/DL Processing          |\n                +---------------+---------------+\n                                |\n                                | REST APIs\n                                v\n                +-------------------------------+\n                |         Angular Frontend      |\n                |  - Real-time Dashboards      |\n                |  - Visualizations/Controls   |\n                +-------------------------------+\n```\n\n---\n\n## Installation and Setup\n\n### Prerequisites\nEnsure the following tools are installed on your system:\n- Node.js (v14+)\n- Angular CLI (v13)\n- Python (v3.8+)\n- MQTT Broker (e.g., HiveMQ)\n- Virtualenv (recommended for Python)\n\n### Frontend Setup (Angular)\n```bash\n# Clone the repository\ngit clone https://github.com/Sabermahjoub/SmartGarden.git\ncd SmartGarden/Smart-Garden-front\n\n# Install dependencies\nnpm install\n\n# Start the development server\nng serve\n\n# Open http://localhost:4200 in your browser\n```\n\n### Backend Setup (Flask)\n```bash\n# Navigate to the backend folder\ncd ../backend\n\n# Start the Flask server\npython app.py\n\n# API will be available at http://127.0.0.1:5000\n```\n\n### MQTT Broker Setup\n1. Install **HiveMQ** MQTT broker.\n2. Start the HiveMQ server with the default configuration.\n3. Use the broker's URL (e.g., `mqtt://localhost`) for testing.\n\n---\n\n## Project Structure\n```plaintext\nSmartGarden/\n├── Smart-Garden-front/      # Angular 13 Frontend\n│   ├── src/\n│   ├── angular.json\n│   └── package.json\n│\n├── backend/                 # Flask Backend\n│   ├── DL__ClassificationImage.ipynb   # DL model\n│   ├── PlantVillage/   # DL classification dataset\n│   ├── ML_prediction.ipynb             # ML model\n│   ├── plant_growth_data.csv           # ML dataset\n│   ├── background_job.py       # MQTT configuration\n│   ├── smartgarden.sql       # DB configuration\n│   ├── esp32.py       # hardware configuration\n│   ├── app.py               # Main Flask application\n│\n└── README.md                # Project documentation\n```\n\n---\n\n## Usage\n1. Start the **MQTT broker**.\n2. Run the Flask server to process incoming data and serve APIs.\n3. Launch the Angular frontend for real-time data visualization.\n\n---\n\n## MQTT Configuration\n- **Broker URL**: `mqtt://localhost` (or your MQTT server address)\n## Dependencies\nFlask and MQTT library for connecting with the broker and subscribing to messages\n```bash\n   pip install Flask paho-mqtt\n```\n\nExample MQTT Message Format:\n```json\n{\n  \"temperature\": 25.3,\n  \"humidity\": 60,\n  \"moisture\": 40, //soil moisture\n  \"light_intensity\": 50,\n  \"timestamp\": \"2024-12-14:00:00Z\"\n}\n```\n\n---\n\n## ML/DL Algorithms\nThis project incorporates the following machine learning and deep learning algorithms:\n1. **Regression**: For predictive analysis based on sensor data and external api data.\n3. **Classification Model**: For predicting health of a plant based on its leaf.\n\nPre-trained models are stored in the `backend/` directory and loaded during runtime.\n\n\n---\n\n## Testing\n### Frontend Testing\n```bash\n# Run unit tests\nng test\n\n# Run end-to-end tests\nng e2e\n```\n\n### Backend Testing\n```bash\n# Run Flask unit tests\npytest\n```\n\n---\n\n## Contributing\nContributions are welcome! Follow these steps:\n1. Fork the repository.\n2. Create a new branch: `git checkout -b feature/your-feature`.\n3. Commit your changes: `git commit -m 'Add feature XYZ'`.\n4. Push to the branch: `git push origin feature/your-feature`.\n5. Submit a pull request.\n\n---\n\n## License\nThis project is licensed under the MIT License. See the LICENSE file for more details.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsabermahjoub%2Fsmartgarden","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsabermahjoub%2Fsmartgarden","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsabermahjoub%2Fsmartgarden/lists"}