Raspberry Pi Uses Open CV to Read QR Codes

Raspberry Pi
(Image credit: Eric, That Project)

When the tool you need is out of reach, sometimes the best solution is to create one yourself. Single-board computers like the Raspberry Pi can really help speed up the process. When Eric, host of the That Project channel on YouTube, needed to read and generate QR codes, he built hardware to do it using a Pi running Open CV.

This particular project is built around a Raspberry Pi Zero 2 W, which is responsible for both scanning and processing QR codes. The project is aided by his ESP32 QR code generator which can be used to make custom codes on the spot. If you’re interested in other options for reading codes with a Raspberry Pi, check out our review of the Barcode Reader HAT.

Instead of using a HAT like we did, Eric is using a USB webcam to capture images. The Pi Zero 2 W then scans the image for possible QR codes. Using Open CV, it determines whether or not a QR has been detected and if so, what information it contains. The image processing can be viewed in real-time as Eric has included a 7-inch display. Possible QR codes can be seen with bounding boxes around them as Open CV tries to interpret the image.

The ESP32-based QR code generator runs in tandem. Eric goes into detail breaking down the code for this device, which runs primarily on Arduino-based .ino files. The source code for the QR code maker is available at GitHub but unfortunately, there isn’t much information available yet breaking it down.

If you want to recreate this Raspberry Pi project yourself, Eric provides enough information to help get you started. It doesn’t take much hardware, but you will need some experience with Open CV to bring everything together. (Check out our tutorial on how to use Open CV with a Raspberry Pi for help getting started.) 

Ash Hill
Freelance News and Features Writer

Ash Hill is a Freelance News and Features Writer with a wealth of experience in the hobby electronics, 3D printing and PCs. She manages the Pi projects of the month and much of our daily Raspberry Pi reporting while also finding the best coupons and deals on all tech.