It looks like you're new here. If you want to get involved, click one of these buttons!
Maybe somebody will need this:
This PCell macro will provide a new library "QRCodeLib" with a single PCell "QRCode". The latter is able to produce QR code for a given text. It provides some options to adjust the appearance of the QR code.
Enjoy,
Matthias
Comments
Hi,
You can just drag the file to the Klayout window. KLayout should ask then whether to install the file permanently.
Depending on your Proxy settings you may be even able to drag the link above to KLayout's Window.
Matthias
/Thomas
How do I use it? I have tried so many ways of using it but can't get a QR code drawn so please help me and describe how I get it to work.
/Thomas
Hi,
Are you familiar with the basics of IC layout? The QR code PCell is, as the name implies, as PCell. In order to use it,
Matthias
I am not familiar with the basics in IC design but I am familiar with designing for E-beam, which I am using KLayout for. I have used Pcell mainly for making text into polygons that can be written by E-beam.
Back to teh QR code: I am not getting a QR code by using this PCell. I get an array of 5000x20000 elements. A QR code is a square so I am guessing that I am doing something worng here.
I don't get the Pixel size and the Pixel bias either, I have tried several different settings and I get an array of 5'x20' each time. I am going to use it to create a code that points to our company website.
Br
/Thomas
Hi Thomas,
sorry for that question - I just wanted to make sure you're not somebody mistaking the thing with one of the many
QR code generators out there.
Regarding your problem: could you check that "Array" is not enabled on the first tab of the instance properties sheet? Plus of course enough hierarchy levels must be selected (press "*" to enable all).
Matthias
Yep, the Array was checked so now when I have unchecked it, the QR code script works for me as well.
This is a classical case of learning by doing (mistakes) ;-).
And the pixel size decides the size of the QR code. It now works för me to generate the web site QR codees I need.
/Thomas
Thank you for sharing this QR Code PCell.
I don't know what happened to the original link, but it was copied earlier to E4K. After you install it, look under the Examples menu, PCells submenu.
Hi all,
thanks for mentioning this. The server got moved. I have fixed the link. The server's address now is "www.klayout.org".
Best regards,
Matthias
Thanks for sharing the QR code PCell macro. I am wondering is there a way to generate the DataMatrix pattern as well ? Or how should I change the algorithm based on your baseline code? Another question is that if I have a bunch of coded data, say 1000 rows and I want to translate them into the QR code pattern. How should I use your PCell in my own Macro. Sorry, I am kind of new to KLayout and need to learn how to program from the beginning. I would appreciate if you could point me a direction. Thanks !
Hi,
sorry for the dumb question, but what is a DataMatrix pattern?
Matthias
Thanks for reply. It's a 2D bar code format similar to QR code but with a different algorithm to generate. Datamatrix can be coded with more information within same area. Here are some good comparisons between these two different 2D bar codes.
https://qrworld.wordpress.com/2011/09/26/qr-codes-versus-data-matrix/
https://blog.matthews.com.au/datamatrix-and-qr-codes-why-2d-codes-are-still-relevant-in-2016/
Thank for this information.
Right now, there is no Datamatrix generator - it's entirely different from QR code. I got some basic understanding from the documentation, but no detailed specification. There seems to be technical standard which is not publicly available. I found one open source implementation https://sourceforge.net/projects/datamatrixnet, but that's it.
After all, it does not seem to be a quick project. Do you know of any applications that require datamatrix encoding?
Regards,
Matthias
Sorry for a late reply. Due to the compact size of the pattern, it has been widely used in various industries, like semiconductor, automobile, healthcare, printing etc. The US Electronic Industries Alliance (EIA) recommends using Data Matrix for labeling small electronic components. It can be marked directly onto components using ink-jet, dot-peen marking, laser marking. I will look for any source code as well and let you know if I find anything.
Hello,
I guess the .NET implementation is a good staring point. But I don't have a specification. Technical standards are not freely available and I'm a bit cautious not to violate IP rights. An open source implementation essentially is making a specification public.
If you are able to gain clarity regarding this legal topic, an implementation isn't far away.
Regards,
Matthias
Hi Matthias,
I have an application where I need to generate up to a few thousand unique QR codes all with a unique position on the layout.
I am able to generate and place unique text(with a text size) where I need it. After placing the text, I can convert it to polygon. Instead of selecting all of the text and converting it to polygon through 'Convert to PCell>basic.text', is there an easy method to select all of the text and convert it to a QR code with the pixel size being the text size?
Any help would be appreciated.
Thanks,
Daniel
Hi Daniel,
sorry, I noticed your message just now.
The procedure is basically the same as for text. But the parameters you need to set are different ones:
text
(string) for the text to showlayer
(LayerInfo) for the layer to place the QR code onpixel_size
(double) the size of the pixels in micrometerbias
(double) a positive or negative per-side bias to apply (in micrometers) - default is 0 (no bias)format
(int) the format type (0: Bytes, 1: Numeric, 2: Alphanumeric) - controls the character set. "Bytes" is raw bytes and is the default choice.ecc_level
: (int) error correction level (0: Auto, 1: L, 2: M, 3: Q, 4: H) - 1 to 4 are increasing level of error correction. A higher value means less payload. 0 (Auto) is the default and probably the best choice.inverse
: (bool) If true, the pattern is invertedHope this helps.
Regards,
Matthias
Hello,
(Apologies if this is a silly question! I am a relative beginner regarding Klayout.)
I’ve been using this QR PCell with some success. However, we are looking to now add more unique QR codes. I would prefer to do this using Python.
It seems ‘pya’ is not able to generate QR codes – is that correct?
Do I need to 'link' pya to this new QRCode PCell somehow?
Thanks in advance,
Johan
Hi Johan,
If you are happy with the QR code the PCell delivers, you can use Python to place a PCell.
Here is an example how to do that. I places a QR code PCell in the current layout on layer 1/0:
Matthias
Hi Matthias,
Your previous comment did the trick - THANKS!
I've moved over to more complicated QR codes but encountered a problem.
Below is a simple script for creating a QR code for '250131AB'; however, the code creates a QR code that encodes '521013AB'. (Pairs of characters are switched.)
When you change to bytes ('format': 0), this problem is resolved.
So, the issue lies with how qrcode_pcell.lym handles alphanumeric ('format': 2).
Ideally, I would like to use alphanumeric, as the QR codes generated are smaller.
Hi @Johan_vdW,
I guess this is the first bug reported for the QRCode PCell
BTW: the code is here: https://github.com/klayoutmatthias/qrcode_pcell
But it has been a while (8 years in fact) since I created it. I need to dig into the code and spec before I can give feedback.
My first guess is line 908 of qrcode_pcell.lym which maybe should be:
This fixes the problem of the swapped characters, but my phone can't decode QR codes with an odd number of characters. Something else is wrong too.
Matthias
I have released a new version 1.1 of the QR code PCell which fixes the problem.
Matthias
Hi @Matthias,
Thanks a lot; I'm glad it was a simple fix.
(I'm jealous that your code went so long within the need for a bug fix!)
Johan
Or maybe no one used it
But thanks for reporting the issue. I don't know why my phone wasn't able to read it in the first place. But finally that problem was gone.
Kind regards,
Matthias