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.
- 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
-
Create a virtual environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
-
Configure environment variables:
- Copy
.env.exampleto.env - Update the values with your configuration
- Copy
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)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!")Run tests using pytest:
pytestMIT License
The system supports integration with ESP8266 and ESP32 IoT devices via MQTT:
- Flash the
esp8266_qr_client.inosketch to your ESP8266 board - Connect an OLED display (SSD1306) to the ESP8266 via I2C
- Configure the WiFi and MQTT settings in the sketch
- Optional: Connect status LEDs to D0 (valid) and D4 (invalid)
The system uses MQTT for communication with ESP8266/ESP32 devices:
python src/arduino/esp8266_demo.py --broker-host=192.168.1.100
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.