The $4 Raspberry Pi Pico and its $6 Wi-Fi enabled brother the Raspberry Pi Pico W have proven to be great foundations for great projects. QR code display project from Predrug Mijatovic Inspired. The simple purpose of this project is to display a QR code that allows devices to connect to Wi-Fi.
Mijatovic’s project “qr_wifi” displays a QR code that allows guests to connect to a guest Wi-Fi network. The QR code stores her SSID, security (WEP/WPA) and password details for your network connection. Users simply scan the code with the device’s camera and the device is connected.
What interests us most is the approach, specifically looking at the Raspberry Pi Pico accessories. Waveshare Pico OLED 1.3 Display the QR code on an inch (64 x 128 pixels) screen. The code for the project is all written in MicroPython, and in the video you can see Mijatovic generate his QR code using: qrencode, a convenient terminal command for generating QR codes from data. QR codes are written to text files as ASCII text.
The returned QR code is 50 columns wide and 25 lines high, so Mijatovic cleverly uses sed and regular expressions to clone the lines and make them all square. This is essential as the QR code contains error checking and the user will not be able to connect to her Wi-Fi if the code size is incorrect. A little more regex magic and a QR code is ready for the final MicroPython script.
QR code MicroPython code In main.py (lines 160 and 161), code is executed each time Pico is powered up.
Credit to Mijatovic for this awesome project and it’s great to see it applied to other boards. Pimoroni’s Badger 2040 and Tufty 2040 for example are great devices to recreate this project .
For more information, please visit qr_wifi Mijatovic’s GitHub repository.