We use data matrix codes on all our PCBs (some are panelised at 50+ per panel). Only on one side.
We tried manually applying labels to the bare PCBs when loading up the magazines. It was taking too long though and had a lot of wastage. We had to print 3 labels for every 2 that were needed because if one was misapplied it had to be scrapped as they were non-repositionable (easy to do when they all look the same and you have brain fatigue after 2 hours of sticking tiny labels onto identical boards). We also had to scan back each panel to confirm correct placement.
That was always going to be a temporary method while we found an automated way to apply the labels, but as with all temporary processes it ended up lasting 3 months and was horrible.
The issue we faced with automatically applying the labels was because we wanted variability in 2 degrees the cost was prohibitive for our budget. We were looking at around $30k for a machine that could print on demand and was basically a vacuum pick and place machine for labels.
We also faced the issue of stencils not sitting perfectly flush unless there was around 10mm border around the label which is not always possible. Our solution during testing was to have the label position cut out of the stencil and apply kapton tape to the squeegee-side, then remove the exposed adhesive with alcohol. It worked pretty well – I can only recall one repair where it snagged the blade. If we had kept going with labels we would have had the stencils only partially etched through, although those are expensive to produce.
We ended up using one of those 20W portable marking lasers you can pick up on any Chinese trade site to etch the codes directly onto the PCBs (we added a 7mm square white box to the screen-printing layer, and tweaked the laser so it produced a nice crisp almost black image). We modified an inspection conveyor to add a simple pneumatic board stop and a proximity sensor and used those to feed the laser software (it came with a Windows XP machine). Total external cost was around $6k.
It now just reads a single manually-applied barcode on the side bar of each panel which has the panel and design number encoded in it, looks up a CSV containing the centroids for the screen-printed boxes, and etches the panel, design and individual board number across an entire 300x220mm panel in about 2 seconds. No consumables, no waste, and it fits right after the magazine unloader so you can pull a panel at any stage of production and read off the tracking data. Once the panel is etched the tracking numbers are recorded in a database that are linked up when the final products are assembled and let us drill down into data such as which supplier provided a component, when it was checked into stock, which feeder and which machine applied it, even which batch of solder paste and the reflow profile that was used.
Note if using a fixed laser you need to consider the focal length as that determines the area you can etch onto. If you increase the distance to the board you increase the area it covers but you lose resolution. Our laser is about 350mm from the board and provides about 200dpi. Not as crisp as the labels were, but still scannable for our needs. If we needed to encode more data we would just make the barcode bigger.