DEV Community

Cover image for Let's develop a QR Code Generator, part I: basic concepts

Let's develop a QR Code Generator, part I: basic concepts

Massimo Artizzu on July 08, 2021

Recently I was developing a little puzzle web game, and I thought that it would be cool if people could share the puzzles using something commonly ...
Collapse
 
strooom profile image
Pascal Roobrouck

I am writing the firmware for a device which has to show qrCodes on an epaper display. I found a (C) library which works, but according to my SonarCloud quality report, the library has many issues. So I am going to refactor it. (Switching to C++ while refactoring)
I was able to reverse engineer about 80%, but I am having trouble understanding the error correction part. I hope these tutorials will close the gap for me.
Thanks for sharing them.

Collapse
 
carlosds profile image
Karel De Smet

Just bumped into this, the series as a whole looks like a really detailed breakdown. I have been fiddling around myself with several barcode/QR code readers myself and am anxious to learn more so definitely gonna check this series out further. Thanks for sharing!

Collapse
 
pbouillon profile image
Pierre Bouillon

That's really interesting, I'm looking forward to the next part !

Collapse
 
maxart2501 profile image
Massimo Artizzu

Thanks! I'll publish the second part in a day or two. I still don't know how many parts will be, but I'll cover the basic cases first, then I'll move to the more complex later.

I think that the first 4 parts will be enough to create a small but working QR code 👍

Collapse
 
ondrej_tucek profile image
Ondřej Tuček

Hold my beer 🍺...
🎉 ✨ github.com/iodevs/qr_code 😏

Collapse
 
maxart2501 profile image
Massimo Artizzu

Congrats! 👏 I know by experience that it's no easy feat.

As you've seen, I've looked into thonky.com's tutorial too. It's a very comprehensive source of information on the matter.
And for some things, it's also the only source - and to be honest, I'm a little worried some info will get lost if the site will ever go down for some reason 😰

Collapse
 
ondrej_tucek profile image
Ondřej Tuček

Thanks. Yep it wasn't so easy to build as we thought :-) I totally agree, thonky is one of the best documentation and we developed our library based on it...

Collapse
 
henry__smith profile image
Henry Smith

Great detailed description of the workings of QR codes! I'm looking into how the data section could be adapted from a graphical perspective, in order to create human recognisable patterns or designs, that still function as a working QR code (not just sticking a logo in the middle and compensation with error correction). The URL would end up being a function of the QR code rather than the typical method of the QR code being a function of the URL. Is this something that you have come across? it it feasible and do you think it could be coded?

Collapse
 
maxart2501 profile image
Massimo Artizzu

Hi, thanks for your kind words!
If you put a bunch of pixels in a square grid, even if you respect the sizes and the patterns, you'll most probably end up with an invalid "QR code". That's why creating a QR code from an URL is basically the only way to get something working.
That being said, there have been some fantastic examples of "artistic", and yet working, QR codes. The folk in the article used stable diffusion, maybe this can give you a hint?