esp-idf-qr-code-generator

QR Code generator for esp-idf

MIT License

Stars
8

esp-idf-qr-code-generator

QR Code generator for esp-idf. You can generate any QR code.

This project use this as components. It's a GREAT job.

Installation overview

  1. In this project directory, create a components directory.

  2. In the components directory, clone QR-Code-generator:

git clone https://github.com/nayuki/QR-Code-generator
  1. In the new QR-Code-generator directory, create a CMakeLists.txt file containing:
idf_component_register(SRCS "c/qrcodegen.c" INCLUDE_DIRS "c/")
  1. Compile this project.

Software requiment

ESP-IDF V5.0 or later. ESP-IDF V4.4 release branch reached EOL in July 2024. ESP-IDF V5.1 is required when using ESP32-C6.

Installation

git clone https://github.com/nopnop2002/esp-idf-qr-code-generator
cd esp-idf-qr-code-generator
mkdir -p components
cd components/
git clone https://github.com/nayuki/QR-Code-generator
echo "idf_component_register(SRCS \"c/qrcodegen.c\" INCLUDE_DIRS \"c/\")" > QR-Code-generator/CMakeLists.txt
cd ..
idf.py menuconfig
idf.py flash monitor

Application Setting

Wifi Setting

You can use the mDNS hostname instead of the IP address.

HTTP Server Setting

How to use

Open your brouser, and put address in address bar. You can use the mDNS hostname instead of the IP address. Default mDNS name is esp32.local. Input text and submit. After waiting for a while, a QR code will appear.

How to browse image data using built-in http server

Even if there are image files in SPIFFS, the esp-idf http server does not support this:

httpd_resp_sendstr_chunk(req, "<img src=\"/spiffs/qr-code.bmp\">");

You need to convert the image file to base64 string.

httpd_resp_sendstr_chunk(req, "<img src=\"data:image/bmp;base64,");
httpd_resp_sendstr_chunk(req, (char *)BASE64_ENCODE_STRING);
httpd_resp_sendstr_chunk(req, "\">");

Reference

https://github.com/nopnop2002/esp-idf-web-form

https://github.com/nopnop2002/esp-idf-pwm-slider