Skip to content

rmardonesa/GrowHub

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

4 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Logo GrowHub BSD3 License OSI

CC Logo CC BY Logo CC NC Logo CC SA Logo
The GrowHub IoT Documentation is licensed under Creative Commons CC BY-NC-SA 4.0.

GrowHub IoT Integrated System

Raspberry Pi MQTT Python Conda Flask MongoDB Firestore Linux Bash AWS GCP SQLite HTML CSS JavaScript TypeScript Arduino ESP8266 C++ JSON Pandas Plotly

GrowHub IoT System is an advanced platform for real-time monitoring and management of hydroponic crops. It captures and processes four critical variablesโ€”temperature, pH, Total Dissolved Solids (TDS), and Electrical Conductivity (EC)โ€”essential for maintaining optimal growing conditions. The system integrates data mining techniques to transform raw analog signals from sensors into structured JSON objects, ready for analysis and decision-making.

Sensor readings are dynamically processed in C++ and encapsulated into JSON objects, transmitted via MQTT every 4โ€“8 seconds. These objects undergo serialization, deserialization, cleaning, and standardization to ensure data consistency and reliability. A Python microservice, built with Flask, manages the data pipeline, storing the cleaned JSON objects into NoSQL databases hosted on AWS (Mongo) and GCP (Firebase).

GrowHub's modular architecture and real-time visualizations powered by Plotly enable farmers to monitor trends, identify issues, and optimize their operations. This seamless integration of IoT, cloud technologies, and data processing establishes GrowHub as a key tool for precision and sustainable agriculture.

Dashboard

๐Ÿš€ Features

GrowHub IoT tackles challenges in modern agriculture through its core capabilities:

๐Ÿ“Š Real-Time Data Collection GrowHub IoT monitors key hydroponic variables such as temperature, pH, TDS, and EC using high-precision sensors. These readings are processed and displayed on dynamic dashboards for actionable insights.
๐Ÿ”’ Secure Data Transmission GrowHub IoT employs MQTT for reliable data transfer. While TLS encryption is supported, the current implementation focuses on device authentication using "bcrypt" for secure access to topics.
โ˜๏ธ Cloud Integration Data is stored and managed in MongoDB (AWS) and Firestore (Google Cloud Platform), allowing scalable and redundant storage with real-time synchronization.
๐Ÿ“ˆ Interactive Visualization The system's dashboards, built with Plotly, provide intuitive, real-time charts that help users analyze trends and optimize hydroponic performance.
๐Ÿ”ง Modular Architecture Designed to scale with your needs, GrowHub IoT allows for seamless integration of new sensors and functionalities without interrupting operations.

๐Ÿงช Current Development Status

Functional = ๐ŸŸฉ Partially Functional = ๐ŸŸจ Non-Functional = ๐ŸŸฅ Future Implementations = ๐ŸŸฆ
Feature Description ๐ŸŸฉ ๐ŸŸจ ๐ŸŸฅ ๐ŸŸฆ
Real-Time Data Collection Collects sensor data in real-time ๐ŸŸฉ
Additional Sensor Types Support for more sensor types ๐ŸŸฆ
Secure Data Transmission Securely transmits data ๐ŸŸจ
TLS Encryption Adds TLS encryption for security ๐ŸŸฅ
Cloud Integration Stores data in the cloud ๐ŸŸฉ
Multi-Cloud Support Supports multiple cloud providers ๐ŸŸฅ
Interactive Visualization Real-time data visualization ๐ŸŸฉ
Advanced Analytics Provides advanced data analytics ๐ŸŸฆ
Modular Architecture Easily integrates new components ๐ŸŸจ
Automatization & Control Multi-variable control mechanization ๐ŸŸฆ

๐Ÿง  Project Context and Development Journey

GrowHub IoT is the culmination of a long and intensive journey of research, learning, and development. As a one-man army, I have single-handedly designed, implemented, and tested every aspect of this project. This public release represents a polished version derived from a private repository with over 100+ commits, reflecting countless hours of experimentation, coding, debugging, and iteration.

While many functionalities are operational, not all have been developed to the level of refinement I originally envisioned. Some features remain partially implemented due to time constraints, while others are potential ideas that I couldn't explore, such as predictive analytics through neural networks to provide recommendations for crop management. The result is a functional and modular system, but also a testament to the challenges and opportunities in working as a solo developer on a multidisciplinary project.

GrowHub is not just a software solution; it is a Research and Development (R&D) project with environmental and social goals. Throughout this process, I delved into topics far beyond software development, studying agricultural sciences and biotechnology to understand the intricacies of hydroponic systems. This learning journey included evaluating technologies that ultimately did not make it into GrowHub due to compatibility or feasibility issues. The system you see today is the outcome of this explorationโ€”a balance between ambition, technical constraints, and a commitment to creating a meaningful tool for sustainable agriculture.


Shell

๐Ÿ› ๏ธ Installation

Python Flask Bash C++ MongoDB Firestore MQTT ESP8266 Raspberry Pi JavaScript TypeScript Mosquitto SQLAlchemy paho-mqtt plotly pandas openpyxl

Requirements

Ensure the following are available for deploy:

  • We strongly recommend to use Linux machine and a Conda environment with Python 3.7 or higher.
  • Booteable MicroSD with Raspberry Pi OS (or any other 32-bit ARM Debian-based distribution, like 'Twister OS')
  • At least one ESP8266MOD compatible with Arduino IDE to flashing GrowHub firmware (more information on 'Hardware Setup' below).
  • Network infrastructure with a dedicated Access Point or a physical router acting as a switch to ensure robust MQTT communication between devices.

Steps

  1. Clone the Repository

    git clone https://github.com/rmardonesa/growhub.git
    cd growhub
  2. Set Up Virtual Environment and Install Dependencies

    python3 -m venv venv
    source venv/bin/activate
    pip install -r requirements.txt
  3. Configure Environment Variables

    cp .env.example .env
    nano .env
  4. Initialize the Database

    python init_db.py
  5. Run the Application

    python app.py

    Access the application at http://localhost:5000.

๐Ÿ’ก Advanced Configuration
To check the status of the Flask application and run it with specific options, use the following commands

View Flask Logs:

 tail -f flask.log

Run Flask:

 flask run --host=0.0.0.0 --port=5000

Database Configuration

The default SQLite database provided by the software is basic and just a template. Users can enhance its complexity after running init_db.py. For example, you can add more tables, indexes, or migrate to a more robust database system like PostgreSQL or MySQL.
Migrate to PostgreSQL:

pg_dump -U postgres -d old_db > old_db.sql
psql -U postgres -d new_db < old_db.sql

๐Ÿงฐ Hardware Setup

๐Ÿ“ก ESP8266 Sensor Configuration

  1. Open sensors.ino in Arduino IDE.
  2. Update WiFi and MQTT broker settings.
  3. Flash the ESP8266 with the updated code.
๐Ÿ“œ Sensor Calibration Details

Calibrate sensors for pH, TDS, and temperature to ensure precision.

Watch this tutorial for pH sensor calibration (most important sensor of GrowHub IoT System):

https://youtu.be/zUEl3Y3yKL4 (credits to Electronic Clinic, the video uploader)

Electronic Modules Connections

Module ESP8266MOD Pin Description
OneWire (DS18B20) GPIO2 (D4) Analog input
OneWire (DS18B20) 3.3V Power supply
OneWire (DS18B20) GND Ground
pH Sensor (Analog) A0 Analog input
3.3V Power supply
pH Sensor (Analog) GND Ground
pH Sensor (Digital) GPIO0 (D3) Digital input
pH Sensor (Digital) 3.3V Power supply
pH Sensor (Digital) GND Ground
EC/TDS Sensor (Analog) GPIO4 (D2) Analog input
EC/TDS Sensor (Analog) 3.3V Power supply
EC/TDS Sensor (Analog) GND Ground

๐Ÿ“ Raspberry Pi Configuration

  1. Install Mosquitto MQTT broker:
    sudo apt-get update
    sudo apt-get install mosquitto mosquitto-clients
  2. Configure using mqtt.sh script:
    ./mqtt.sh
๐Ÿ’ก MQTT Broker Customization

Customize the MQTT broker settings to fit your network infrastructure. You can configure the Mosquitto MQTT broker using the provided

Set up Firewall Rules:

 sudo ufw allow 5000/tcp
 sudo ufw allow 1883/tcp
 sudo ufw enable

Start Mosquitto Service:

 sudo systemctl start mosquitto

Check Mosquitto Status:

 sudo systemctl status mosquitto

View Mosquitto Logs:

 sudo journalctl -u mosquitto -f

Execute GrowHub MQTT Manager:

 sudo bash
 cd <GrowHub BashScript directory>
 ./mqtt.sh


๐Ÿ”ฎ Contributing

We welcome contributions! Follow these steps:

  1. Fork the Repository

    git checkout -b feature/your-feature
  2. Implement Your Changes

  3. Commit and Push

    git push origin feature/your-feature
  4. Open a Pull Request

๐Ÿงญ Contribution Guidelines
Rule Description
I Adhere to Coding Standards: Ensure your code follows the project's coding standards and style guidelines. Use linters and formatters where applicable.
II Document Your Changes: Update the documentation to reflect your changes. This includes comments in the code, updates to README.md, and any other relevant documentation files.
III Update CHANGELOG.md: Add a summary of your changes to the CHANGELOG.md file, including any new features, bug fixes, or breaking changes.
IV Perform Thorough Testing: Before submitting your pull request, thoroughly test your changes to ensure they work as expected and do not introduce new issues.
V Follow Commit Message Guidelines: Write clear and concise commit messages that describe the changes made. Use the imperative mood and present tense.
VI Engage in Code Reviews: Be responsive to feedback during the code review process. Address any comments or requested changes promptly and engage in constructive discussions.
VII Respect the Project's License: Ensure that your contributions comply with the project's licensing terms and do not introduce any incompatible licenses.

๐Ÿ“œ Licenses

License Creative Commons

This project is released under two licenses:

GrowHub IoT Software

๐Ÿ“• BSD 3-Clause License Copyright (c) 2024, Rodrigo Mardones
Type Description
โœ… Commercial Use This software can be used for commercial purposes.
โœ… Modification You can modify the software and create derivative works.
โœ… Distribution You can distribute the original or modified versions of the software.
โœ… Private Use You can use the software for private purposes.
โŒ Liability The authors are not liable for any damages arising from the use of the software.
โŒ Warranty The software is provided "as is", without any warranty.
โš ๏ธ Attribution You must give appropriate credit, provide a link to the license, and indicate if changes were made.

GrowHub IoT Documentation

๐Ÿ“˜ Creative Commons BY-NC-SA 4.0 CC Attribution-NonCommercial-ShareAlike 4.0 International License
Type Description
โœ… Sharing You can copy and redistribute the material in any medium or format.
โŒ Commercial Use You may not use the material for commercial purposes.
โœ… Modification You can remix, transform, or build upon the material, as long as you distribute your contributions under the same license as the original.
โš ๏ธ Attribution You must give appropriate credit, provide a link to the license, and indicate if changes were made.
โš ๏ธ No Additional Restrictions You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits.

๐ŸŽ–๏ธ Acknowledgements

This project integrates open source technologies, thanks to all developers of those tools, libraries and frameworks that make GrowHub possible

๐ŸŽ‰ Additional Credits

Special grateful with the following contributors:

Diego Salas, Digital Designer of GrowHub's logo, he did a great job!

Sometimes communication between developers and designers is not easy, but you understood my project's identity pretty well, I wish to you the best as a professional, I'm glad to have collaborated with you.

Jorge Arenas, Hydroponics Specialist, with more than 15 years of experience!

In addition to being a successful businessman, he is a promoter of clean energy, creator of jobs for people, and has maintained a social role throughout his admirable career.


๐Ÿ“š Additional Resources