Skip to content

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.

Notifications You must be signed in to change notification settings

AlexSteiner30/Vertical-Farm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Vertical Farm System - README

Introduction

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.

Table of Contents

  1. Features
  2. System Architecture
  3. Installation
  4. Configuration
  5. Usage
  6. Troubleshooting
  7. Future Improvements

Features

  • 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.

System Architecture

  1. ESP32 Camera: Captures real-time images and streams them to the web server.
  2. Arduino: Handles sensor data collection and relays control commands.
  3. Express.js: Serves the web application and handles API requests.
  4. EJS: Templating engine for rendering dynamic web pages.
  5. Mongoose: Manages MongoDB database interactions.
  6. MongoDB: Stores farm data, sensor values, and configuration settings.

Installation

To set up the Vertical Farm System, follow these steps:

  1. Clone the Repository

    git clone https://github.com/AlexSteiner/vertical-farm.git
    cd vertical-farm/Server
  2. Install Dependencies

    npm install mongoose ping body-parser express  dotenv
  3. Configure MongoDB Ensure MongoDB is installed and running on your machine or use a cloud MongoDB service. Update the connection string in Server/.env under MONGO_URI.

  4. 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.

    Sketch
  5. 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
  6. Upload Code to ESP32 and Arduino

    • Navigate to the VerticalFarm/ directory, and upload the VerticalFarm.ino file to your Arduino UNO.
    • Navigate to the CameraWebServer/ directory and open the CameraWebServer.ino file.
    • Change the password and password to your WiFi credentials,
    • Substitute serverName and port 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 from GND and press the RST button to run your new code.
    • Conncect the RX and TX pins of the Arduino Uno with respectfully the TX and RX pins of the FTDI Programmer

Configuration

  1. 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.

Usage

  1. Start the Server

    node server.js
  2. 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.
  3. 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.

Troubleshooting

  • 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 under MONGO_URI. is correct.

Future Improvements

  • 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.

Conclusion

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


Demonstration Video

Screen.Recording.mp4

About

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.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published