The hardware is tasked with the remote control of the colour spectrum (frequency of light), the number of activated LEDs, and the brightness of the lighting within the Hydroponics system. To monitor the farm environment, the hardware employs a DHT22 temperature and humidity sensor. The heat index must be calculated based on the sensor's data. The collected sensor data must be published to a topic subscribed to by both the backend and frontend segments of the system. Furthermore, the hardware must process and execute actions in response to messages published to the topics to which it is subscribed. This comprehensive functionality ensures seamless control, monitoring, and responsiveness within the hydroponic cultivation environment.
The backend is tasked with storing data, published by the hardware, in the database following the schema specified in the hardware specifications. Additionally, it is responsible for making the stored data in the database accessible to the frontend through API routes.
The frontend plays a pivotal role in delivering three distinct user interfaces. These interfaces encompass controls for managing the system's lighting, real-time visualization of data generated by the environmental monitoring sensors, and the ability to visualize as well as perform statistical analysis on the data stored in the database. This multifaceted approach ensures a comprehensive and user-friendly experience, empowering users to efficiently interact with and derive insights from the hydroponics system.
Download and install Arduino IDE if you haven't already done so. Subsequently, install the following Arduino IDE libraries if they are not currently installed, following the tutorial here:
- FastLED by Daniel Garcia
- esp32 by Espressif Systems, from the Board Manager tab in the Arduino IDE
- ArduinoJson by Benoît Blanchon
- PubSubClient by Nick O’Leary
- DHT sensor library by Adafruit
Always ensure to establish a virtual environment and install the necessary packages from your requirements file if you haven't already done so. Following that, activate your virtual environment and proceed to run your Flask API.
The commands below must executed from a command line terminal in the hydromonitor/backend/ folder
Windows
python -m venv env Linux
python3 -m venv env Windows
.\env\Scripts\activate Linux
source env/bin/activatepip install -r requirements.txt Create a .env file in the backend/ folder to store the application's environment variables. Refer to the lab manual for the specific information that must be added to this file.
Windows
py run.py Linux
python3 run.pyVSCode + Volar (and disable Vetur) + TypeScript Vue Plugin (Volar).
Customize configuration See Vite Configuration Reference.
In a command line terminal, execute the first commands in the hydromonitor/frontend/ folder to initiate the dev server for the initial setup.
Once development is complete, run the final command to generate production files. Please be aware that the generation of production files is not part of this course.
Project Setup
npm installRun dev server (Compile and Hot-Reload for Development)
npm run devCreate a production bundle (Compile and Minify for Production)
npm run build