Skip to content

GUUDIN/Kaishita

Repository files navigation

Kaishita: a student-lead approach to afordable Vending Machines


Project Overview

On the mission to develop affordable, small, and customizable vending machines for everyone.

About Kaishita

Kaishita is a student-led project born at USP São Carlos, Brazil, aiming to revolutionize automated sales systems with compact and intelligent vending machines.

Kaishita Vending Machine

Goals

  • Deliver automated sales solutions that fit any environment.
  • Create a purchasing process as simple as grabbing the product (secure and theft-proof).
  • Offer diverse payment methods like Pix and credit/debit cards.
  • Provide real-time feedback to vendors, including stock management and AI-based pricing suggestions.

How It Works

The Kaishita vending machine integrates weight sensors, MQTT communication, and a centralized server to automate and analyze purchases.

Action Flow

  1. User Interaction:
    The user selects the desired product and quantity to withdraw from the vending machine.
  2. Server Logic:
    The server receives the request, monitors the event, and determines the state of the purchase:
    • Candies Taken (Successful)
    • Candies Not Taken (Unsuccessful)
  3. Weight Verification:
    The ESP32 weight system ensures the correct amount of product has been taken.
  4. Data Analysis:
    Every successful purchase is logged in a CSV file and automatically analyzed for trends.

Table of Contents

  1. Project Overview
  2. Goals
  3. How It Works
  4. Project Structure
  5. Key Features
  6. Setup Instructions
  7. Example CSV File Format
  8. Results
  9. Project Images
  10. Contribute to the Project
  11. Credits

Project Structure

Kaishita/
├── Hardware_Firmware/      # ESP32 firmware code for the vending machine
│   ├── components/         # External libraries and components
│   │   ├── arduino/        # Arduino libraries for ESP-IDF compatibility
│   │       ├── pubsubclient/   # MQTT library
│   │   ├── WiFiManager/    # Wi-Fi management library
│   ├── include/            # Header files for MQTT and weight logic
│   ├── main/               # Main source code
│   │   ├── 3Cell.cpp       # Weight scale logic (HX711 integration)
│   │   ├── mqtt.cpp        # MQTT communication
│   │   ├── main.cpp        # Firmware entry point
│   ├── CMakeLists.txt      # Build configuration
│
├── Website/                # Server code (handles vending machine communication)
│
├── Analysis/               # Automated purchase data analysis
│   ├── analise_compras.py  # Script for trend analysis
│   ├── requirements.txt    # Python dependencies
│   └── README.md           # Instructions for running analysis
│
└── README.md               # Main project documentation

Key Features

1. IoT Weight System

  • Monitors the weight of products using HX711 load cells connected to an ESP32-S3.
  • Publishes weight data to a server via MQTT for purchase verification.

2. Server Integration

  • Handles user requests, verifies events, and tracks product states:
    • Product Taken
    • Product Not Taken

3. Data Analysis

  • Logs successful purchases into a CSV file.
  • Automatically generates:
    • Trend graphs: Showing product purchases over time.
    • Purchase probabilities: Calculating likelihood of sales at specific times (morning, afternoon, evening).

Setup Instructions

ESP32 Firmware

  1. Clone the repository:

    git clone https://github.com/GUUDIN/Kaishita.git
    cd Kaishita/Hardware_Firmware/src
  2. Install Arduino Component:

    git submodule add https://github.com/espressif/arduino-esp32.git components/arduino
    cd components/arduino
    git submodule update --init --recursive
  3. Add Required Libraries:

    idf.py add-dependency "tzapu/WiFiManager"
    idf.py add-dependency "knolleary/pubsubclient"
  4. Configure Wi-Fi and MQTT Broker in main/mqtt.cpp:

    const char* mqtt_server = "YOUR_MQTT_BROKER_ADDRESS";
    const int mqtt_port = YOUR_MQTT_BROKER_PORT;
  5. Build and Flash Firmware:

    idf.py build
    idf.py flash

Analysis Script Setup

  1. Navigate to the analysis folder:

    cd Kaishita/analysis
  2. Install Dependencies in a Virtual Environment:

    python3 -m venv venv
    source venv/bin/activate   # Linux/MacOS
    pip install -r requirements.txt
  3. Run the Analysis:

    python analise_compras.py
  4. Provide the CSV file path when prompted.


Example CSV File Format

data hora produto quantidade
2024-01-01 8 KitKat 10
2024-01-01 14 Mentos 5
2024-01-01 20 Bala 7

Results

  1. Trend Graphs: Visualize total quantities of products sold at different times.
  2. Purchase Probabilities: Calculate product popularity in the morning, afternoon, and evening.

See the current state of the project!

Website UI

Click to view Website UI Website UI

Serial Monitor Output

Click to view Serial Monitor Output Serial Monitor Output

Project Setup

Click to view Project Setup Project Setup

Contribute to the Project

If you want to collaborate:

  1. Fork the repository.
  2. Grab an issue and start coding!
  3. Submit a pull request.

Credits

  • ESP32 Firmware Development: Pedro Gudin & Mateus Messias
  • Analysis and Server Integration: Mateus Messias & André Messias
  • Documentation: Pedro Gudin & Mateus Messias & João Breches

About

Vending machines that may not suck

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published