Skip to content

Repository files navigation

Multi-dimensional QR Code System

This project implements a secure, multi-dimensional QR code system for product authentication and tracking. The system generates QR codes with multiple layers of encrypted information and provides verification mechanisms to detect counterfeit products.

Features

  • Multi-dimensional QR code generation
  • Encryption of sensitive data
  • Product authentication and verification
  • Database integration for tracking
  • Blockchain compatibility (optional)
  • ESP8266/ESP32 IoT device integration
  • Universal QR code compatibility with any scanner

Setup

  1. Create a virtual environment:

    python -m venv venv
    source venv/bin/activate  # On Windows: venv\Scripts\activate
  2. Install dependencies:

    pip install -r requirements.txt
  3. Configure environment variables:

    • Copy .env.example to .env
    • Update the values with your configuration

Usage

Generating QR Codes

from src.main import generate_product_qr

# Generate QR code for a product
product_data = {
    "id": "12345",
    "name": "Product Name",
    "batch": "B001"
}
qr_path = generate_product_qr(product_data)

Verifying QR Codes

from src.main import verify_product_qr

# Verify a product QR code
result = verify_product_qr("path/to/qr_code.png")
if result.is_authentic:
    print("Product verified!")

Testing

Run tests using pytest:

pytest

License

MIT License

IoT Device Integration

The system supports integration with ESP8266 and ESP32 IoT devices via MQTT:

ESP8266 Setup

  1. Flash the esp8266_qr_client.ino sketch to your ESP8266 board
  2. Connect an OLED display (SSD1306) to the ESP8266 via I2C
  3. Configure the WiFi and MQTT settings in the sketch
  4. Optional: Connect status LEDs to D0 (valid) and D4 (invalid)

MQTT Communication

The system uses MQTT for communication with ESP8266/ESP32 devices:

python src/arduino/esp8266_demo.py --broker-host=192.168.1.100

QR Code Compatibility

The QR codes generated by this system are compatible with:

  • Any smartphone QR code scanner app
  • Professional barcode readers
  • Web camera verification
  • ESP8266/ESP32 camera modules

This compatibility is achieved through:

  • Standard QR code formatting (ISO/IEC 18004)
  • Medium error correction level (15%)
  • Optimal size and contrast ratio
  • Proper quiet zones (margins)

For more information, see the Arduino README.

About

This project implements a secure, multi-dimensional QR code system for product authentication and tracking. The system generates QR codes with multiple layers of encrypted information and provides verification mechanisms to detect counterfeit products.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages