---
title: "Smart Farm Station (Basil cultivation)"
url: "https://maker.wiznet.io/Benjamin/projects/smart-farm-station-basil-cultivation/"
markdown_url: "https://maker.wiznet.io/Benjamin/projects/smart-farm-station-basil-cultivation/md"
type: "WCC: WIZnet Created Content"
author: "Benjamin"
author_url: "https://maker.wiznet.io/Benjamin/"
original_author: "Benjamin"
published: "2023-11-30"
language: "en"
tags: ["AIoT", "Webserver"]
hardware: ["WIZnet W5100S-EVB-Pico", "Arducam Mini 2MP Plus"]
likes: 1
views: 2783
comments: 0
source: "WIZnet Makers (https://maker.wiznet.io/)"
---

# Smart Farm Station (Basil cultivation)

> This project aims to develop a smart farm system for basil cultivation. It utilizes an AI-based monitoring system and automated environmental control to achieve

Original author: Benjamin

## Components

- **WIZnet W5100S-EVB-Pico** x 1 ([docs](https://docs.wiznet.io/Product/Chip/Ethernet/W5100S/w5100s-evb-pico))
- **Arducam Mini 2MP Plus** x 1 ([docs](https://www.arducam.com/product/arducam-2mp-spi-camera-b0067-arduino/))
- Software: **Adafruit Circuitpython** ([docs](https://docs.circuitpython.org/en/latest/README.html))
- Software: **Streamlit**
- Software: **Python** ([docs](https://docs.python.org/3/))

## Documents and links

- [webui - Streamlit app](https://github.com/wiznetmaker/Smart-Farm-Station/blob/main/Smart%20Farm%20Station/main.py) (code)
- [Camera Server - W5100S-evb-pico with Arducam](https://github.com/wiznetmaker/Smart-Farm-Station/blob/main/Camera%20Streaming%20Server/code.py) (code)

## Article

## Basil Cultivation Smart Farm Station

### Introduction

This project aims to develop a smart farm system for basil cultivation. It utilizes an AI-based monitoring system and automated environmental control to achieve efficient plant cultivation.

Begin by asking ChatGPT about the best conditions for growing basil.

![](https://maker.wiznet.io/upload/ckeditor5/894901141%5F1701343123%2Epng)

### Technology Stack & Tools

- **Programming Language**: Python

- **Web Framework**: Streamlit

- **AI Modeling**: YOLOv8 for image detection

- **Hardware Control**: W5100S-EVB-Pico board, TCP communication for smart farm control

![](https://maker.wiznet.io/upload/ckeditor5/234731977%5F1703077822%2Epng)

### Team Composition & Roles

**My Role**:

- AI Modeling: Using YOLOv8 for analyzing plant growth and health status

- Web Application Development: Building an interface with Streamlit![](https://maker.wiznet.io/upload/ckeditor5/894901141%5F1701343232%2Epng)

```plaintext
streamlit run main.py
```

- Camera Server Setup: Capturing and transmitting real-time images from the smart farm

![](https://maker.wiznet.io/upload/ckeditor5/234731977%5F1703077833%2Epng)

**Theo's Role**:

- Smart Farm Control System Development: Managing hardware and sensor data integration for the smart farm

![](https://maker.wiznet.io/upload/ckeditor5/894901141%5F1701340775%2Epng)![](https://maker.wiznet.io/upload/ckeditor5/894901141%5F1701340723%2Epng)

### Web Application Design & Features

**Real-Time Monitoring**

- The web application, developed using Streamlit, enables users to view real-time images and sensor data (temperature, humidity, brightness) of the smart farm.

- Supports database reset functionality.

![](https://maker.wiznet.io/upload/ckeditor5/234731977%5F1703077933%2Epng)

- Code Example:

```plaintext
st.image(img, use_column_width=True)
df = pd.DataFrame(sensor_data, columns=['Date', 'Temperature', 'Humidity', 'Brightness'])
st.table(df)
```

**Start Cultivation Button**

- Pressing the 'Start Cultivation' button sends optimal initial values for basil cultivation (Temperature: 23°C, Humidity: 55%, Brightness: 500, Watering Cycle: 36 hours) to the TCP Client controlling the sensors via the Pico.

- Initiates the display of growth information (e.g., time elapsed since cultivation start, current growth stage)![](https://maker.wiznet.io/upload/ckeditor5/234731977%5F1703077880%2Epng)

- Code Example:

```plaintext
if st.button('🌱 재배 시작!', key='start_growing_button'):
    st.session_state['start_time'] = datetime.now()
    tcp_client_send_data()
```

**Current Status Button**

- The 'Current Status' button fetches and displays the latest image from the Camera server, updating the on-screen visuals with the current status of the smart farm.

- Code Example:

```plaintext
if 'refresh_image' in st.session_state:
    img_url = "http://192.168.0.10/16"
    response = requests.get(img_url)
    new_image_path = os.path.join(image_save_path, f'image_{st.session_state["refresh_image"].strftime("%Y%m%d%H%M%S")}.jpg')
    with open(new_image_path, 'wb') as file:
        file.write(response.content)
    st.session_state.pop('refresh_image
```

### Results & Future Plans

As of the current date (November 28, 2023), the smart farm system has been set up, and basil has been planted. It is expected that cotyledons (seed leaves) will develop around 7 to 10 days after planting. Updates will be provided as the plants grow and reach different stages of development. Stay tuned for further updates on the progress and growth of the basil in our smart farm system.

![](https://maker.wiznet.io/upload/ckeditor5/20992869%5F1702973013%2Epng)

Additionally, we plan to incorporate an AI model into the system. This AI feature will detect the condition of basil leaves, identifying whether they are healthy, affected by fusarium, or showing signs of powdery mildew. This enhancement aims to provide more precise and automated monitoring of plant health within the smart farm environment.

![](https://maker.wiznet.io/upload/ckeditor5/234731977%5F1703077959%2Epng)

---

Source: https://maker.wiznet.io/Benjamin/projects/smart-farm-station-basil-cultivation/
