Skip to content

mmoukayed/QR-Code-Generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

QR Code Generator

A feature-rich QR code generation application for the T-Deck ESP32-based device with a touchscreen interface and graphical UI powered by LVGL.

Overview

This project allows you to generate QR codes on the T-Deck device with an intuitive graphical interface. Users can input text through the built-in keyboard or serial connection, customize QR code appearance (colors, size), and view the generated codes on the device's display.

Features

  • QR Code Generation: Convert text input into scannable QR codes
  • GUI Interface: LVGL-based graphical user interface for easy interaction
  • Touch Support: Full touchscreen support for input and navigation
  • Multiple Input Methods:
    • Physical keyboard/buttons on T-Deck
    • Touchscreen interface
    • Serial console input
  • Customizable Colors: Configure foreground and background colors for QR codes
  • Adjustable Size: Dynamic QR code sizing (up to 200x200 pixels)
  • Multi-device Support: Support for T-Keyboard and T-Deck variants

Hardware Requirements

  • T-Deck ESP32-S3 Development Board
    • 3.4" TFT LCD Display
    • GT911 Touchscreen controller
    • Integrated Physical Keyboard
    • 16MB of PSRAM
    • Micro SD Card slot

Software Requirements

  • PlatformIO IDE (with ESP32 support)
  • Framework: Arduino ESP32 v6.3.0
  • Python 3.x (for PlatformIO)

Libraries Used

  • LVGL v8+: Lightweight GUI library
  • TFT_eSPI: SPI TFT LCD driver library
  • TouchLib: GT911 touchscreen driver
  • AceButton: Button event handling library
  • SD/SPIFFS: File system support

Project Structure

├── src/
│   ├── main.cpp           # Main application and QR code generation logic
│   └── utilities.h        # Board pin definitions and hardware configuration
├── lib/
│   ├── lvgl/              # LVGL GUI library
│   ├── TFT_eSPI/          # Display driver
│   ├── TouchLib/          # Touchscreen controller
│   └── AceButton/         # Button handling
├── boards/
│   └── T-Deck.json        # Custom T-Deck board configuration
├── platformio.ini         # PlatformIO configuration
└── README.md              # This file

Getting Started

1. Prerequisites

Ensure you have PlatformIO installed in VS Code:

pip install platformio
code --install-extension platformio.platformio-ide

2. Clone/Setup Project

cd /path/to/project

3. Build the Project

platformio run --environment T-Deck

4. Upload to Device

Connect your T-Deck via USB and run:

platformio run --target upload --environment T-Deck

To monitor serial output:

platformio device monitor --environment T-Deck

Usage

Generating QR Codes

  1. Start the Application: Power on the T-Deck device
  2. Input Text:
    • Use the physical keyboard on the device
    • Or type via serial console (at 115200 baud)
  3. Generate QR Code: Press the input button or equivalent key
  4. View Result: The QR code will be displayed on the screen
  5. Customize: Adjust colors and size as desired

Input Methods

  • Physical Keys: Row of directional buttons on T-Deck for navigation and selection
  • Touchscreen: Direct touch input on the display
  • Serial Console: Send text commands via the USB serial interface
  • Keyboard Module: If using T-Keyboard variant with PS/2 keyboard

Build Configuration

Key build settings in platformio.ini:

  • Upload Speed: 921600 baud
  • Monitor Speed: 115200 baud
  • Partition Table: 16MB default configuration
  • Flash Mode: DIO (Dual I/O)
  • PSRAM: Enabled for larger buffer allocations
  • USB CDC: Enabled for serial console access

Hardware Pinout

Key GPIO pins (defined in utilities.h):

  • Display: TFT_DC (11), TFT_CS (12), TFT_BL (42)
  • SPI Bus: MOSI (41), MISO (38), SCK (40)
  • Touch: INT (16), I2C (SDA: 18, SCL: 8)
  • Keyboard: INT (46)
  • SD Card: CS (39)
  • Control Buttons: GPIO 1-3, 15
  • Boot Button: GPIO 0

Troubleshooting

Serial Monitor Not Working

  • Ensure USB CDC is enabled: -DARDUINO_USB_CDC_ON_BOOT=1
  • Try baud rate: 115200
  • Check USB cable connection

Display Not Showing

  • Verify backlight pin configuration (GPIO 42)
  • Check TFT_eSPI User Setup configuration
  • Ensure SPI pins are correctly defined

Touchscreen Not Responsive

  • Verify GT911 I2C address and pins
  • Check TouchLib initialization in setupLvgl()
  • Test I2C communication to touch controller

Development Notes

LVGL Configuration

The project uses LVGL v8 with partial rendering mode for optimal memory usage on ESP32.

Memory Management

  • Uses PSRAM when available for large display buffers
  • Implements semaphores for thread-safe SPI access
  • Dynamic memory allocation for QR code generation

Color Format

QR codes use LVGL's color format:

  • Foreground: Dark color (typically black)
  • Background: Light color (typically white)

Contributing

To contribute improvements:

  1. Create a feature branch
  2. Make your changes
  3. Test on T-Deck hardware
  4. Submit a pull request

License

This project is provided as-is for development and educational purposes.

Author

Mohamad Mouaayed

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors