Skip to content

Chamal1120/smart-fan-control-system

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Smart Fan Control Using Hand Gestures

This project allows you to control a fan using hand gestures detected via OpenCV, cvzone and an Arduino board. The system can use a esp32 microcontroller to receives commands from a Python script running on the a computer and pass them to a motor_controller The Python script detects hand gestures using OpenCV and sends the corresponding commands to the microcontroller to control the fan speed.

This is done as a group practical for our TCC2 (Technology Challenge Competition) module in the University.

Table of Contents

Overview

The project consists of three main components:

  1. Python Script: Detects hand gestures using OpenCV and sends commands to the Arduino.
  2. ESP32 sketch: Receives commands from the Python script and controls the fan accordingly.

Features

  • Hand gesture detection using OpenCV
  • Fan speed control based on detected gestures
  • WiFi communication between the PC and the microcontroller
  • Real-time feedback on fan speed and connection status

Hardware Requirements

  • ESP32 microcontroller
  • Fan (or motor) with speed control
  • OLED display for feedback
  • Temperature sensor (optional)

Software Requirements

  • Python 3.10 or above
  • OpenCV
  • cvzone
  • Arduino IDE

Installation

Arduino

  1. Install the Arduino IDE from Arduino's official website.
  2. Connect your microcontroller board to your PC.
  3. Upload the provided sketch (esp32_sketch.ino) to the microntroller.

Python

  1. Clone this repository to your local machine.

    git clone https://github.com/Teammate-2-0/Smart-Fan-Control-System.git
    cd smart-fan-control
  2. Creating a virtual environment is recommended (You can skip this if you prefer to install libs globally)

    in python3

    python -m venv my-env # For Windows and Unix
    .\my-env\Scripts\activate # For Windows
    source my-env/bin/activate # For unix

    in conda

    conda create -n my-env
    conda activate my-env
  3. Install the required Python libraries.

    in python3

    pip install opencv-python cvzone

Usage

  1. Arduino Setup: Ensure your microcontroller is connected to the PC and powered on.

  2. Python Script: Run the Python script to start detecting hand gestures and sending commands to the Arduino.

    python main.py

Project Structure

Arduino Code

Key Functions

Python Code

The Python script uses OpenCV to detect hand gestures. Depending on the number of fingers detected, it sends a command to the Arduino to control the fan speed and on/off status. Key Functions

License

About

This is a RE-UP of original repo which is not accessible now

Topics

Resources

Stars

Watchers

Forks