Reading Barcode data

More
23 Feb 2025 21:24 #322403 by aluplastvz
Reading Barcode data was created by aluplastvz
Hello everyone
I have an idea to use Linuxcnc to process the outer edges of the board with the X and Y position, but I want to read the barcode that contains the X and Y values ​​and automatically start the processing, does anyone have an idea how to do it

Please Log in or Create an account to join the conversation.

  • tommylight
  • tommylight's Avatar
  • Away
  • Moderator
  • Moderator
More
23 Feb 2025 22:07 #322414 by tommylight
Replied by tommylight on topic Reading Barcode data
Probably using OpenCV (not related to LinuxCNC, github project, open source), as there are already some examples of using it with LinuxCNC, see QtPlasmaC and how it uses it to skew the whole gcode to material.
The following user(s) said Thank You: aluplastvz

Please Log in or Create an account to join the conversation.

  • rodw
  • rodw's Avatar
  • Away
  • Platinum Member
  • Platinum Member
More
24 Feb 2025 10:01 #322477 by rodw
Replied by rodw on topic Reading Barcode data
Yes, you would need to digitize the barcode and opencv sounds as good as any. It may have a barcode parser.
To do it yourself you would first need to determine the barcode symbology
There is a phone app called Barcode Data Decoder which will do this.
assuming a 2D symbology, barcodes usually have a start and a stop sequence. Barcode characters are made up of bars and spaces. These are defined as being multiples of the narrow bar width. If you are generating barcodes on a Zebra ZPL printer like I do, the narrow bar is defined as being 1,2 or 3 pixels wide (@203 dpi). Wider barcodes are easier to read. 1 pixel wide narrow bar is nearly impossible to read.

So then you can study up on your symbology and understand its structure.
If you are choosing the symbology, CODE39 is probably the easiest to parse at a low level but its not very compact. Code 128 is more compact but  harder to parse. ref: en.wikipedia.org/wiki/Code_39
The following user(s) said Thank You: aluplastvz

Please Log in or Create an account to join the conversation.

  • rodw
  • rodw's Avatar
  • Away
  • Platinum Member
  • Platinum Member
More
24 Feb 2025 10:04 #322478 by rodw
Replied by rodw on topic Reading Barcode data
An alternative could be to use a barcode scanner. These will plug into your computer as a HID keyboard device. There are some small barcode modules that are RS232 devices. www.aliexpress.com/item/1005007002453623...OfpGuWBoClGYQAvD_BwE
The following user(s) said Thank You: aluplastvz

Please Log in or Create an account to join the conversation.

More
24 Feb 2025 14:12 #322487 by Hastrh2o
Replied by Hastrh2o on topic Reading Barcode data
Forgot OpenCV, and use a barcode scanner.
I do this way to scan the worksheet and load the G-Code according to the type of part which I need to machine. The bar code scanner act as a keyboard, and I use a few python in the handler.py file to get what I need.
The following user(s) said Thank You: aluplastvz, rodw

Please Log in or Create an account to join the conversation.

More
03 Mar 2025 00:03 #323060 by noqui
Replied by noqui on topic Reading Barcode data
Hastrh2o Can you share and example? Thanks a lot. 

Please Log in or Create an account to join the conversation.

More
06 Mar 2025 20:44 #323368 by aluplastvz
Replied by aluplastvz on topic Reading Barcode data
I was a bit busy with other work, so I didn't respond to your answers earlier.
The barcode has 2 series of numbers with 5 characters x+y, I can do that in the plc controller, but only the positioning is the hardest part for me, that's why I thought that maybe there is a solution, for example in linuxcnc, which is much better for positioning.

Please Log in or Create an account to join the conversation.

More
08 Mar 2025 13:16 - 08 Mar 2025 13:19 #323522 by Hastrh2o
Replied by Hastrh2o on topic Reading Barcode data
@noqui

In the ui, I add a lineEdit wich I named "ofedit" (and some more) and then in qtaxis_handler.py I add (the except part is just here to allow me to try without the thrue work order barcode) :

def ofedit_changed(self):
if len(self.w.lineEdit.text()) == 16:
try:
codesData = pd.read_csv('codes_articles.csv', index_col=0)
self.w.lineEdit_3.setText(self.w.lineEdit.text()[0:16])
self.w.lineEdit_2.setText(codesData.loc[self.w.lineEdit_3.text(), "Variante"])
except :
self.w.lineEdit.setText("EJEVAP17050---M")
self.w.lineEdit_2.setText("")
self.w.lineEdit_3.setText("")
pass

This allow to look into a csv file for the work order code if I read something which is 16 caracters long with the barcode reader
Last edit: 08 Mar 2025 13:19 by Hastrh2o.

Please Log in or Create an account to join the conversation.

Time to create page: 0.075 seconds
Powered by Kunena Forum