News:

  • May 05, 2026, 12:49:23 PM

Login with username, password and session length

Author Topic: Barcode ID with Do-More  (Read 16158 times)

jwbaker3

  • Hero Member
  • *****
  • Posts: 142
Barcode ID with Do-More
« on: April 26, 2013, 02:49:21 PM »
I need to read the barcode on bottles on the production line, decide if it is name brand or private lable. (we could also use a vision system but the bottles already have a barcode on them and the system cost should be less) If name brand we need to know what the product is. Then if it is namebrand product 1 send 24 vdc to input 1 on a leibinger lj3 printer to print job 1, if it is namebrand product 2 send 24vdc to input 2 on the printer to print job 2, same for namebrand 3 to input 3 and if private label 24 vdc to input 4 to print job 4. I know the Do-More will interface with a barcode reader (I dont know which ones), but how (can?) the plc lookup the bardcode to know which product it is? There are a lot of barcodes and they may change (new products) and will require updating. What is the best way to do this? The product will be made in batches, they are trying to take the human from happening when a batch change accures and the wrong thing is printed on the bottle. I have done a lot of PLC work but never with a barcode reader or a lookup table. 

Thanks,
JW

plcnut

  • Hero Member
  • *****
  • Posts: 814
    • premiersi.com
Re: Barcode ID with Do-More
« Reply #1 on: April 26, 2013, 02:54:55 PM »
What is "a lot of bar codes"?
What are the bar codes? (numbers only, or alphanumeric)
How fast is it?
Are you checking each bottle, or only the batch?
Circumstances don't determine who we are, they only reveal it.

~Jason Wolthuis
Premier Systems Integration, LLC
http://premiersi.com

jwbaker3

  • Hero Member
  • *****
  • Posts: 142
Re: Barcode ID with Do-More
« Reply #2 on: April 26, 2013, 05:06:09 PM »
I am waiting for the database with the barcodes. I think they are numbers only. We will look at each bottle, but there is a gap between products..so maybe I need to read the first in the batch and some during the run to make sure. The bottles are passing the barcode reader at about 60 to 80  per minute max.

Thanks,
JW

plcnut

  • Hero Member
  • *****
  • Posts: 814
    • premiersi.com
Re: Barcode ID with Do-More
« Reply #3 on: April 26, 2013, 06:15:45 PM »
You can get the data into the PLC in a couple of ways: Scanning the codes and use an HMI to tell the PLC what category the code is, or you could use something like a .php script that interfaces with a database.

Numeric only barcodes should be easy and fast to search, Strings can take a little longer.

Communicating with a scanner should be pretty easy, but make sure you spec a scanner fast enough to do what you need (comms as well as scans per second).

Circumstances don't determine who we are, they only reveal it.

~Jason Wolthuis
Premier Systems Integration, LLC
http://premiersi.com

jwbaker3

  • Hero Member
  • *****
  • Posts: 142
Re: Barcode ID with Do-More
« Reply #4 on: April 30, 2013, 08:38:10 AM »
Thank you for the reply plcnut. I should have the barcode list by the end of the week. If the list is not too long could I just do the matching in the PLC? I am not sure how to use the HMI for this, but I am hoping the list manageable.

Thanks,
JW

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6154
  • Yes Pinky, Do-more will control the world!
Re: Barcode ID with Do-More
« Reply #5 on: April 30, 2013, 08:48:33 AM »
Hmmm...

I'm seeing a binary string search task example coming on. The 'more' that Do-more was designed to do! ;)
"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO

jwbaker3

  • Hero Member
  • *****
  • Posts: 142
Re: Barcode ID with Do-More
« Reply #6 on: May 01, 2013, 10:57:53 AM »
I got the list of UPC codes they are 10 digit (Some 11 some 5 but they are outside of the range I need to look at) numbers only. There are 450 total but I think we will only see about 300 on the line we are working on. I want to look at the barcode and if it is within range 1 turn on output 1, if it is within range 2 turn on output 2, if within range 3 turn on output 3, if not 1 2 or 3 turn on output 4. The first 5 numbers for ranges 1,2 and 3 are all the same. Any suggestions on the best way to do this?

Thanks,
JW

plcnut

  • Hero Member
  • *****
  • Posts: 814
    • premiersi.com
Re: Barcode ID with Do-More
« Reply #7 on: May 01, 2013, 11:11:07 AM »
Sounds simple,
STREAMIN
STR2INT
Compares with < > to SET bits.

Circumstances don't determine who we are, they only reveal it.

~Jason Wolthuis
Premier Systems Integration, LLC
http://premiersi.com

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6154
  • Yes Pinky, Do-more will control the world!
Re: Barcode ID with Do-More
« Reply #8 on: May 01, 2013, 12:15:11 PM »
I got the list of UPC codes they are 10 digit (Some 11 some 5 but they are outside of the range I need to look at) numbers only. There are 450 total but I think we will only see about 300 on the line we are working on. I want to look at the barcode and if it is within range 1 turn on output 1, if it is within range 2 turn on output 2, if within range 3 turn on output 3, if not 1 2 or 3 turn on output 4. The first 5 numbers for ranges 1,2 and 3 are all the same. Any suggestions on the best way to do this?

I agree with 'nut...except for one possible caveat. The range of a 32 bit integer is -2147483648 to 2147483647, or for our purposes, 0 to 2147483647. If the first 5 digits are less than or equal to 21474xxxxx, then yes STREAMIN to read data, STR2INT to convert, and a handful of relational contacts to do the compares and set bits.

If the first 5 are outside that range, then you will need to do some string processing to lop off the first 5 characters and first compare them to your 1, 2, and 3 ranges first 5, and then if they match do a STR2INT on the last 5 digits and do the compares.

If there are different lengths of codes, which it sound like there is, you will first have to normalize the input string to a known fixed length before doing the other work.

Conceptually it might end up being something like this (in psuedocode):
Code: [Select]
InputStr = StreamIn()
if(InputStr.Length > 10)
   Group = 4
else
   NormalizedStr = FmtString(InputStr, 10, right)
   Left5Digits = StrSub(NormalizedStr, 5, left)
   if(Left5Digits != Group123Prefix)
      Group = 4
   else
      Right5Digits = StrSub(NormalizedStr, 5, right)
      BarCodeValue = Str2Int(Right5Digits)
      if(BarCodeValue >= Group1Start && BarCodeValue <= Group1End)
          Group = 1
      else if(BarCodeValue >= Group2Start && BarCodeValue <= Group2End)
          Group = 2
      else if(BarCodeValue >= Group3Start && BarCodeValue <= Group3End)
          Group = 3
      else
          Group = 4         
« Last Edit: May 01, 2013, 12:16:55 PM by BobO »
"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO