Welcome to the Vertical Farm System project! This system integrates Express.js, EJS, Mongoose, Arduino, and ESP32 Camera to create an efficient and user-friendly vertical farming solution. The system allows for real-time monitoring and control of multiple farms via a web interface, making it scalable and adaptable for various users.
- Real-time monitoring of sensor data from multiple farms.
- Control of water and fan systems based on sensor data.
- ESP32 Camera integration for visual monitoring.
- Dynamic addition of new farms to the system.
- Data visualization with graphs for sensor values and pie charts for plant types.
- Configurable farm settings through a web interface.
- ESP32 Camera: Captures real-time images and streams them to the web server.
- Arduino: Handles sensor data collection and relays control commands.
- Express.js: Serves the web application and handles API requests.
- EJS: Templating engine for rendering dynamic web pages.
- Mongoose: Manages MongoDB database interactions.
- MongoDB: Stores farm data, sensor values, and configuration settings.
To set up the Vertical Farm System, follow these steps:
-
Clone the Repository
git clone https://github.com/AlexSteiner/vertical-farm.git cd vertical-farm/Server
-
Install Dependencies
npm install mongoose ping body-parser express dotenv
-
Configure MongoDB Ensure MongoDB is installed and running on your machine or use a cloud MongoDB service. Update the connection string in
Server/.env
underMONGO_URI
. -
Sketch The following table provides a detailed list of sensors and components needed for our project. It includes the name of each sensor, the quantity required, and convenient links to purchase each item. This ensures you have all the necessary parts to complete the project.
Name of Sensor Amount Price Purchase Link Air Temperature and Humidity Sensor (DHT11) 1 €5.90 Buy Here Soil Humidity Sensor 2 €5.98 Buy Here Relay 2 €8.49 Buy Here ESP32 Camera 1 €11.92 Buy Here FTDI Programmer 1 €5.59 Buy Here Arduino Uno R3 1 €27.99 Buy Here DC Motor 2 €9.98 Buy Here 9V Batteries 3 €12.95 Buy Here Light Sensor (BH1750) 1 €8.99 Buy Here Jumper Wire Cables 1 €9.15 Buy Here The total price is
€106.94
. Below is the sketch of the system setup. This diagram shows how each component is connected to the Arduino Uno and powered by the 9V batteries. -
Install Arduino Libraries
- In your Arduino IDE, go to File> Preferences
- Enter the following into the “Additional Board Manager URLs” field:
https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
Then, click the “OK” button. - Open the Boards Manager. Go to Tools > Board > Boards Manager…
- Search for ESP32 and press the install button for the “ESP32 by Espressif Systems“ version 2.0.5
- It should be installed after a few seconds.
- Download the ESPAsyncWebServer and AsyncTCP libraries
- iI your Arduino IDE, go to Sketch > Include Library > Add .zip Library and select the libraries you’ve just downloaded
-
Upload Code to ESP32 and Arduino
- Navigate to the
VerticalFarm/
directory, and upload theVerticalFarm.ino
file to your Arduino UNO. - Navigate to the
CameraWebServer/
directory and open theCameraWebServer.ino
file. - Change the
password
andpassword
to your WiFi credentials, - Substitute
serverName
andport
with the details of your server - Go to Tools > Board and select AI-Thinker ESP32-CAM
- Go to Tools > Port and select the COM port the ESP32-CAM is connected to.
- Then, click the Upload button in your Arduino IDE.
- When you start to see some dots on the debugging window, press the ESP32-CAM on-board RST button.
- After a few seconds, the code should be successfully uploaded to your board.
- When you see the “Done uploading” message, you need to remove
GPIO 0
fromGND
and press the RST button to run your new code. - Conncect the
RX
andTX
pins of the Arduino Uno with respectfully theTX
andRX
pins of the FTDI Programmer
- Navigate to the
- Network Configuration
- Ensure your ESP32 and Arduino are connected to the same network as the web server.
- If required, configure port forwarding for external access the server exertanlly.
-
Start the Server
node server.js
-
Access the Web Interface
- Open your browser and navigate to
http://localhost:4000
(or the configured port). - The index page displays active farms, power usage, recent activities, and sensor data graphs.
- Open your browser and navigate to
-
Manage Farms
- Use the sidebar to navigate between different farms.
- Each farm page displays real-time sensor values, camera feed, and control options for the water and fan systems.
- Modify farm settings using the provided forms and save changes to update the database and devices in real time.
- ESP32 Camera Not Accessible: Ensure the camera is connected to the same network and check port forwarding settings if accessing externally.
- Sensor Data Not Updating: Verify connections between the Arduino and sensors, and ensure the web server is running.
- Database Connection Issues: Check MongoDB service status and ensure the connection string in
Server/.env
underMONGO_URI
. is correct.
- Implement authentication and user roles for better security.
- Add more sensor types and expand the control features.
- Enhance the user interface with more detailed analytics and visualizations.
- Improve scalability to handle a larger number of farms and sensors.
This Vertical Farm System provides a comprehensive solution for managing and monitoring vertical farms. With real-time data, camera integration, and dynamic control features, it aims to make farming more efficient and accessible. For any questions or contributions, please refer to the GitHub repository or contact the project maintainer.
Thank you for using the Vertical Farm System. Happy farming!
Kind Regards, Alex Steiner