CN108160508A - Machine vision detection method based on PLC serial communications - Google Patents

Machine vision detection method based on PLC serial communications Download PDF

Info

Publication number
CN108160508A
CN108160508A CN201711367510.2A CN201711367510A CN108160508A CN 108160508 A CN108160508 A CN 108160508A CN 201711367510 A CN201711367510 A CN 201711367510A CN 108160508 A CN108160508 A CN 108160508A
Authority
CN
China
Prior art keywords
plc
storehouse
testing result
pictures
moment
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Withdrawn
Application number
CN201711367510.2A
Other languages
Chinese (zh)
Inventor
亢君
于振
余天洪
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tianjin Puda Software Technology Co Ltd
Original Assignee
Tianjin Puda Software Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tianjin Puda Software Technology Co Ltd filed Critical Tianjin Puda Software Technology Co Ltd
Priority to CN201711367510.2A priority Critical patent/CN108160508A/en
Publication of CN108160508A publication Critical patent/CN108160508A/en
Withdrawn legal-status Critical Current

Links

Classifications

    • BPERFORMING OPERATIONS; TRANSPORTING
    • B07SEPARATING SOLIDS FROM SOLIDS; SORTING
    • B07CPOSTAL SORTING; SORTING INDIVIDUAL ARTICLES, OR BULK MATERIAL FIT TO BE SORTED PIECE-MEAL, e.g. BY PICKING
    • B07C5/00Sorting according to a characteristic or feature of the articles or material being sorted, e.g. by control effected by devices which detect or measure such characteristic or feature; Sorting by manually actuated devices, e.g. switches
    • BPERFORMING OPERATIONS; TRANSPORTING
    • B07SEPARATING SOLIDS FROM SOLIDS; SORTING
    • B07CPOSTAL SORTING; SORTING INDIVIDUAL ARTICLES, OR BULK MATERIAL FIT TO BE SORTED PIECE-MEAL, e.g. BY PICKING
    • B07C5/00Sorting according to a characteristic or feature of the articles or material being sorted, e.g. by control effected by devices which detect or measure such characteristic or feature; Sorting by manually actuated devices, e.g. switches
    • B07C5/36Sorting apparatus characterised by the means used for distribution
    • B07C5/361Processing or control devices therefor, e.g. escort memory
    • B07C5/362Separating or distributor mechanisms
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V20/00Scenes; Scene-specific elements
    • G06V20/10Terrestrial scenes

Abstract

The present invention relates to a kind of machine vision detection method based on PLC serial communications, including following several aspects:1) PC ends:Numbering cycle is all carried out to every pictures of examined object that camera obtains, the testing result coding and priority temporal order of every pictures are pressed into testing result storehouse from rear end.It opens up testing result and sends thread.2) PLC ends:Numbering cycle is carried out to each photographing signals, and establishes and rejects moment storehouse.

Description

Machine vision detection method based on PLC serial communications
Technical field
The present invention relates to a kind of diagnostic methods of detection device operation exception.
Background technology
Current more and more producers are right in industrial production line using the machine visual detection device based on computer and PLC The quality of product is detected.PC ends in such detection device are equipped with Machine Vision Detection software, are responsible for obtaining camera Product picture analyzed, judge whether it belongs to defective;PLC in equipment be mainly responsible for product by when triggering phase Machine takes pictures and controls defective rejecting mechanism to sort certified products and defective work.
At general industry scene, after PC ends inspection software detects defective products, a level wire size can be sent out by IO cards It exports to PLC or sends the value after defining to PLC fixing address from serial ports, Ethernet interface, inform PLC current productions for not Good product.Technically there are following several problems for such mode:1st, computer sends testing result signal latency issue and loses Signal problem.2nd, PLC delays receive testing result signal.3rd, PLC is counted has differences with inspection software transmission signal number.When After there is three cases above, PLC is not received by the bad letter of computer transmission when that should perform rejecting action Number situation about can not normally reject, causes detection device to occur the situation of flase drop and missing inspection in the process of running.Normally producing In the process, hidden danger is brought to product quality.
Invention content
In view of the above-mentioned problems, the purpose of the present invention is overcoming the above-mentioned deficiency of the prior art, provide a kind of based on PLC serial ports The machine vision detection method of communication.It is designed when PLC system of the present invention for PC inside machine visual detection device a kind of logical News verification rule, the rule can effectively solve the problems, such as that the communication inside detection device between PC and PLC system is asynchronous, be conducive to Accurate sorting of the equipment to non-defective unit and defective products.
To achieve the above object, the present invention takes following technical scheme:
A kind of machine vision detection method based on PLC serial communications, including following several aspects:
1) PC ends:
Processing is all numbered to every pictures of examined object that camera obtains, numbers and is recycled from 0 to 64, start to examine Number is forced to 0 during survey, as soon as then often acquisition figure, picture number add 1;It numbers to after 64, next pictures number is again Since 0, so in cycles;Every picture with number can be detected in different detection threads, when each After the completion of detecting thread detection, the testing result of every pictures is encoded according to following rules:Front two is picture number, Two are testing result afterwards:Non-defective unit is 01, defective products 02;The priority temporal order that this coding is completed according to detection is from rear Side pressure enters testing result storehouse.
It opens up testing result and sends thread:It is responsible for timing scan the above results storehouse, when having coding in scanning result storehouse It during data, is taken out from storehouse front end by data, when there is no coded data in scanning to result storehouse, generates a new volume Code, it is the picture number of coded data sent last time that the create-rule of coding, which is first two, and latter two are 64;It will take out or new The coded data of generation is sent to the testing result that PLC specifies by serial ports and stores address.
2) PLC ends
When trigger sensor senses examining object and is transferred to the input terminal of PLC, PLC control cameras are taken pictures, and are being sent out While photographing signals, processing is numbered to each photographing signals, number of taking pictures is recycled from 0 to 64, works as inspection software Number is forced to 0 when starting to detect, then control is taken pictures primary, and number of taking pictures just adds 1;It numbers to after 64, next number Again since 0, so in cycles;Establish a photographing signals storehouse from 0 to 64, take pictures number plus one it is same When, it is moved on the basis of current time plus an examining object from trigger sensor and rejects the position required time, obtained Moment code value in the form of storehouse is pressed into and rejects moment storehouse, rejects moment storehouse by code value at the time of going out to reject position successively Number for 64, when the number plus for the moment of taking pictures, a rejecting moment code value will be pressed into, be one-to-one with number of taking pictures.
Open up the testing result storage address that number is 0 to 64, when PLC receives the testing result that PC ends are sent out, PLC meetings The number of current detection result is parsed, this testing result is then stored into the detection identical with being numbered in PLC according to number As a result address is stored;When examined object rejects position along with PLC internal operation clocks to cylinder, internal clocking is with picking this moment Except the rejecting moment code value of moment storehouse bottom compares, if two times are identical, assert that examining object has moved Onto the position for rejecting cylinder;PLC enters the number of photographing signals storehouse by finding simultaneously with this rejecting moment code value, It is addressed in testing result storage address according to this number, if reading testing result identifies it as defective products, subsequent PLC controls System rejects cylinder and rejects this defective products.
Specific embodiment
The communication rule between PC ends inspection software, the coding rule at PLC ends and PC and PLC is retouched separately below It states.
PC ends inspection software:
Processing is all numbered in the every pictures obtained to camera, numbers and is recycled from 0 to 64, when inspection software starts to detect When number is forced to 0, as soon as then often acquisition figure, picture number add 1;It numbers to after 64, next pictures number is again from 0 Start, so in cycles.Every picture with number can be detected in different detection threads, when each detection After the completion of thread detection, the testing result of every figure is encoded according to following rules:Front two is picture number, latter two For testing result, non-defective unit 01, defective products 02.For example No. 13 picture is detected as unqualified, then it is encoded to 1302.By this A coding is pressed into storehouse according to the priority temporal order that detection is completed from rear end.When each inspection software starts detection, empty The result storehouse.
Inspection software has individual testing result to send thread, just starts when software starts detection, the thread It is responsible for timing scan the above results storehouse.When having coded data in scanning result storehouse, taken out from storehouse front end by data, when Scan when there is no coded data in result storehouse, will generate a new coding, the create-rule of coding be first two be on The picture number of the coded data of secondary transmission, latter two are 64.For example it is taken out from result storehouse during the scanning of last scan period Data for 1301, there is no coded data in current scanning discovery result storehouse, then the new coded data of generation is 1364. The result sends that thread will take out or newly-generated coded data is sent to the result that PLC specifies by serial ports and receives address.It should The time cycle of thread timing scan result storehouse generally could be provided as 150ms or so, can meet between major part PC and PLC Serial communication requirement.
PLC ends
For PLC ends, after trigger sensor senses examining object, sensor sends out level signal and is transferred to The input terminal of PLC, after PLC is kept and filtered by signal, delay sends out level signal control camera and takes pictures.Sending out letter of taking pictures Number while, processing is numbered to each photographing signals, number from 0 to 64 recycle, when inspection software start detection when Number is forced to 0, then control is taken pictures primary, and number of taking pictures just adds 1;It numbers to after 64, next is numbered again since 0, So in cycles.PLC can establish a photographing signals storehouse from 0 to 64, while while number plus one is taken pictures, It is moved on the basis of current time plus an object to be checked from trigger sensor and rejects the position required time, obtained Code value in the form of storehouse is pressed into and rejects moment storehouse by code value at the time of one rejecting position successively, and the number of storehouse is 64, When number plus a period of time of taking pictures, a rejecting moment code value will be pressed into, is one-to-one actually with number of taking pictures.
On the problem of PLC reception results, PLC hews out the testing result storage address that a number is 0 to 64, example Such as:1 address of number, 2 address ... of number are until the address of number 64.When PLC receives the testing result that computer is sent out, The number that PLC can parse current detection result is how many, then stores this testing result with being numbered in PLC according to number Identical testing result storage address.Such as:Computer receives the detection picture of the 15th examined object, by software image After processing, generate the coding that number is 1502 and be sent to PLC.Examined object along with PLC internal clockings continuity forward Operation, when run to cylinder reject position when, this moment internal clocking with rejecting moment storehouse bottom rejecting moment code value phase Compare, if two times are essentially identical, we are it can be assumed that examining object has been moved into the position for rejecting cylinder On, it is simultaneously 15 into the number of photographing signals storehouse that at this moment PLC, which will be found with this rejecting moment code value, then PLC roots Number goes addressing testing result to store the address that number is 15 in address accordingly, and it is 1502 to parse interior to coding in address, explanation This examining object is a defective products, and subsequent PLC controls reject cylinder and reject this defective products.
By the completely new number communication modes of more than software and hardware, thoroughly solve and following several occur in general communication Problem, 1, serial communication signal overturn transmission problem, such as the image results first detected than rear detection image results fall behind hair It send, because not numbering control, PLC will be considered that the detection signal for first receiving that signal must be front examining object, thus go out The situation of signal disorder is showed.2nd, if detection signal goes out active, because without reference numeral, which does not have It receives, so the failure for missing inspection occur occurs.3rd, rejecting distance of the equipment to defective products is increased, because stack area has 64 A stack bit corresponds, more masterly compared with traditional PLC single channel result treatments.
Meanwhile during communication, method that we invent a set of abnormal signal selfreparing also according to its characteristic.
PC the ends automatic diagnosis and selfreparing abnormal with PLC end communications
In equipment operation, it is possible that the situation of software detection exception or computer exception, once occur such Abnormal, software can stop sending signal to PLC or send the signal that result is 00.
In order to solve problem above, after software receives picture, one and the corresponding volume of current image are sent to PLC Number value, PLC can number identical result storage address according to numbering be placed on after parsing after receiving this signal with it In.To when rejecting position, PLC reads the coding of result storage address, and if there is the situation that result is 00, we can regard letter This examining object is forced to reject by number abnormality processing.If repeatedly reading result is 00, this illustrates computer software or logical Occur abnormal conditions in news, PLC can be forced to restart computer and software, be restarted to detect after restarting, start to detect Simultaneously to storehouses clear 0 all inside computer and PLC, work normally software, wherein by examining object force to reject There is missing inspection in guarantee.
PC ends and the skimble-scamble automatic diagnosis of PLC ends picture number and selfreparing
In equipment operation, in fact it could happen that PC ends picture number and PLC take pictures and number skimble-scamble situation, for example work as equipment In production process, sensor sense have examined object by when, PLC adds up in the flip-flop number storehouse of oneself, and sends out The level signal that control camera is taken pictures, but camera may be because other abnormal conditions such as signal interference or camera shutdown, cause Camera is not carried out taking pictures and acts or repeatedly take pictures, and camera does not acquire or acquire more picture.COMPUTER DETECTION picture Number be not consistent with the photographing signals quantity that PLC is sent out centainly, when PLC read testing result when be not centainly really currently to treat The legitimate reading of object is examined, because above exception leads to missing inspection and flase drop.In order to solve more than fault condition, we invent again Two kinds of methods of calibration numbered between computer and PLC.
Condition verifies:According to the characteristic of 64 check code of more than inspection software, when between trigger sensor and rejecting cylinder Do not have examining object by when, PLC has received the coded data of a pictures number band 64 again at this time, and PLC can be compiled with result The photographing signals storehouse inside verification PLC is forced on the basis of number.Such as:At this time without object to be checked between sensor and rejecting position Body, simultaneous computer send the signal that current sequence number is 12 band, 64 check bit to PLC again, i.e. 1264, PLC receives this knot After fruit, after parsing, learn present image as 12, receive the check bit that result is 64, PLC can verify with computer serial number, On the basis of computer current sequence number 12, the change current photographing signals storehouses of PLC are forced, so as to ensure to read result next time When, it can number and correspond with software.Reach the unification of PLC and computer storehouse serial number, and then realize the purpose of condition verification.
Verification in real time:When PLC is rejecting location resolution as a result, it has been found that result number and the photographing signals storehouse serial number of oneself When different, this detection object can be forced to reject, stopping triggering camera is then forced to be taken pictures and waits for the time of more than 300ms, The later computers of 300ms can send out the last one and go out the 64 check bit of serial number band of storehouse as a result, PLC will be with this testing result On the basis of storehouse serial number, verification PLC is forced to take pictures serial number storehouse, is consistent it.Pass through phase in the 300ms for stopping taking pictures The examining object of machine is all forced to reject, to prevent there is missing inspection.

Claims (1)

1. a kind of machine vision detection method based on PLC serial communications, including following several aspects:
1) PC ends:
Processing is all numbered to every pictures of examined object that camera obtains, numbers and is recycled from 0 to 64, when starting detection Number is forced to 0, as soon as then often acquisition figure, picture number add 1;It numbers to after 64, next pictures number is opened again from 0 Begin, so in cycles;Every picture with number can be detected in different detection threads, when each detection line After the completion of journey detection, the testing result of every pictures is encoded according to following rules:Front two is picture number, latter two For testing result:Non-defective unit is 01, defective products 02;This coding is pressed into according to the priority temporal order that detection is completed from rear end Testing result storehouse;
It opens up testing result and sends thread:It is responsible for timing scan the above results storehouse, when having coded data in scanning result storehouse When, it is taken out from storehouse front end by data, when there is no coded data in scanning to result storehouse, generates a new coding, compile It is the picture number of coded data sent last time that the create-rule of code, which is first two, and latter two are 64;It will take out or newly-generated Coded data the testing result that PLC specifies be sent to by serial ports store address.
2) PLC ends
When trigger sensor senses examining object and is transferred to the input terminal of PLC, PLC control cameras are taken pictures, and are taken pictures sending out While signal, processing is numbered to each photographing signals, number of taking pictures is recycled from 0 to 64, when inspection software starts Number is forced to 0 during detection, then control is taken pictures primary, and number of taking pictures just adds 1;It numbers to after 64, next number is again from 0 Start, so in cycles;A photographing signals storehouse from 0 to 64 is established, while number plus one is taken pictures, to work as It is moved on the basis of the preceding moment plus an examining object from trigger sensor and rejects the position required time, obtained and reject position Code value at the time of putting, moment code value in the form of storehouse is pressed into successively and rejects moment storehouse, and the number for rejecting moment storehouse is 64, when number plus a period of time of taking pictures, a rejecting moment code value will be pressed into, is one-to-one with number of taking pictures;
The testing result storage address that number is 0 to 64 is opened up, when PLC receives the testing result that PC ends are sent out, PLC can be parsed Go out the number of current detection result, this testing result is then stored into the testing result identical with being numbered in PLC according to number Store address;When examined object rejects position along with PLC internal operation clocks to cylinder, when internal clocking is with rejecting this moment The rejecting moment code value for carving storehouse bottom compares, if two times are identical, assert that examining object is moved into On the position for rejecting cylinder;PLC enters the number of photographing signals storehouse by finding simultaneously with this rejecting moment code value, according to This number addresses in testing result storage address, if reading testing result identifies it as defective products, subsequent PLC controls are picked Except cylinder rejects this defective products.
CN201711367510.2A 2017-12-18 2017-12-18 Machine vision detection method based on PLC serial communications Withdrawn CN108160508A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201711367510.2A CN108160508A (en) 2017-12-18 2017-12-18 Machine vision detection method based on PLC serial communications

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201711367510.2A CN108160508A (en) 2017-12-18 2017-12-18 Machine vision detection method based on PLC serial communications

Publications (1)

Publication Number Publication Date
CN108160508A true CN108160508A (en) 2018-06-15

Family

ID=62522576

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201711367510.2A Withdrawn CN108160508A (en) 2017-12-18 2017-12-18 Machine vision detection method based on PLC serial communications

Country Status (1)

Country Link
CN (1) CN108160508A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109507205A (en) * 2018-12-24 2019-03-22 欣辰卓锐(苏州)智能装备有限公司 A kind of vision detection system and its detection method
CN110538805A (en) * 2019-08-28 2019-12-06 东莞西尼自动化科技有限公司 High-precision high-speed glass rotary table visual inspection machine
CN112139050A (en) * 2020-09-08 2020-12-29 佛山读图科技有限公司 Cooperative light inspection method and system for high-speed product transmission
CN112763497A (en) * 2020-12-24 2021-05-07 凌云光技术股份有限公司 Visual inspection image sequence matching system and method based on level coding triggering

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105511315A (en) * 2015-12-01 2016-04-20 天津普达软件技术有限公司 Method for enabling machine vision detection and controller to remain synchronous
CN105548209A (en) * 2015-12-03 2016-05-04 安硕文教用品(上海)股份有限公司 Defect detecting and sorting device used in processing process of wood pencil plate
WO2016178588A1 (en) * 2015-05-06 2016-11-10 Compac Technologies Limited Apparatus and method for sorting articles
CN107323767A (en) * 2017-07-31 2017-11-07 深圳市欧视达自动化设备有限公司 A kind of chewing gum packing detecting system and detection method
CN206701760U (en) * 2017-05-10 2017-12-05 青岛金岸新区智能科技有限公司 A kind of image recognition detection line
CN107478659A (en) * 2017-07-12 2017-12-15 广东文鼎智能科技有限公司 Using the general tea fruit grading plant of the mandarin orange of machine vision technique and method

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2016178588A1 (en) * 2015-05-06 2016-11-10 Compac Technologies Limited Apparatus and method for sorting articles
CN105511315A (en) * 2015-12-01 2016-04-20 天津普达软件技术有限公司 Method for enabling machine vision detection and controller to remain synchronous
CN105548209A (en) * 2015-12-03 2016-05-04 安硕文教用品(上海)股份有限公司 Defect detecting and sorting device used in processing process of wood pencil plate
CN206701760U (en) * 2017-05-10 2017-12-05 青岛金岸新区智能科技有限公司 A kind of image recognition detection line
CN107478659A (en) * 2017-07-12 2017-12-15 广东文鼎智能科技有限公司 Using the general tea fruit grading plant of the mandarin orange of machine vision technique and method
CN107323767A (en) * 2017-07-31 2017-11-07 深圳市欧视达自动化设备有限公司 A kind of chewing gum packing detecting system and detection method

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109507205A (en) * 2018-12-24 2019-03-22 欣辰卓锐(苏州)智能装备有限公司 A kind of vision detection system and its detection method
CN110538805A (en) * 2019-08-28 2019-12-06 东莞西尼自动化科技有限公司 High-precision high-speed glass rotary table visual inspection machine
CN112139050A (en) * 2020-09-08 2020-12-29 佛山读图科技有限公司 Cooperative light inspection method and system for high-speed product transmission
CN112139050B (en) * 2020-09-08 2021-08-03 佛山读图科技有限公司 Cooperative light inspection method and system for high-speed product transmission
CN112763497A (en) * 2020-12-24 2021-05-07 凌云光技术股份有限公司 Visual inspection image sequence matching system and method based on level coding triggering
CN112763497B (en) * 2020-12-24 2023-10-27 凌云光技术股份有限公司 Visual detection image sequence matching system and method based on level coding triggering

Similar Documents

Publication Publication Date Title
CN108160508A (en) Machine vision detection method based on PLC serial communications
CN108196524A (en) Machine vision equipment communication method of calibration based on PLC serial communications
CN105783730B (en) Detection method, device, system and the detection machine of screw
CN108153224A (en) Machine visual detection device PC ends and the diagnostic method of PLC end communications exception
US20180276811A1 (en) Automatic optical inspection system and operating method thereof
CN108872247A (en) A kind of product automatic checkout system and detection method based on machine vision and RFID
US20070286471A1 (en) Auto Distinction System And Auto Distinction Method
CN108160525A (en) A kind of diagnostic method of machine visual detection device operation exception
DE102015213845A1 (en) Method and device for validating a time stamp of a data transmission
CN105301012B (en) A kind of capsule detection method
CN101531258B (en) Machine vision-based instant noodle seasoning packet automatic detection instrument and method
US20160346979A1 (en) Injection molding system
CN109507205A (en) A kind of vision detection system and its detection method
CA2100322C (en) Method and apparatus for monitoring image processing operations
CN109738455A (en) A kind of packaging belt detection system and interaction control method based on deep learning
CN107667286B (en) Container inspection apparatus and container inspection method for inspecting containers
CN106851408A (en) A kind of television set throws screen monitoring device and method
CN111951225A (en) PCB welding abnormity detection method and device and storage medium
CN108107828A (en) Machine visual detection device PC ends and the restorative procedure of PLC end communications exception
CN108170547A (en) A kind of restorative procedure of machine visual detection device operation exception
KR102253385B1 (en) detecting system of multi-packaging error
CN103984967B (en) A kind of automatic checkout system being applied to Commercial goods labels detection and automatic testing method
CN104181458B (en) The detection method and detection means of a kind of PCBA board
CN108333186A (en) Go mouldy detecting system and its detection method based on the surfaces Yan Duo
CN103718025A (en) Container mouth portion inspection method and device

Legal Events

Date Code Title Description
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
WW01 Invention patent application withdrawn after publication

Application publication date: 20180615

WW01 Invention patent application withdrawn after publication