QR Code PCell

edited November 2014 in General

Maybe somebody will need this:

qrcode_pcell.lym

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

QR code PCell

Comments

  • edited November -1
    Where do I put this file to get it to work? I know where the KLayout files is situated but in which folder in the Klayout should I put it?
  • edited January 2015

    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

  • edited November -1
    It worked ;-! I could drag directly from the web page, great feature!

    /Thomas
  • edited November -1
    A final (?) question.

    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
  • edited November -1

    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,

    • Run KLayout in editor mode
    • Create a layout and one layer at least
    • Choose "Instance" to create a new instance
    • On the properties page go to the PCell tab, select the layer and enter the text to encode
    • Hit "Apply"
    • Place the cell somewhere in the layout

    Matthias

  • edited November -1
    Hi,

    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
  • edited February 2015

    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

  • edited November -1
    Once again, thanks.

    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
  • edited June 2015

    Thank you for sharing this QR Code PCell.

  • edited November -1
    The original link is broken. Can you repost it? Thanks!
  • edited November -1

    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.

  • edited November -1

    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

  • edited February 2018
    Hi, Matthias and davidnhutch,

    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 !
  • edited November -1

    Hi,

    sorry for the dumb question, but what is a DataMatrix pattern?

    Matthias

  • edited February 2018
    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/
  • edited November -1

    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

  • edited November -1
    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.
  • edited November -1

    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 show
    • layer (LayerInfo) for the layer to place the QR code on
    • pixel_size (double) the size of the pixels in micrometer
    • bias (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 inverted

    Hope this helps.

    Regards,

    Matthias

Sign In or Register to comment.