Final Project - Smart Garden





This project came to me for several reasons, the first one is because my dad works growing and harvesting tomatoes in greenhouses. So the idea of doing something related to nature, with plants and more specifically in the care of these is something that caught my attention. Another reason is that currently where I live I only have one plant, and I would like to add more plants to my home :):)

This is my plant:


I decided to do this project because I live in a context where I know the importance of agriculture. I had previously thought of something similar in some subject, but it was at the beginning of my career. At that time the project was just a dream because I did not have enough knowledge to do it.

Since I study computer systems engineering, I thought of integrating something from the field. A professor recommended me to use artificial intelligence, which was a great idea. I would like to add that plus to my project by using artificial intelligence to improve the system. This way, I would only be monitoring from an interface on my cell phone.

The smart garden system is based on the integration of sensors, actuators and artificial intelligence (AI) technologies to create an optimal environment for plant growth.

Fablab calendar



Weeks Tasks
Week 1 ✓ Principles and practices, project managment
Week 2 ✓ Computer aided design
Week 3 ✓ Computer-controlled cutting
Week 4 ✓ Electronics production
Week 5 ✓ 3d scanning and printing
Week 6 ✓ Embebed programming
Week 7 ✓ Computer-controlled machining
Week 8 ✓ Electronics design
Week 9 ✓ Output devices
Week 10 ✓ Mechanical design
Week 11 ✓ Input devices
Week 12 ✓ Molding and casting

how does it work?

Sensors continuously monitor soil conditions, temperature and ambient humidity, while cameras provide a detailed view of plant development. The project integrates the use of AI, which processes the collected data to make intelligent decisions in real time. Using machine learning algorithms, the system could anticipate the plants' needs and autonomously control irrigation, lighting and other parameters.

What are the benefits of this project?

  • The automation of irrigation and smart management of environmental conditions not only optimizes plant growth but also contributes to water conservation and energy efficiency.
  • Early detection of diseases and pests through computer vision prevents potential harm to plants.
  • Additionally, remote control capabilities and connectivity with digital platforms enable convenient monitoring, providing users with greater control over their garden from any location.

Tools list:

  • Main box
  • Hinged lid (water-resistant material)
  • Full spectrum LED lights
  • Water container
  • Submersible pump
  • Tubes and connectors for irrigation system
  • Solenoid valves
  • Microcontroller to collet data from sensors and control actuators
  • Soil moisture, temperature, and humidity sensors
  • Water-resistant cameras
  • Wi-Fi/Bluetooth module
  • Power supply (rechargeable batteries or electrical connection)
  • Hinges and water-resistant locks
  • Drainage material
  • Waterproof seals or sealants
  • Full spectrum LED lights
  • Light controllers
  • Visual interface

For the design of my garden I couldn't think of any ideas :(. And while I was surfing the internet looking for ideas for my structure, I thought about using artificial intelligence to create images and give me some ideas. These were the ones I liked the most:



The idea is quite interesting, since I want my garden to be able to be accommodated in any place, besides the design that the ai gave me, has wheels to be able to move it. What I have to think about is the number of levels I want it to have. Fortunately the images have different levels, so I can decide what is best for my project.

After a lot of research about my project these are the most important points I have to consider to make a good project.

Structural Design



  1. PCB holders
    • Design and print custom 3D brackets for PCB and other electronic components. According to the design of the main structure, the brackets can have interlocking systems that fit directly to the MDF structure, allowing easy assembly and disassembly.
  2. Casters and mobility brackets
    • Search for caster designs on Amazon and Mercado Libre.
    • Think about the option of making them in Fusion 360 for 3D printing; for this, I must contemplate the weight of the structure for the wheels to support it.
  3. Protective housings for sensors and actuators
    • Design custom housings to protect the sensors and actuators, to ensure their durability.
  4. Modular planting trays
    • Design planting trays to fit shelves; in addition, design them with an integrated drainage system and zones to maintain proper humidity.
  5. Cable and pipe organizers
    • Design clamps and clips to keep cables and pipes organized.
  6. Corner braces
    • Design corner braces to increase the strength of the structure.
  7. Decorative elements
    • Design the pieces with aesthetic elements to improve the appearance of the garden.

Considerations for 3D Printing

After doing some research about the materials I can use for parts that will be in contact with water and humidity, these were the results I got:

  • PETG: It is an excellent choice as it combines durability, chemical resistance (which is good for water resistance) and is easier to print than ABS or Nylon. It has good flexibility and is less prone to moisture absorption than Nylon. In addition, PETG does not produce hazardous gases during printing and is UV resistant, making it suitable for use in environments with light exposure.
  • ABS: Although impact and wear resistant, it can be difficult to print on and suffers from warping and poor print bed adhesion. It is recommended to be equipped with a closed chamber printer with a heated bed, this can mitigate these problems. However, ABS may not be the best choice if ventilation is a concern due to the fumes it emits during printing.
  • Nylon: Despite its excellent mechanical properties, Nylon's tendency to absorb moisture can be problematic for components exposed to long-term moisture. Although it may be an option if stored and handled properly, for applications with high water contact.

After comparing the materials and reviewing some characteristics of each and also reviewing the configuration they need, I decided to go with PETG.

Electronics and Sensor System



Microcontrollers and Task Distribution

I selected the Xiao ESP32 board as the core of the sensor system due to its Wi-Fi communication capability, low power consumption, and compatibility with a variety of sensors. Multiple ESP32 boards will be distributed throughout the smart garden structure, with each assigned the function of collecting data on specific environmental variables such as humidity, pH, temperature, and light. The ESP32-CAM boards will be integrated for visual monitoring and detection of plant anomalies through computer vision algorithms.

Camera Monitoring System

  • One or more Xiao ESP32-CAM can be used to provide real-time surveillance of the plants. (I am still pondering which option is the most convenient).
  • The ESP32-CAM can process and transmit images to the monitoring application, allowing you to use computer vision to detect problems such as pests or plant diseases.

Actuators and Automation

Actuators, such as solenoid valves and water pumps, will be controlled by the ESP32 microcontrollers, which will activate irrigation systems based on moisture data and specific plant needs. Full-spectrum LED light controllers will be managed to adjust lighting in response to natural cycles or plant growth phases.

Power Supplies

  • Direct Grid Connection: this option provides a constant power source and is more suitable for a stationary system. An AC/DC transformer or adapter will be required to convert the grid power to voltage levels that the microcontrollers and sensors can safely handle.
  • Rechargeable Batteries: The rechargeable battery option offers mobility and reduces dependence on a direct power connection. Lithium-Ion or Lithium Polymer batteries are suitable for their energy density and stable discharge profiles. Protection circuits will be implemented to prevent overcharging and excessive discharging.

Energy Management and Efficiency

The electronic system will be designed to operate under an efficient power management scheme. The ESP32 microcontrollers will have the ability to enter a low power state between measurement periods, and the control algorithms will activate the actuators only when strictly necessary, based on collected data and programmed logic.

Water Container and Irrigation System



  1. Water container:
    • Capacity: Approximately 10 to 15 liters.
    • Refill Access: Design with a wide lid to allow easy manual refilling and a water level sensor to monitor capacity.
  2. Irrigation System:
    • Water Efficiency: Minimizes waste by applying water directly where it is needed.
    • Weed Reduction: By watering only specific areas, weed growth is reduced compared to surface irrigation.
    • Flexibility: Can be installed above or below ground and is adaptable to almost any landscape topography.
    • Fewer diseases: By preventing water from splashing on leaves, it decreases the risk of foliar diseases.
    • Automation: Can be easily controlled by timers and automatic control systems.
  3. Pumps and Water Extraction:
    • Select submersible pumps of adequate capacity and power for the size of the container and length of piping.
    • Pumps should be equipped with filters to prevent clogging and protect irrigation systems.
  4. Materials and components for irrigation system:
    • Main Pipe: High density polyethylene (HDPE) or PVC pipe for main water supply line.
    • Drip Tape: Drip tape with pre-installed emitters for water distribution to plants.
    • Connectors: Start connectors for the cintilla, which connect the main pipe to the drip cintilla. Elbows, Tees, and straight connectors to configure the desired design of the piping network.
    • Control valves: Solenoid valves for automated control of water flow, activated by microcontrollers. Manual valves for system control and maintenance.
    • Water Filters: Mesh or disc filters to prevent particles and sediment from clogging drip emitters.
    • Pressure Regulators: Regulators to maintain water pressure within optimum parameters for the drip system.
    • Water Pump: Submersible or surface pump, depending on water container configuration, to move water through the system.
    • Water Level Sensor: Ultrasonic or float sensor to monitor the water level in the container and prevent dry running of the pump.
    • Irrigation Timer or Controller: A programmable controller connected to microcontrollers to automate watering schedules.
    • Pipe Supports and Stakes: Supports and stakes to secure tubing and drip tape in place.
    • End Caps: End plugs for the end of the drip tape to prevent water leakage and maintain pressure.
    • Clamps and Clips: Clamps to secure piping to prevent accidental displacement or disconnection.
    • Teflon or Sealing Tape: Teflon tape to seal threaded connections and prevent leaks.

Programming



Core Programming Language: Python

Python is established as the core programming language due to its widespread adoption in data science, machine learning, and application development. Its clear syntax and rich library ecosystem make it an ideal choice for data processing and analysis, as well as for implementing artificial intelligence models.

Applications in the Project:

  • Data Processing: Use of Pandas for cleaning and manipulation of data collected by sensors.
  • Numerical Analysis: Application of NumPy for complex mathematical operations needed in modeling and simulations.
  • Data Visualization: Implementation of Matplotlib and Seaborn for the generation of graphs and visualizations to facilitate data interpretation.

Artificial Intelligence Technologies

The TensorFlow and PyTorch libraries, being leaders in the field of machine and deep learning, offer advanced tools to address two main needs of an intelligent garden: predictive modeling and computer vision.

  • Predictive Modeling: Using these frameworks, complex predictive models can be developed that learn from historical and real-time data to anticipate plant needs. For example, a model could predict the optimal amount of water needed for the next few weeks, based on variables such as soil moisture, ambient temperature, plant growth stage, and weather forecasts. These models not only help optimize water use but also ensure that plants receive the right care at the right time.
  • Computer Vision with CNNs: Convolutional neural networks (CNNs) are particularly well suited for analyzing visual images. By training CNNs with a dataset of images of healthy and disease- or pest-affected plants, the system can learn to identify early signs of problems. This allows for early intervention, potentially saving the crop from further damage. The integration of ESP32-CAM into the system provides a continuous source of garden images, which are analyzed in real time to monitor plant health.

Microcontroller and Sensor Programming

Control and Data Collection with Xiao ESP32:

  • The Xiao ESP32 is used as the control and data collection core of the system, thanks to its versatility, processing power, and connectivity options. Programming of these microcontrollers is typically done in C++ or MicroPython, offering a balance between low-level control and ease of development.
  • Sensor Integration: To collect environmental and soil data, various sensors (such as humidity, temperature, pH, and light) are connected to the ESP32. Programming involves periodically reading these sensors, processing the collected data to send it to a central database or directly to AI models for analysis.
  • Actuator Automation: Based on instructions derived from data analysis and predictive models, the ESP32 will activate actuators such as irrigation valves and LED lighting systems. This process requires careful programming to ensure that actions are executed at the right time and in the most efficient manner, avoiding waste of resources.
  • Communication and Connectivity: ESP32 modules use Wi-Fi or Bluetooth to communicate with each other and with the central user interface. The implementation of communication protocols such as MQTT facilitates this interconnection, allowing a scalable and flexible architecture. Programming must ensure secure and reliable communication to protect data and system control.

Connectivity and Visual Interface for Smart Gardening

The development of a smart gardening system requires careful consideration of connectivity and user interfaces to ensure optimal user experience and effective system management. Strategies for implementing a visual interface accessible from a computer, as well as the approach to developing a mobile application as an additional component of the system, are detailed below.

Visual Computer Interface

Web Interface Development:

  • Technology: HTML5, CSS3, and JavaScript will be used to develop a responsive web interface that allows users to interact with the smart gardening system from any modern web browser. Frameworks such as React or Vue.js can facilitate the development of a dynamic and responsive SPA (Single Page Application).
  • Interface Design: The interface will include a dashboard that displays real-time environmental data collected by sensors, actuator status, and system alerts. Clarity and ease of navigation will be prioritized.

Connectivity with the Microcontrollers

  • REST APIs: A REST API will be implemented on the server to act as an intermediary between the web interface and the ESP32 microcontrollers. This will allow the collection of sensory data, sending commands to the actuators, and updating the system parameters.
  • Real-Time Communication: To update the interface in real time, WebSockets or similar technologies will be used to allow bidirectional and continuous communication between the web client and the server.

Backend and Data Storage

  • Server and Database: a server (can be Node.js for easy integration with JavaScript) and a database (such as MongoDB for data storage in JSON format) will be configured to manage back-end operations and store data collected by sensors and actions performed.

Mobile Application Development (Additional Component)

Multiplatform Development Framework:

  • Flutter: Given the initial focus on a web interface, the development of a mobile application will be considered as a future expansion of the project. Flutter, which allows the creation of native Android and iOS applications from a single code base, is selected for its efficiency and ability to share business logic and interface design with the web version, through the use of the Dart language.
  • App Functionalities: The app will offer similar functionalities to the web interface, including real-time visualization of data, actuator control, and system configuration. In addition, it will take advantage of mobile device-specific capabilities, such as push notifications for important alerts.
  • Connectivity and Security: The application will communicate with the server through secure APIs, using authentication and encryption to protect information and ensure that only authorized users can access and control the system.