Home

MACHINE VISION AND OBJECT SORTING

image

Contents

1. Figure 33 NI LabVIEW Front Panel Pokharel 2013 7 1 2 LabVIEW block diagram LabVIEW block diagram serves as the brain of the program All inputs and outputs are wired in the block diagram The block diagram basically 26 Machine Vision and Object Sorting PLC Communication with LabVIEW using OPC pnm m n c m e mI eee consists of different functions such as mathematical functions Boolean functions programming loops etc Figure 34 shows the LabVIEW block diagram window with the necessary wirings for the Front panel discussed in sub section 7 1 1 An express VI named Simulate signal was used to simulate a sine signal Also a uniform noise was defined in it A filtering express VI was used to filter the noisy sine signal In the Front panel window shown in Figure 33 of sub section 7 1 1 above the noisy and filtered sine signals can be viewed The noisy signal 1s the white signal whereas the filtered sine sig nal is the red one Also two numeric controls are connected to logical operators gt and lt Each logical operation has its output shown with a LED The whole block diagram is placed inside a WHILE loop The loop has a time lag of 100 milliseconds and a stop control to stop the loop operation The controls are done in the Front panel Untitled 2 Block Diagram File Edit View Project Operate Tools Window Help Functions Q search S customize v Program
2. Rotate O otpt Ja 06 Boot JSA J Reste 80 or sot A Rotate 180 opt a 204 Boor Lo LLISet amp 0 t ts Boo 1 sor move a 10 o L me e Wu O 0 o0 forte Mve a 12 Boor y Ol 77 E BogL M Stop Cyce amp rc 3 fre 3 l mae 10 eos 3 A uw um EU LE aem tables 12 ECTS e SEG mwew Jr os Bot 4 EA 0 NAME Ww A wa M 99 LU 4 Page 1 of 1 Machine Vision and Object Sorting PLC Communication with LabVIEW using OPC PATATA A AAA AAA Appendix 3 STEP 7 OB 100 Complete Restart Organization Block SIMATIC Object sorting 04 24 2013 01 59 03 PM SIMATIC 300 1 CPU 315 2 DP OB100 offline OB100 lt offline gt COMPLETE RESTART Name Family Author Version 0 1 Block ver
3. know 50 Machine Vision and Object Sorting PLC Communication with LabVIEW using OPC Appendix 1 STEP 7 OB1 Functions Call SIMATIC Object sorting 04 24 2013 01 58 17 PM SIMATIC 300 1 NCPU 315 2 DPX 1OB1 offline OB1 offline CYCL EXC Name Family Author Version 0 1 Block version 2 Time stamp Code 04 24 2013 01 57 17 PM Interface 02 15 1996 04 51 12 PM Lengths block logic data 00168 00050 00022 lame Data Type Address Comment TEMP E 0 0 M ierat UPS nrc pem SS amanie me rana E CT eee sas ainina a O a a iE ARI m SENE UIEME OBl1 EV CLASS Byte Bits 0 3 1 Coming event Bits 4 7 1 Event class 1 OBl SCAN 1 Byte 1 Cold restart scan 1 of OB 1 3 Scan 2 n of OB 1 HRS OBl PRIORITY Byte Priority of OB Execution OB1_OB_NUMBR Byte 1 Organization block 1 0B1 i O i OBl1 RESERVED 1l Byte Reserved TEE ELEM M en na d Pase 707 awa fun E OBl PREV CYCLE Int 6 0 Cycle time of previous OBl scan milliseconds OBl1 MIN CYCLE Int 8 0 Minimum cycle time of OB1 milliseconds LT OBl MAX CYCLE Int 10 0 Maximum cycle time of OB1 milliseconds ibd OBl DATE TIME Date And Time Date and time OBl started en Block OB1 Main Program Sweep Cycle Program Sequence EN EN FC Reset Sorter EN Page 1 of 2 Machine Visi
4. Figure 36 NI IMAQ blocks Pokharel 2013 Note At the end of every vision application the created image must be disposed using IMAQ Dispose Vision Utilities gt gt Image Management 7 2 4 Image analysis The created image has to be further analyzed As described before differ ent image analysis techniques can be applied for this purpose Figure 37 29 Machine Vision and Object Sorting PLC Communication with LabVIEW using OPC pm nee s n cm e mene below shows the different 1mage analysis functions available in NI vision module Processina APE C search d Sy customize IMAQ Threshold IMAQ MultiTh E lt gt a a IMAQ Inverse IMAG AutoBT Figure 37 Different image analysis VIs in NI Vision module Pokharel 2013 7 2 5 Acquiring or reading an image Finally an image is acquired The acquiring or reading of the image is pos sible from an image acquisition device such as the camera or from an im age stored in a directory in the computer or converting a 2D array into an image Typically separate image acquisition devices are available for industries Such devices have several inbuilt capabilities for industrial machine vision applications But for this thesis project a simple webcam was used as the image acquisition device It is shown in Figure 38 Figure 38 Logitech HD Webcam C615 Logitech Figure 39 below shows the express image acquisition functions available in NI vision module
5. that was created in the OPC server The part of LabVIEW block diagram that executes for sorting purpose is shown in Figure 66 ovieng the sorter If pattern matches Figure 66 Object sorting section of the LabVIEW block diagram Pokharel 2013 Every time the image matched the template image or number of matches was equal to or greater than 1 the sorter moved and thus sorted the object One tag was only used to make the program in LabVIEW simpler As Machine Vision and Object Sorting PLC Communication with LabVIEW using OPC A AN mentioned before in section6 the sorter reset was done in the automation codes in STEP 7 Hence the developed machine vision application was tested for object sorting Machine Vision and Object Sorting PLC Communication with LabVIEW using OPC 9 CONCLUSIONS From the project performed 1t was obvious that machine vision technolo gy and NI Vision tools together can be used for sorting objects in a factory production line It was confirmed that out of many machine vision tools the pattern matching algorithm could be applied for the object sorting pur pose Also 1t was clear that a simple webcam could be used for perform ing machine visions tasks Because a webcam was used for pattern match ing it 1s not for sure that it can be used for different machine vision appli cations But 1f the application is independent of different image pro cessing tasks 1t might be possible to use webca
6. 2013 Provide a suitable channel name for example Siemens and click Next button In the next window of the wizard the device driver being used needs to be defined For example in this thesis project Siemens S7 MPI driver was selected click on Next gt button Now the necessary communication parameters are defined in the next window of the wizard The communication parameters de fined for this thesis project 1s shown in Figure 42 below Note that the parameters should be correct for the communication For ex ample the baud rate for the PLC used was 19200 32 Machine Vision and Object Sorting PLC Communication with LabVIEW using OPC ASADA New Channel Communications xi comip p Baud rate i20 y Data bits le B Barty odd y Stop bits fe 1 Blow control RTS Aways y v Report comm errors Close connection when no longer needed after 15 seconds of idle time m neo om orem Figure 42 Communication Parameters setting for OPC Server Pokharel 2013 Continue with the wizard providing the parameters necessary until the final window of the wizard appears where a summary of the configuration can be seen as shown in Figure 43 To change any configuration parameter Back button can be clicked New Channel Summary If the following information is correct click Finish to save the settings for the new channel Figure 43 Summary of the parameter configuration for OPC se
7. filters are not included in this thesis But image National usually the software that is being used for struments machine vision has most of the common filters inbuilt Figure 18 alongside shows the binary image after us ing a filter to reduce the noise present in Figure 17 b above 3 3 Output Output is of immense importance in any process Something is done to get something in return Machine vision applications also have a final output Generally the outputs of machine vision applications are categorized as Pass Fail But additional attributes for Pass Fail outputs can also be de fined for instance number of passed failed items setting an alarm if the items are failed and so on It depends on the objective of the application But it is always significant to define the attributes for further R amp D tasks Figure 19 illustrates an easy to understand representation of output start ing from image acquisition in a machine vision application Image acquisition done Image analysis done Image meets the setup specifica tions Figure 19 A simple schematic representation of machine vision process Pokharel 2013 15 Machine Vision and Object Sorting PLC Communication with LabVIEW using OPC 4 MACHINE VISION AND OBJECT SORTING Object sorting is one of the most important processes in industrial produc tion lines During the production process many damaged or undesirable products are also produced These kinds
8. ture to bundle of rays from each point on the scene onto the corresponding point in the image as indicated by the geometry of perspective projection A lens gathers more light allowing the camera to work with less ambient illumination or with a faster shutter speed but the depth of field is limited Jain Kasturi amp Schunck 1995 249 Machine Vision and Object Sorting PLC Communication with LabVIEW using OPC It might be necessary to calculate the depth of field in order to select a camera lens for a particular machine vision application The lens equation and the image resolution are required for this calculation The lens equa tion and image resolution are explained in brief in the following sub sections Jain et al 1995 250 2 4 1 Lens equation The lens equation 2 4 1 relates the distance z image distance of the 1m age plane from the centre of the lens optical origin O the distance z ob ject distance to the point in the scene and the focal length fl of the lens as Jain et al 1995 250 1 1 l 2 4 1 Figure 9 Mechanism of image formation by a lens Pokharel 2013 Figure 9 above shows the general mechanism of image formation by lens In optical systems the important variables are f number aperture size luminance focal length field of view and the depth of field 2 4 2 f number f number is defined as the ratio of focal length to the diameter of the ap erture aperture is only
9. 2D Machine VISION OO Sd diia 11 2 5 1 Image processing and filtering toolS occcccccccnonononcnnnnnnnnnononnnnnnss 12 2 5 2 Positioning or Locating counting and measurement tools 12 239 IAPplca ton Specie T60lS 25 sous edet dri esa Domos eet obiter 12 2 0 JDeNXICe COMMUNICATIONS us erae aen dicen etude oed o a ee adds 12 3 MACHINE VISION PROCESS uo pedUzz is 14 SX MEM E A ON 14 32 Imane POCOS dida 14 929 DUDO isa 15 4 MACHINE VISION AND OBJECT SORTING eere 16 4 1 Machine vision methods for object sorting ccccccccononocnnnnnnnnnnnnnnnocnnnnnnncnononanos 16 Atl CSDL EU aa seat 16 2 12 Pare deteccion ei le io Leite id Mato led 17 Alo Geometric Match sa alas 18 3 SORTINO STATION era Doer MERO cio 20 dl Construction THE stalo ar ds 21 5 2 VISION Sect of INE Saona sas 21 2 9 a stem COMMIMMICAION iaa 22 0 AUTOMATION OP THE STATION tdt aee res ope iia 23 Od STEP professional ina 23 A 24 Or Hardware ccOBDTe UEOTTOTI os dodi estote rc daa 24 T NILABVIEW cicero 25 Tob Male VTE WW WAS ICS esc idol sica 25 LIA LabVIEW Iront panel ls 26 T2 LabYTEW DIOCK AAA a Aoc 26 AP 21 T2 Setme up the macs sto is das 28 7 2 2 Calibrating the imaging system sse 28 do CAC ARI A ded cee atta red dva Sled ac seat retin dts 29 De MAS analy S oi 29 132 9 ACQUIIING OF readin an IMASE is 30 4 2 0 DUS VAY TE TN AINA E cocos v
10. An STEP7 automation program may contain functions FCs function blocks FBs organization blocks OBs sequence functional charts SFCs etc But every STEP7 program must have OB1 because it is the main function Details about the STEP7 programs are not covered in this thesis The language used for the automation of the system described in this thesis was FBD A screenshot of the codes is shown in Figure 29 alongside But the complete program codes can be found as Appendix 1 to Appendix 6 Figure 29 FBD codes in STEP 7 c Pokharel 2013 Machine Vision and Object Sorting PLC Communication with LabVIEW using OPC ASADA eee 6 2 CPU315 2DP CPU315 2DP belongs to Simatic300 group of PLC controllers It consists of ses different indicators a program manipu lation key and a memory card slot It has 2 serial connection ports one of them is for interfacing between STEP7 and the PLC whereas the other is for connecting to a distributed module s Figure 30 alongside shows CPU315 2DP Figure 30 CPU315 2DP Pokharel 2013 6 3 Hardware configuration Hardware configuration HW needs to be done before any program can be downloaded into the PLC In the hardware configuration the type of power supply the CPU model such as CPU315 2DP the signal modules and or other distributed modules being used need to be specified so that the software and the hardware can inter connect Figure 31 shows the hardware config
11. CPU 315 2 DP FCl offline Network 18 Network 20 M2 3 Table Network 21 057 Rotate_ 180 Page 6 of 6 Machine Vision and Object Sorting PLC Communication with LabVIEW using OPC A AN AA Appendix 5 STEP 7 FC4 Outputs Defined Function SIMATIC Object_sorting 04 24 2013 02 43 54 PM SIMATIC 300 1 CPU 315 2 DP FC4 offline FC4 offline Outputs Name Family Author Version 0 1 Block version 2 Time stamp Code 04 24 2013 01 56 50 PM Interface 04 24 2013 01 46 23 PM Lengths block logic data 00178 00072 00000 This function has all the outputs defined Network 1 Push Motion When memory M0O 1 is set the piston moves out of the cylinder pushing the object out of the feeder Q0 2 Push Move MO 1 Network 2 Push Motion When memory M0 2 is set the piston moves into the cylinder so that it is reseted for the next object push Q0 0 Push Move Network 3 Rotary table Down When at least one of the following memeories is set the rotary table moves down M0 7 Q0 1 Table Move M2 0 Page 1 of 3 Machine Vision and Object Sorting PLC Communication with LabVIEW using OPC SIMATIC Object_sorting 04 24 2013 02 43 54 PM SIMATIC 300 1 CPU 315 2 DP FC4 offline Network 4 Gripper set reset The gripper is set to close or open using the SR function Q1 1 Gripper_ close_ Network
12. a PLC and LabVIEW At the end the program developed to demonstrate ma chine vision 1s described Object sorting using machine vision was accomplished using pattern matching algorithm of machine vision A pattern image template was cre ated and stored into the memory of computer When the object sorting ap plication runs the camera acquires the image of the object into LabVIEW The vision application analyses the image and sends an electrical signal to the sorter if the acquired image matches the template image The thesis was successfully completed and most of the objectives as to the machine vision application demonstration for object sorting were met In addition the communication between the PLC and LabVIEW was ena bled using NI OPC Keywords Machine vision Object sorting NI vision NI OPC communication Pages 50 p appendices 16 p CONTENTS INTRODUCTION c I ll Machine VIStOR Oda aces 2 2 COMPONENTS OF MACHINE VISION SYSTEM eere 4 Ze MINO iia 4 ZA DECANO E 4 2252 IAEA AO io oil 5 22 mage OA A uta N 6 Zola Lo CED Cameras eri its 6 2d 1CIVIOS CAMAS sic ieiciia 7 2 2 9 ME SCA CAIMCTAS rd is tee ea he eee ek 7 ZS Camera calibraci n a a as 8 DG NSCS OPliCs resan o O E II A 8 2Z I MCN SHC QUA OM aioe d eset a aUa EUM etu leer 9 Pigs Sy AMD ita 9 Po NS EN PURIS DNUS ree ee ee mee NN NENNT 10 DAA SDC PUM OE Tie AAA rate nitum cese A SE LES udine 10 2 4 5 MAS TS ONION at 11
13. j x Mori Name input al Sul Ig Data properties Datatype Defaut y Client access Read Write y Scan rate 100 E milliseconds Note The scan rate is only used for client applications that do not specify a rate when referencing this tag e g non OPC clients Lok cw v tee Figure 45 Configuring tag for OPC server Pokharel 2013 7 3 2 OPC quick client After the OPC server was configured with all the necessary tags the states of different I O devices can be viewed in the OPC quick client Clicking the QC tool on the toolbar of the runtime window can launch the OPC quick client To view the states of different devices the created device needs to be selected in the quick client window Note that the device name Machine Vision and Object Sorting PLC Communication with LabVIEW using OPC appears in the format channelName deviceName An example OPC quick client window is shown in Figure 46 iBi x File Edit View Tools Help D a bxc eim 4 Sex Egi National Instruments NIOPCServers temo Datartpe ale Timestamp Quaity 1 4 System siemens cpu315 2DP Auto Boolean 0 09 47 59 362 Good E Channel1 _system G siemens cpu315 2DP Belt Boolean 0 09 47 59 362 Good e usen siemens cpu315 2DP Emergency Boolean 1 09 47 59 362 Good m z ie aie ape siemens cpu315 2DP Green_light_ON
14. noise from the image or even the reverse of these Lighting variations and insufficiencies brings quality deg radation in the 1mage Thus the filters enhance the image Figure 14 shows images before and after filtering the original image is blurred using an image filter Figure 14 Images before filtering left and after filtering right Lode s Computer Graphics Tutorial 2 5 2 Positioning or Locating counting and measurement tools Machine vision tools are widely applied in industries for object position ing object counting and measuring dimensions of the objects Basically all these processes are interconnected So all these can be achieved with the same adjustment or utilization of the vision tools For example object positioning requires finding distances between two objects or matching the pattern where the object needs to be located 2 5 3 Application specific tools Different application specific machine vision tasks such as bar code reading defect detec tion color recognition etc can be accessed using machine vision tools Figure 15 along side shows an example of application specific tools included in the NI vision development module of LabVIEW to read the barcodes Figure 15 Machine vision appli cation reading barcodes Na tional Instruments Barcode Example WI HHT 3 488970 030017 2 6 Device communications When the image of the object being analysed is acquired and processed th
15. of products are unfit for use and deploying into the market and thereby need to be sorted out To sort those unfit products manually is time consuming expensive inac curate and tiresome The application of machine vision enables this task to be implemented with higher degree of accuracy in comparatively less time negligible labor and low cost However technical problems might arise Sometimes Today several machine vision software and cameras are available in the market The software available is so effective that ready made applications for automated inspection already exist The user needs to give only the in puts to the software But the users can develop their own application One significance of developing own application is the reduction in the expendi ture because the ready made application demands extra budget A ma chine vision application is similar in both ways theoretically as well as practically Furthermore the more a user is experienced the more signifi cant application can be developed As per demands different methods may be applied to develop machine vision applications But only few methods for object sorting have been dealt in this document 4 1 Machine vision methods for object sorting Object sorting has become a common procedure in industries The appli cation of machine vision in object sorting can be significant as it increases accuracy and reduces redundancies in the products Different vision in specti
16. real time It extracts the 3D information from the 2D image of the object Device and software communications are also widely practised in indus tries With the advancement in communications and networking different devices instruments and software in the industries these days can be in Machine Vision and Object Sorting PLC Communication with LabVIEW using OPC terconnected Today different communication protocols are being used in industries such as PROFIBUS PROFINET Ethernet OPC etc This thesis was conducted mainly to demonstrate machine vision tool for sorting of objects and pattern matching tool was used to sort the objects Pattern matching is the first step in a machine vision application The sort ing of objects for this thesis project had only two demands correct objects and damaged objects So 1t should be enough 1f the objects patterns are only matched Pattern matching 1s easy to apply as 1t has been said by ex perts that pattern matching is not affected by lighting motion and noise The secondary part of the thesis was PLC communication with LabVIEW To do so an automation networking protocol called OPC was used Many other ways can be applied to communicate between PLC and LabVIEW such as using other hardware communication devices but the sorting sta tion already had a PLC and the input and output signal modules connect ed use of a software protocol was found easier The forthcoming sections and sub section
17. sensor on a flexible circuit board Wikimedia Commons 2 2 2 CMOS cameras CMOS cameras are alternatives to CCD cameras The main features of a CMOS sensor are listed as follows Vision Systems Oy 2012 11 111 IV These sensors help to capture images at very high frame speed of more than 1000 frames second The manufacturing cost is very low These sensors have low power consumption Windowing selecting a part of sensor is possible with these sen sors Disadvantage of these sensors 1s Figure 7 CMOS image sensor Sudcamp poor image quality A Technology Hub Figure 7 alongside shows a CMOS sensor 2 2 3 Line scan cameras When products are manufactured in a factory they are frequently moved from one stage to another on a conveyor Stopping the conveyor to acquire an image for inspection would impose unwanted design problems So the conveyor is adjusted to a reasonably uniform speed Davies 2012 720 For acquiring images in such situations line scan cameras are used As factories often have many conveyor belts these cameras must be widely used cameras in factories and industries Figure 8 below shows the use of line scan camera in a production line where the conveyor is running Machine Vision and Object Sorting PLC Communication with LabVIEW using OPC Line scan Camera Downweb Direction Observed Line Crossweb Direction Motion Figure 8 Use of Line scan camera for object a
18. shown in Figure 59 NI Vision Acquisition Express bi xj Select Acquisition Source Select Acquisition Type Configure Acquisition Settings Select Controls Indicators 2 Single Acquisition with processing This acquisition is used for acquiring a single image No loop structures are required gt f Continuous Acquisition with inline processing Acquire Image Type This acquisition is used for continuously acquiring images If you do not acquire Most Recent Image y want to miss images select Acquire Every image and specify the Number of gt r4 Images to buffer Your average image processing time must be less than a Number of Images to Buffer your image acquisition time to avoid missing images i C Finite Acquisition with inline processing IN Number of Images to Acquire This acquisition is used for acquiring a fixed number images once When an z image is acquired it wil be available for image processing This is useful if you want to display or process your images before the acquisition is T EM Finite Acquisition with post processing N Number of Images to Acquire This acquisition is used for acquiring a fixed number images once The images will be available when all images have been acquired This is useful if your Ai EA 5 image processing time is longer than your image acquisition time Goa ES 7 Figure 59 Selecting the acquisition type to Continuous Pokharel 2013 After the se
19. 0 6 MO 7 i63 S Tcenter MO 6 Network 8 Network 9 Gripper_ open_ input M1 1 uE Tables i Page 3 of 6 Machine Vision and Object Sorting PLC Communication with LabVIEW using OPC E AAN A SIMATIC Object_sorting 04 24 2013 01 59 18 PM SIMATIC 300 1 CPU 315 2 DP FCl offline 0 Rotate 0 10 3 Tcenter M1 4 M1 5 E M1 4 19 5 Gripper close input s IN Page 4 of 6 Machine Vision and Object Sorting PLC Communication with LabVIEW using OPC SIMATIC Object sorting 04 24 2013 01 59 18 PM SIMATIC 300 1 CPU 315 2 DP FCl offline M1 6 M1 7 Table M1 6 M1 7 Rotate 0 T 1 i x Table Network 18 M2 1 10 4 Gripper M2 2 open input D Page 5 of 6 Machine Vision and Object Sorting PLC Communication with LabVIEW using OPC zo mmm time E Cmm AAA a eee AAA SIMATIC Object sortingV 04 24 2013 01 59 18 PM SIMATIC 300 1
20. 5 Rotary Table Up When at least one of the following memeories is set the rotary table moves up M0O 5 M1 1 00 3 Table M1 6 Move M2 3 Network 6 Rotation Clockwise When at least one of the following memories is set the table rotates in clockwise direction The rotation may be 180 degrees or 90 degress depending upon the memories M0 6 00 6 Rotate_0_ M1 2 output Network 7 Rotation counterclockwise When at least one of the following memories is set the table rotates in counter clockwise direction The rotation may be 180 degrees or 90 degress depending upon the memories 00 4 Rotate_ 180_ output M1 3 M2 4 Network 8 Motor If memory M2 2 is set the motor starts in clockwise direction Q1 3 Motor Page 2 of 3 Machine Vision and Object Sorting PLC Communication with LabVIEW using OPC Appendix 6 STEP 7 FC2 Sorter Reset Function SIMATIC Object sortingV 04 24 2013 01 59 29 PM SIMATIC 300 1 CPU 315 2 DP FC2 offline FC2 offline Reset Sorter Name Family Author Version 0 1 Block version 2 Time stamp Code 04 24 2013 01 55 51 PM Interface 04 15 2009 02 56 36 AM Lengths block logic data 00130 00034 00000 Block FC2 Sorter reset function The reset function is active when the sorter is set through LabVIEW Sorte S5T420S Whenever M21 0 is set the sorter piston will move into the cylind
21. 60 A section of Vision Assistant showing pattern matching tool in the machine vi sion tab Pokharel 2013 7 After that New Template button was clicked 1t 1s visible on the left lower section of the pattern matching setup screen of the vision assis tant Then a template editor wndow appears where a region of interest ROI was created as shown in Figure 61 below using rectangular se lect tool that can be found on the right upper side of the window Machine Vision and Object Sorting PLC Communication with LabVIEW using OPC ASADA AAA eee 10 11 12 Now le oo be Figure 61 Selecting a region of interest ROI for template creation ROI shown by green rectangle Pokharel 2013 The selected area can be further tuned after clicking Next gt gt button that can be visible in the template editor window shown in Figure 61 above And finally the template was created clicking the Finish button The x and y offsets were also defined but the angle shift was un checked because the objects being analyzed were always at the same place with the same orientation Then the created template was saved into the hard drive of the computer Figure 62 shows the created tem plate image for pattern matching The x position y position angle and the score for the template image are generated by the vision assistant automatically this can be noted from the area that is highlighted by blue color as shown in Figure 62 Sh 21919 D
22. Boolean 0 09 47 59 503 Good ia cg Me Demos idm xd siemens cpu315 2DP Gripper_close_input Boolean 0 09 47 59 362 Good SS amp Jsiemens cpu315 2DP Gripper dose output Boolean 0 09 47 59 503 Good Data Type Examples 16 Bit Devic Ede q i 4 E Data Type Examples 16 Bit Devic A A O Boolean 1 09 47 59 San Goo Data Type Examples 16 Bit Devic Wsiemens cpu315 2DP MAN Boolean 0 09 47 59 362 Good Bi Data Type Examples 8 Bit Device siemens cpu315 2DP Motor Boolean 0 09 47 59 503 Good Data Type Examples 8 Bit Device siemens cpu315 2DP Photoelectric Boolean 1 09 47 59 362 Good Data Type Examples 8 Bit Device Esiemens cpu315 2DP Push Boolean 1 09 47 59 362 Good gg Data Type Examples 8 Bit Device Jsiemens cpu315 2DP Push Move Boolean 0 09 47 59 503 Good siemens System ES siemens cpu315 2DP Push Boolean 1 09 47 59 362 Good 43 siemens cpu315 2DP siemens cpu315 2DP Push _Move Boolean 0 09 47 59 503 Good 2 siemens cpu315 2DP System GBsiemens cpu315 2DP Red_light_ON Boolean 0 09 47 59 503 Good siemens1 System siemens cpu315 2DP Reflective sensor Boolean 0 09 47 59 362 Good Fe ds 1 Devicel siemens cpu315 2DP RESET Boolean 0 09 47 59 362 Good Ga ondes LDevicei System C3siemens cpu315 2DP Rotate 0 Boolean 1 09 47 59 362 Good Gd GRAS SEM aa Jsiemens cpu315 2DP Rotate_0 output Boolean 0 09 47 59 503 Good SAR EES siemens cpu315 2DP Rotate_180 Boolean 0 09 47 59 362 Good Bessa ee abe siemens cpu315 2DP Rota
23. Communication with LabVIEW using OPC Figure 22 Line edges formation behavior of intensity in an image Pokharel 2013 However step and line edges are rare in the real world images The behav iours of step edges changing to ramp edges and line edges changing to roof edges are respectively shown in Figure 23 a and Figure 23 b a b Figure 23 Ramp edges formation behavior a and Roof edges formation behavior b Pokharel 2013 The edge detection algorithms are typically used in three different areas of machine vision applications namely gauging alignment and geometric transformations of objects NI Vision for LabVIEW User Manual 4 1 3 Geometric matching Geometric matching locates regions in a grayscale image that match a model or template of a reference pattern NI Vision for LabVIEW User Manual 71 Geometric matching and pattern matching tools resemble closely It is also independent of lighting variations blur noise and geometric transfor mations And the steps involved are also quite similar Like pattern matching a template image 1s created that works as a refer ence image for which the geometric matching tool searched from the ac quired 1mages Figure 24 below shows geometric matching and the tem plate image in LabVIEW 18 Machine Vision and Object Sorting PLC Communication with LabVIEW using OPC 3 EJ File Edit View Project Operate Tools Window Help jeje Template File Path Ima
24. Figure 64 AA y Figure 64 Assigning x and y axes to the bounding box Pokharel 2013 Each of the outputs was then connected to the input terminals of a Build Array VI The output terminal of this VI was also wired to an other Array to Cluster VI one thing to be noted is that all the clusters size needs to be changed to 4 it can be done by right clicking the Ar ray to Cluster VI and selecting Cluster Size from the context menu as shown in Figure 65 below Machine Vision and Object Sorting PLC Communication with LabVIEW using OPC AAA AAA mene peers Gros Figure 65 Changing the cluster size Pokharel 2013 15 The output terminal from that final Array to Cluster VI was connected to the Rectangle input terminal of the IMAQ Overlay Rectangle VI Also the input terminal Image of this VI was wired to the Image out output terminal of the vision assistant 16 Finally the output terminal from the Overlay Rectangle VI was wired to the input terminal of the Image Display VI Thus the machine vision application for object sorting was developed 8 1 Object sorting The output terminal Number of Matches of the vision assistant was wired to a conditional operator greater or equal to gt The other input terminal of that operator was given a constant value of 1 The output of this conditional operation was connected to the tag named Sort Move
25. MACHINE VISION AND OBJECT SORTING PLC Communication with LabVIEW using OPC HAMK UNIVERSITY OF APPLIED SCIENCES Bachelor s thesis Degree Programme in Automation Engineering Valkeakoski May 2013 Bikarna Pokharel Bak AN K ABSTRACT UNIVERSITY OF APPLIED SCIENCES Automation Engineering D P in Automation Engineering Author Bikarna Pokharel Year 2013 Subject of Bachelor s thesis Machine Vision And Object Sorting PLC Communication with LabVIEW using OPC ABSTRACT The main objective of this thesis was to demonstrate a machine vision MV application for the quality control of products in an industry using a miniature production line station A project was commissioned by HAMK University of Applied Sciences Valkeakoski and conducted in the auto mation laboratory for this thesis A miniature production line was constructed and automated using STEP 7 software and Simatic 300 based Programmable Logical Controller PLC both are manufactured by Siemens The machine vision part of the thesis was done in NI LabVIEW a graphical program development environment from National Instruments NI The communication between the PLC and LabVIEW was carried out using NI OPC OLE for Process Control an add on for LabVIEW Basic theoretical background on machine vision 1s presented at the begin ning of this thesis this is followed by a description of the vision develop ment module in LabVIEW and a method to communicate between
26. Machine Vision and Object Sorting PLC Communication with LabVIEW using OPC Vision Express E eal Vision Acquisi Vision Assistant Figure 39 Express functions for vision applications in NI Vision Development module Pokharel 2013 7 2 6 Displaying the image The image should be displayed on the screen after the image acquisition 1s done NI Vision provides a facility to display image internally inside the Front panel or externally in a different window Figure 40 shows the dif ferent types of image display and indicator blocks available in NI vision module Vision El IMAQ Image cti Image Display Image Displa W X IMAQ Vision Machine Visio Figure 40 Vision Development module blocks for Front panel Pokharel 2013 7 35 NI LabVIEW OPC servers OPC stands for OLE Object Linking and Embedding for Process Con trol It is a standard defined interface to link devices in industries it is used for connecting with different databases laboratory equipment and test systems Most of the industrial data acquisition devices and control devices such as PLCs are compatible with the OPC standard The idea for the interconnection among device s and or database s 1s to share the data and allow making changes in data such that a change in one device s or database s will make the same change in the other device s or data base s NI OPC servers can be launched as soon as it has been insta
27. a E aco nc o TTE OM YPosson ala aaen al c score SS ge een qu pee pee pe Ml M Lm pe F i Figure 62 Creating an image template for pattern matching in NI vision assistant Pokharel 2013 The required controls and indicators were also selected and finally the vision assistant was closed clicking Finish button The Image Dst Out output terminal of the IMAQ ExtractSingleCol orPlane was wired to Image In input terminal of the vision assistant The Matches Pattern output terminal from the vision assistant was wired to array to cluster VI which then was connected to Unbundle by name VI Bounding box was selected by right clicking it and navi gating to select item as shown in Figure 63 below Machine Vision and Object Sorting PLC Communication with LabVIEW using OPC ASADA AAA 13 14 4 4 Block Usagram on myOM Nwpror Py Basmi Moe s reser tome Figure 63 Selecting bounding box to create a bounding box Pokharel 2013 The output terminal from the Unbundle by Name VI was once again wired to Array to Cluster VI whose output terminal was also once again wired to another Unbundle by Name VI This time it was en larged to get 4 output terminals The first output terminal was assigned to Bounding Box 0 gt x the second to Bounding Box 1 gt y the third to Bounding Box 2 gt x and the fourth to Bounding Box 3 y as shown in
28. a hole that allows light to enter the lens Basic Pho tography Tutorials 2001 Normally lenses have adjustable diaphragm as shown in Figure 10 that changes the size of the aperture and thus limits the objective size or aperture size Vision Systems Oy 2012 adjustable diaphragm aperture Figure 10 showing adjustable diaphragm Pokharel 2013 Machine Vision and Object Sorting PLC Communication with LabVIEW using OPC 2 4 3 Field of view Field of view FOV may be defined as the extent to which a camera can view the real world image in an instant of time It depends on the focal length of the lens With smaller focal length the angle of view is larger This allows the lens to cover wider area of the image Figure 11 shows the schematic diagram of FOV The region surrounded by the height and width of the scene falls inside the FOV Width Distance from the scene to the camera Figure 11 Showing the field of view of a camera lens Pokharel 2013 2 4 4 Depth of field Depth of Field DOF is the measure of the distance between the nearest and the farthest objects in a scene that can be captured by the camera and be acceptably sharp in the image Wikipedia 2013 Depth of Field Fig ure 12 illustrates the DOF of a lens Depth of Field Figure 12 Depth of field of a camera Wikipedia Depth of Field In Figure 12 above the area within the DOF appears sharp whereas the ar eas in front and back of it app
29. an empty re gion of the Front panel The tools palette is also shown where the differ ent types of mouse manipulators are shown This palette can be set to be in automatic mode or manual mode A waveform chart a stop button two LEDs and two numeric inputs are shown in the panel Also one of the LEDs is lit ON on the condition of Number is being less that Number 2 The conditions are made using wir ings in the block diagram that will be explained in the LabVIEW Block Diagram immediately in the next sub section Untitled 2 Front Panel Dj xj File Edit View Project Operate Tools Window Help 13pt Application Font Por tor BE eard A 112 HHE Sine with Uniform Noise A x Waveform Graph Sine with Uniform Noise Filtered BE 1 5 1 m le do s E 0 Numeric Boolean String amp Path j Tz bf EH BEI HEEL fico Se Ed 1 Array Matrix List Table amp T Graph 1 5 ma oOo gt 2 4 Enum 3j nn 3 59 39 809 3 59 40 799 Ring amp Enum Containers I O 15 4 2009 15 4 2009 b on O oA Variant amp Class Decorations Navigation C E Refnum Silver System b Classic Express b Control Design amp Simulation NET amp ActiveX Signal Processing gt Addons gt User Controls Select a Control DSC Module Vision
30. channels that indicate their signal state by means of light emitting diodes technical data KL2114 KS2114 KL2134 KS2134 Connection technology 2 3 wire Number of outputs 4 i Rated load voltage 24 VDC 15 20 Load type ohmic inductive mp load Max outpat current o 0 5 A short circuit proof per channel Short circuit current lt 2A B E Breaking energy i uu 150 mJ channel Reverse voltage protection o n m yes Electrical isolation 500 V K bus field potential b Current consumption power contacts typ 30 mA load Current consumpt K bus typ 9 mA Bit width in the process image 4 outputs Configuration m no address or configuration setting Weight approx 70 g Operating storage temperature 9 155 E 785 C 25 60 C 40 85 C Relative humidity 95 no condensation Vibration shock as conforms to EN 60068 2 6 EN 60068 2 27 EMC immunity emission conforms to EN 61000 6 2 EN 61000 6 4 Protect class installation pos i IP 20 variable Pluggable wiring l for all KSxxxx Bus Terminals Approvals CE UL Ex CE UL Ex GL www beckhoff filenglish asp bus terminal K2114 K2134 htm 111
31. ct class installation pos Pluggable wiring Approvals www beckhoff fi english asp bus_terminal d1104_41114 htm KL1104 KS1104 2 3 wire 4 24 V DC 15 20 5 V 15 30 V typ 3 0 ms typ 5 mA typ 5 mA 500 V K bus field potential 4 inputs l fio address or configuration setting approx 55 g 25 60 9C 40 85 C 95 no condensation conforms to EN 60068 2 6 EN 60068 2 27 conforms to EN 61000 6 2 EN 61000 6 4 IP 20 variable for all KSxxxx Bus Terminals CE UL Ex GL KL1114 KS1114 typ 0 2 ms 1 1 Machine Vision and Object Sorting PLC Communication with LabVIEW using OPC See ee AA AAA AAA Appendix 8 Signal Module KL2114 Datasheet 4 24 13 BECKHOFF New Automation Technolog y DIDI m Signal LEDI e Signal LED2 Signal LED3 ____ 503 Signal LED4 0 Output 1 5 B Output 2 A BB 1v Power contact 24 V ne Power contact 0 V Output 3 Top view Contact assembly KL2114 KL2134 4 channel digital output terminals 24 VDC The KL2114 and KL2134 digital output terminals connect the binary control signals from the automation unit on to the actuators at the process level with electrical isolation The load current output of the KL2114 version is protected against overload and short circuit The KL2134 is protected against reverse polarity connection The Bus Terminals contain four
32. d thus a lot of information from the image is lost For more about types of lighting section 2 1 of this document should be referred The camera should always be positioned in a way that it 1s perpendicular 90 angle to the object s being analyzed as shown in Figure 35 It is al right if some errors in perpendicularity occur as the software is capable to compensating such errors but it is recommended that the camera be placed perpendicular to the object as precisely as possible A clamp and stand could be used to install the camera perpendicular to the object Camera Figure 35 showing camera installation for machine vision purpose Pokharel 2013 The selection of the camera also accounts for a good vision application NI Vision supports cameras ranging from simple web cameras to complex GigE Ethernet cameras 7 2 2 Calibrating the imaging system After the imaging system is set up properly the next step would be cali brating the imaging system Calibration of the imaging system is critical because all the machine vision tasks will be based on the calibration made The better the calibration the better would be the image analysis and machine vision tasks Calibration involves assigning the real world coordinate system to the pixel based coordinate system It also assists in compensating perspective and non linear errors that might be present in the imaging system Per spective errors arise due to the camera not being perpendicu
33. duces cost effort and time with a significant level of accuracy and reli ability The development of machine vision technology directly relates to the de velopment of optical systems The development of modern time optics was in the late 1800 whereas in the 80s a new era of optics called digital image processing and machine vision systems began to flourish Vision Systems Oy 2012 Digital image processing involves extraction of information from an im age Wisegeek 2011 What is Machine Vision Image Processing it 1s the backbone of machine vision systems Digital images are the combina tions of different light intensity level Each point in a digital image is a representation of pixel value that corresponds that corresponds to x and y coordinates in the image plane it defines the intensity at that point A monochrome digital image generally contains 256 gray levels from 0 through 255 0 corresponds to white color and 255 corresponds to black color On the other hand a photograph contains infinite gray levels Gon zalez Woods amp Eddins 2009 Figure 1 shows the gray levels of a digital image a and a traditional photograph b 255 Infinite 0 0 a b Figure 1 Gray levels of a digital image a and a photograph b Pokharel 2013 Machine vision 1s meant for real time image processing This implies that the image processing 1s done at the instant the image is acquired Thus it represents a real world image in
34. e fore in this condition the sorter should move from position A to B as in dicated by the arrow move A to B 5 3 System communication The PLC was interfaced to the computer using S7 MPI adapter The bus coupler LC3100 was networked with the PLC using PROFIBUS cable Also OPC communication was done using the same S7 MPI adapter A di agrammatic representation of communication among the system compo nents is shown in Figure 27 STEP 7 LabVIEW MPI OPC CPU315 2DP Profibus LC3100 Figure 27 Communications among STEP 7 LabVIEW and CPU315 2DP and LC3100 Pokharel 2013 27 Machine Vision and Object Sorting PLC Communication with LabVIEW using OPC ASADA eee 6 AUTOMATION OF THE STATION 6 1 STEP 7 professional STEP 7 PROFESSIONAL STEP 7 in short is automation software from Siemens Industry www siemens com It is used for programming simatic PLC stations Figure 28 shows the system manger window of simatic STEP 7 where a created project with some blocks is also shown Ele Edit Inset PLC View Options Window Help COSA A gm idm Salta e EE dE co es 1172480 ASM v S7 Progam 1 B Souces E Blocks Program Sequence Figure 28 A screenshot of simatic manager STEP 7 Pokharel 2013 STEP7 provides provision to code the program using seven different lan guages Some of them are FBD Function Block Diagram LD Ladder Diagram and SCL Statement List etc The user can freely choose the language
35. e resolution Spatial resolution is the measure of how closely lines can be resolved in an image It is determined by the pixel spacing lens aberrations diffraction and the depth of field But in most machine vision applications pixel spac ing and depth of field are the deterministic features of spatial resolution It suggests that images with high pixels are not necessarily sharp Wikipe dia 2013 Image resolution 2 5 Machine vision tools Machine vision tools refer to the software algorithms used for 1mage pro cessing and analysis These are the building blocks for developing ma chine vision applications These tools are supplied by different manufac turers but all have the same working principles All the machine vision tools are developed in a way that they analyse a particular set or number of pixels within a defined region of interest of the object show the graphics of the object being analysed and provide data information about the image to make a decision for the controller and the output devices The vision tools can be categorized into different types as described in the following sub sections Machine Vision and Object Sorting PLC Communication with LabVIEW using OPC ASADA AAA 2 541 Image processing and filtering tools Before an object is analysed the image filters or image pre processing fil ters can be applied to the image of the object to sharpen the image pixels increase the edge contrasts and remove
36. e New Project window appears Right click My Computer and from the context menu choose New gt gt I O Server as shown in Fig ure 48 below 36 Machine Vision and Object Sorting PLC Communication with LabVIEW using OPC EAN eee 111 IV XControl dt NI SoftMotion Axis SUPER NISoftMotion Coordinate Space Help NI SoftMotion Table Properties SolidWorks Assembly Figure 48 Creating a New I O Server Pokharel 2013 Then the Create New I O server window displays select OPC cli ent as shown in Figure 49 and click Continue gt Create New 1 0 Server x I O Server Type Alarm Printer Custom VI On Input Change Custom VI Periodic Data Set Marking EPICS Client EPICS Server Modbus Mo zl Communicate with OPC OLE for Process Control Servers Emme cm om Figure 49 Create New I O Server window Pokharel 2013 Next step 1s configuring the OPC client Select National Instru ments NIOPCServers V5 as shown in Figure 50 below Change the Update rate ms to 100 default value is 1000 and click OK but ton A prompt window titled DCOM configuration Recommenda tion appears accept the prompt clicking OK button Machine Vision and Object Sorting PLC Communication with LabVIEW using OPC ASADA AAA IIA yi EEN Update rate ms Browse Machine Y d E 100 Machine Deadband localhost Browse b Registered OPC servers Reconnect poll rate s National In
37. e system should have the ability to trigger output s to the output de vice s and or receive input signal from the input device s This in volves the communications among the machine vision tools image acqui sition device input devices such as proximity sensors and output devices Machine Vision and Object Sorting PLC Communication with LabVIEW using OPC pz m A AAN RA such as valves Figure 16 shows the schematic representation of device communications among the different components of a machine vision sys tem Image acquisition device Machine vision tools En Device communications Input and out put devices Figure 16 Schematic representations of Device communications in a machine vision system Pokharel 2013 Machine Vision and Object Sorting PLC Communication with LabVIEW using OPC 3 MACHINE VISION PROCESS 3 1 3 2 Generally the processes involved in machine vision applications can be categorized into three areas as 3 1 Image Acquisition 3 2 Image Processing 3 3 Output Image acquisition Image acquisition is the process of acquiring an image with an image ac quiring device a camera While the image acquiring device captures an image the image would lose much information This loss might be due to bad light exposure bad angle adjustment noise in the surroundings and so on So in order to extract and regain the lost information the images needs to be further processed using image pr
38. ear blurry It depends on the focal length and the aperture size of the imaging device The larger the focal length smaller is the DOF and also the larger the ap erture size smaller is the DOF 10 Machine Vision and Object Sorting PLC Communication with LabVIEW using OPC pm e IA Although the lens can focus at one point at a time the gradual decrease in sharpness occurs on both sides of the focus point So within DOF the un sharpness is unpredictable under normal conditions Wikipedia 2013 Depth of Field 2 4 5 Image resolution Image resolution indicates how clearly an image is visible In other words it is the minimum distance between two lines in an image such that the image is visibly resolved Image resolution can be defined in different ways such as pixel resolution and spatial resolution Pixel resolution is indicated in the form M x N M by N M represents the number of pixel columns width whereas N represents the number of pix el rows height It 1s also sometimes indicated by the total number of pix els in the image or the region of interest in the image The more the pixel resolution the better 1s the 1mage visibility or quality Wikipedia 2013 Image resolution Figure 13 shows the visibility with different 1mage res olutions for the same image 100 x 100 ixi 2x2 5x5 10 x 10 20 x 20 50 x 50 Figure 13 Showing visibility of an image with different pixel resolutions Wikipedia Imag
39. er Qi 0 Sort Move Page 1 of 1 4 24 13 Signal Module KL1114 Datasheet BECKHOFF New Automation Technolog y KL1104 KL1114 ro Signal LEDI At B ma Input 1 n Input 2 a ma 4 24 V Power contact 24 V Iud mi B OV Power contact 0 V THE mm Input 3 fa e Input 4 nu du Top view Signal LED2 Signal LED3 o6 4 Signal LED4 Contact assembly Machine Vision and Object Sorting PLC Communication with LabVIEW using OPC See ee A AAA AAA Appendix 7 KL1104 KL1114 4 channel digital input terminals 24 V DC The KL1104 and KL1114 digital input terminals acquire the binary control signals from the process level and transmit them in an electrically isolated form to the higher level automation unit The KL1104 and KL1114 versions have input filters of different speeds The Bus Terminals contain four channels that indicate their signal state by means of light emitting diodes The KL1104 and KL1114 are particularly useful for space saving use in control cabinets Connection technology Number of inputs Nominal voltage 0 signal voltage ee signal voltage nut filter Input current Current consumpt K bus Electrical isolation Bit width in th process image Configuration 7 Weight Operating storage temperature Relative humidity i Vibration shock resistance EMC immunity emission Prote
40. erties from 1 Gripper open a i2 MAN Motor Photoelectric E Push Move Bee Push Push4 Move y b Figure 52 Create Bound Variables Window Pokharel 2013 Then Multiple Variable Editor window appears as shown in Figure 53 click Done button Ca Multiple Variable Editor o aloja Path o we amp ct 1 My Computer Untitled Library 1 Auto Network Published Pee ect 1 My Computer Untitled Library 1 Belt Network Published Boolean ect 1 My Computer Untitled Library 1 Eme Network Published Boolean ect 1 My Computer Untitled Library 1 Gree Network Published Boolean Figure 53 Multiple Variable Editor Window Pokharel 2013 The bound variables are then visible in the project window as shown in Figure 54 below Right click on the created Library here Untitled Library 1 or My Computer and select Deploy such that these shared variables can be available to all the networked com ponents The LabVIEW VI can now access all the variables of PLC using the created tags in OPC Server read from PLC as well as write data to PLC Machine Vision and Object Sorting PLC Communication with LabVIEW using OPC AAA AAA E Untitled Project 1 Project Explorer fej x File Edit View Project Operate Tools Window Help Se x x es me Items Files El ej Project Untitled Project 1 E My Computer B 3 Untitled Library 1 i Lo Belt z 92 Emergency i Sa G
41. g OPC National Instruments 2011 Geometric Matching Example Accessed 22 February 2013 http zone ni com devzone cda epd p id 5555 National Instruments 2011 Bar Code Example Accessed 23 March 2013 http zone ni com devzone cda epd p id 5533 Pokharel B 2013 HAMK University of Applied Sciences Degree Programme in Au tomation Engineering 2009 2013 Quality Digest 2001 The Future of Machine Vision Site Editor John E Agapakis Ac cessed 7 J anuary 2013 http www qualitydigest com oct98 html machfutr html Sudcamp 2012 A Technology Hub Accessed 23 March 2013 http www sudcamp com ccd vs cmos image sensor in digital camera Vision Systems Oy 2012 Robola project Education Materials Wikimedia Commons 2012 File Ccd sensor jpg Accessed 18 March 2013 http commons wikimedia org wiki File Ccd sensor jpg Wikipedia 2013 Camera resectioning Accessed 18 February 2013 http en wikipedia org wiki Camera_resectioning Wikipedia 2013 Depth of Field Accessed 17 March 2013 http en wikipedia org wiki Depth_of field Wikipedia 2013 Image Resolutions Accessed 17 March 2013 http en wikipedia org wiki Image_resolution Wikipedia 2013 Machine Vision Accessed 15 December 2012 http en wikipedia org wiki Machine_vision WiseGeek 2011 What is Machine Vision Image Processing Site Editor Andrew Jones Accessed 20 J anuary 2013 http www wisegeek com what is machine vision image processing htm did you
42. ge The Template File was created using the Geometric Matching Training Interface See this VIs help for more information on this utility C Program Files National Instruments Vision E xampless Images Geometric Matching T emplate png Image File Path C Program FilesNNational Instruments Vision Examples i magesNGeometric Matching Gauges 00 tif 1 First load an image Load file file and display it Search Nb of Matches Minimum Score 800 i j P W Server localhost lt gt Figure 24 Geometric matching illustration with the reference of a template image National Instruments Geometric matching example 19 Machine Vision and Object Sorting PLC Communication with LabVIEW using OPC ASA AAA AAA A AAN 5 SORTING STATION The sorting station is shown in Figure 25 Figure 25 showing Sorting station showing major components The station was constructed for the object sorting purpose It was constructed in such a manner that it accepts the prod ucts that pass the Machine vision test while the products that could not pass the test are re jected by the system Pokharel 2013 1 PLC 2 Object Feeder 3 Camera 4 Rotating table Manipulator 5 Motor 6 Gripper 7 Conveyor 8 Sorter 9 amp 11 Valves 10 Distributed module A simple logical sequence program was coded using STEP 7 software for the automation of the system The program was downloaded to the PLC so t
43. hat the station can run as soon as the electrical supply is made For the in spection of the product a VI virtual instrument LabVIEW program was made The image is acquired into LabVIEW using a webcam The soft ware analyses the image and triggers the corresponding valve for passed product In this system only one trigger is sent to the valve from Lab VIEW The valve reset was done inside STEP 7 codes The object is pushed out from the feeder by a piston The rotating table then picks the object and places it under the camera The camera acquires image into LabVIEW and thus the VI created analyses the image If the image matches the pattern defined in the program it triggers a signal to the valve so that the sorter cylinder piston moves out otherwise no ac tion 1s seen in the sorter Then the rotating table picks that object and plac es on the conveyor The object then is conveyed to the corresponding sides Thus the sequence continues as long as the power 1s ON Machine Vision and Object Sorting PLC Communication with LabVIEW using OPC 5 1 Construction of the station The system consists of cylinders sensors a motor and belt and conveyor as the physical components As the PLC used in the station requires addi tional signal modules for the I O inputs and outputs devices signal mod ules from Beckhoff www beckhoff com was used The data sheet of the signal modules can be found in Appendices 7 and 8 These modules were networ
44. ion and or orientation of a known object by locating fi ducials NI Vision for LabVIEW User Manual Hence pattern matching can be applied for quality control of the products In this thesis project also pattern matching tool was applied for sorting of objects The program 1s described in Section 4 1 2 Edge detection Edges are of importance while determining the structure of the object Typically edges occur between the boundary separating two regions in an object So edges are the significant changes to analyse the image These local changes are seen in intensity of different regions in an image The change or discontinuity in the intensity might give rise to the formation of step edges line edges ramp edges or roof edges Jain et al 1995 140 141 Figure 20 shows the original image left and the edge detected im age right Figure 20 Images before and after edge formation National Instruments Step edges occur when the intensity abruptly changes from one value on one side of discontinuity to the opposite value on the other side Figure 21 shows the step edge formation behaviour of the intensity in an image Figure 21 Step edge formation behavior of intensity in an image Pokharel 2013 Line edges occur when the intensity abruptly changes its value but regains its original value within a short distance The line edge formation behav iour 18 shown in Figure 22 below 17 Machine Vision and Object Sorting PLC
45. ion g T ad Machine Vision and Object Sorting PLC Communication with LabVIEW using OPC PAE AAA AAA AI topics For this reason the main concentration of this thesis document was to develop a simple machine vision application using software readily avallable in the market The software used in this thesis project was Lab VIEW However the basic requirements to understand a machine vision system are discussed in the forthcoming sections Machine Vision and Object Sorting PLC Communication with LabVIEW using OPC 2 COMPONENTS OF MACHINE VISION SYSTEM A machine vision system typically consists of machine vision software machine vision tools and a camera image acquisition device But many other things need to be considered for a machine vision system Each of the components has its own significance So none of the components can be isolated or segregated The important components are discussed in brief in the following sub sections 2 1 Illumination Illumination refers to the light sources that are available around the object being analysed It is significant that the object s under analysis be clearly visible to the image acquisition device It ensures that much of the infor mation is retained in the acquired image and no much image processing needs to be done thus making the machine vision application simpler to develop Illuminating object s does not mean availability of huge amount of light around the object it refers the
46. ion with LabVIEW using OPC E AAA RN AN SIMATIC Object_sorting 04 24 2013 01 59 03 PM SIMATIC 300 1 CPU 315 2 DP OB100 lt offline gt SS Page 3 of 3 Machine Vision and Object Sorting PLC Communication with LabVIEW using OPC Appendix 4 STEP 7 FCI Function for a Complete automation sequence SIMATIC Object sorting 04 24 2013 01 59 17 PM SIMATIC 300 1 CPU 315 2 DP FCl offline FC1 offline Program Sequence Name Family Author Version 0 1 Block version 2 Time stamp Code 04 24 2013 01 46 09 PM Interface 02 18 2013 12 35 26 PM Lengths block logic data 00388 00240 00000 Block FC1 Sequence flow of the program Use of Set and Reset functions START MO O Wait TG Photoelec tric amp MO 1 M0 2 0 2 S Push MO 1 SS 5 5 5 Page 1 of 6 Machine Vision and Object Sorting PLC Communication with LabVIEW using OPC SIMATIC Object_sorting 04 24 2013 01 59 18 PM SIMATIC 300 1 CPU 315 2 DP FCl offline MO 3 S amp MO MO 4 11 6 Table 0 Push M I2 2 A 3 MO 4 Gripper close input amp M0 5 MO 6 Ll Table M0 5 LT Page 2 of 6 Machine Vision and Object Sorting PLC Communication with LabVIEW using OPC SIMATIC Object_sorting 04 24 2013 01 59 18 PM SIMATIC 300 1 CPU 315 2 DP FCl offline Network 7 amp i M
47. it can be accessed from the Start menu or through a shortcut on the Desktop Figure 32 shows the start up window screenshot of LabVIEW 2012 10 xi File Operate Tools Help a LabVIEW 2012 C Create Project Open Existing s Show Al Blan lvpn ple Shared Va and Event ivp uments ant ngs k ttings Temp Temp t6 test6 Ivproj uments ant sktop a ectSortin Matching Examp we Find Drivers and Add ons bs Community and Support by Welcome to LabVIEW Connect to d pand the Participate in the discussion forums or Leam to use LabVIEW and upgrade onnect to devices and expand the nality of LabVIEW quest technical support from previous versions EJ LabVIEW News Figure 32 LabVIEW 2012 start up window Pokharel 2013 25 Machine Vision and Object Sorting PLC Communication with LabVIEW using OPC LabVIEW consists of two windows called the Front Panel and the Block Diagram The two windows are explained with example in the following sub sections 7 1 1 LabVIEW front panel The LabVIEW front panel is the window where different controls such as switch knobs numeric inputs etc and indicators such as LEDs graphs numeric outputs etc can be viewed 1t can also be called as Lab VIEW HMI Human Machine Interface Figure 33 shows the Front panel with some controls and indicators Also the controls menu can be seen which are categorized into different groups The menu can be accessed by right clicking inside
48. ked to the PLC using Bus coupler LC3100 also from Beckhoff via PROFIBUS cable Table 2 provides basic information about the devices that have been used in the sorting station Table 2 Basic information on the devices used in the station Device Type Simatic 300 PLC Siemens CPU315 2DP LC3100 Bus Coupler Beckhoff module module table tor 6 Valves Pneumatic S7 MPI Webcam Image acquisi Logitech tion Power supply AC DC adapter Motor 12 Sensors various 2 5 2 Vision section of the station Figure 26 shows the diagrammatic section of the station that 1s responsible for providing information to the sorter if the image of the object meets the required specifications or not pattern matches OS camera object o COn vans Figure 26 Vision section of the system determining the move direction of the sorter Pokharel 2013 21 Machine Vision and Object Sorting PLC Communication with LabVIEW using OPC If the machine vision application matches the object the sorter moves from position A to B marked in Figure 26 above By default the sorter is al ways at position A thus the sorter moves only if the object matches The sorter also has to return back to position A when it has moved to position B this was done in the automation codes The codes for resetting the sort er can be found in Appendix 6 In Figure 26 above it has been indicated that the pattern matches Ther
49. lar to the ob ject under inspection while non linear errors arise due to lens aberration of 28 Machine Vision and Object Sorting PLC Communication with LabVIEW using OPC the camera Simply to understand lens aberration can be defined as the fault in the lens that prevents the lens from converging different rays of lights to a single focus point 7 2 3 Creating image NI Vision has a block called IMAQ Create Vision Utilities gt gt Image Management to create a reference image While using IMAQ Create to create a reference image the data type of the image should be specified The image types are not described in this document but the different image types are shown in Table 3 Table 3 Image and image data types National Instruments Machine Vision User Manual 8 bit unsigned RGB U32 32 bit RGB HSL U32 32 bit HSL 6 RGB U64 64 bit RGB The purpose of creating 1mage 1s to allow NI Vision to create an internal image structure to hold the different image properties such as the name of the image and the border size of the image However memory is not yet allocated for image pixels by creating the image The image thus created is passed over to every other subsequent NI Vision functions as input NI vision has different IMAQ blocks as shown in Figure 36 ea Snap wie Initialize Bla vus ES Create LUT Color Decode Property Node Camera Control Eos Grab Acquire Sequence os Grab Setup Cos Close we
50. lights to be adjusted in a proper way Proper illumination involves the right intensity and correct direction of light It should be done in a way that shadow formation is checked and maximum contrasts can be achieved from the region of interest of the object s Mo vimed custom imaging solutions 2007 The light sources may be fluorescent lights or LED lights or halogen lights etc LED lights are more preferred over the other types of light sources because of their long life and less energy consumption Depend ing upon the arrangement of lights illumination can be direct or indirect 2 1 1 Direct illumination Direct illumination involves illuminating specific regions of the object s being analysed such that those regions can be identified clearly These re gions may be the centre or edges of the object Direct lighting can be ob tained using ring lights low angle ring lights or bar lights Moviemed im aging solutions 2007 High density LED ring lights are perfect for illumination if central region or the edges of the object needs to be analysed Movimed imagine solu tions 2007 Figure 2 below shows ring lights for illuminating the central region of the object Machine Vision and Object Sorting PLC Communication with LabVIEW using OPC ASADA eee Ring Lights a b Figure 2 Different ring lights a and ring light assembly b Movimed custom imaging solutions However for edge illumination low angle ring ligh
51. lled into the computer To interconnect the simatic PLC and LabVIEW 2012 NI OPC servers was used to create a simatic 300 based CPU315 2DP as an OPC server Different tags corresponding to the signals for the I O devices used in the CPU was created and thus created tags could be used in VI to view and control the system statuses and outputs 31 Machine Vision and Object Sorting PLC Communication with LabVIEW using OPC 7 3 1 The next sub sections on OPC servers are discussed in instructional ways The instructions are based on the thesis project Configuration of an OPC server Configuration of an OPC Server in NI OPC Servers is a simple process It involves creating a new channel for a new device and adding the tags that represent the inputs and outputs for the I O devices The steps for creating an OPC server for a CPU315 2DP are described as follows 11 111 1V In the configuration window NI OPC Servers Runtime right click on the left section of the window and select New Channel as shown in Figure 41 This follows a wizard similar to any other Windows based wizards The wizard is meant for selecting differ ent data such as device type device driver connection time etc for OPC server configuration Tag Name Adtes DataType ScanRate Scaling Description Default User Clents 8 Actve tags Oofo Figure 41 NI OPC Servers Runtime window showing New Channel Creation Pokharel
52. ming aveform gt Synchronization Graphics amp So gt Measurement I O gt Instrument I O gt Vision and Motion Mathematics gt Signal Processing amp Data Communication Connectivity gt Control Design amp Simulation gt Express Addons gt Favorites gt User Libraries Selecta VI gt FPGA Interface DSC Module Figure 34 NI LabVIEW Block Diagram Pokharel 2013 72 NI vision NI vision is a library included in the NI Vision Development Module for LabVIEW NI Vision is meant for the development of machine vision and scientific imaging applications The steps that are involved in creating a machine vision application in LabVIEW are discussed in the following sub sections Machine Vision and Object Sorting PLC Communication with LabVIEW using OPC dez Setting up the imaging system Setting up the imaging system 1s the most important part for developing a vision application Before an image 1s acquired the imaging environment should be favorable for the image analysis method going to be used The imaging environment should produce image with quality high enough to extract the information needed The important aspects to be fulfilled are the type of camera being used the lens of the camera its resolution and the surrounding lightings Lighting is a vital aspect for image acquisition as poor or vivid light accounts for poor image an
53. ms instead of other indus trial cameras The pattern matching was done at different times of the day every time the score generated by the vision assistant needed adjustment for the cor rect pattern matching This shows that pattern matching is based on direct correlation matrix algorithm The score generated for the image template was 900 If the score was increased over 900 none of the objects matched the pattern below 900 pattern matched but 1f the score was below certain score for example 850 the objects which tend to be of the same pattern also matched In that case the aim of pattern matching failed Although pattern matching is not affected by lighting 1t was seen that shadow formation of some other objects over the analyzed object hindered to match the pattern stored in the pattern template So to say that pattern matching is independent of lighting might be somewhat unrealistic It might be said that pattern matching not affected by lighting directly but there might be some other indirect cause relating to light that affects pat tern matching It was also confirmed that PLC could be integrated with LabVIEW using OPC communication protocol communication was enabled using NI OPC Servers in this thesis The integration of simatic PLC was illustrated in this thesis but almost all the PLCs can be integrated with LabVIEW using NI OPC servers provided there is an OPC driver for the PLC In this thesis document it was possible to
54. nalysis over a conveyor EURESYS ADR Tech nology Advanced Downweb Resampling Line scan cameras consist of row of photocell on a single integrated cir cuit sensor As with the name of this type of cameras suggests the lighting should be selected such that it follows the same kind of symmetry as the camera The most obvious lighting would be long tube lights parallel to the line of camera and perpendicular to the direction of motion of convey ors Davies 2012 730 2 3 Camera calibration Camera calibration estimates the intrinsic and extrinsic parameters of a camera Usually the camera parameters are represented in a 3X4 matrix called the camera matrix It 1s directly dependent on the optical design of the camera The intrinsic parameters are the focal length pixel coordinates and principal points whereas the extrinsic parameters are relative position of camera and rotational matrix and linear vector of camera Wikipedia 2013 Camera resectioning The method for calibrating a camera is not included in this document But the camera may be calibrated using the calibration algorithms available in the machine vision software 2 4 Lens optics The cameras for machine vision works on the basis of pin hole camera model This model assumes that the perspective rays pass through an in finitesimally small aperture at the front of the camera But in practice the aperture must be larger to admit more light Lenses are placed in the aper
55. o be available Even after the computer restarts the SVE will be running as long as it is not stopped Hence the shared variables can be shared with any other OPC servers or OPC clients Also the SVE can be a server or a client National Instruments 2012 Introduction to OPC SVE acts as a mediator among NI PSP and other application s The I O servers are configured as OPC clients by the help of NI DSC Module 35 Machine Vision and Object Sorting PLC Communication with LabVIEW using OPC Similarly the SVE can be configured as OPC server to publish the NI PSP data over the network for other OPC clients to interact Figure 47 shows a schematic diagram for OPC implementation in Lab VIEW Shared Variable OPC DAQ E LabVIEW 4 Engine Server OPC Device MA oPc ad Client Server OPC Client a a A d Figure 47 Shared Variable Engine can be either an OPC server or client Pokharel 2013 7 3 5 LabVIEW as OPC client LabVIEW can operate as both OPC server and OPC client But the neces sity of this thesis project targets 1t to act as OPC Client This section ex plains only the method of creating LabVIEW OPC client the steps are as follows 1 When the LabVIEW is launched select Blank Project Note that the method might vary depending upon the version of LabVIEW The steps mentioned here are based on LabVIEW 2012 But what ever the version is this can be done from the File menu File gt gt New Project 11 Th
56. ocessing and machine vision tools for a better output Image processing The acquired image needs to be further processed by using image processing tools such that the information lost during acquisition could be regained Some of the generally used image processing tools for machine vision applications are as follows 1 Pixel counting Pixel counting is one of the most common image processing methods It involves counting of the light or dark pixels that an image is formed of It can be analysed by histogram that shows the grayscale distribution in an image 11 Thresholding It is the simplest process of dividing the image into segments It 1s used for creating a binary image from a grayscale image so that the region of interest is separated from the back ground It requires that the region of interest and the background have enough contrast Figure 17 shows image before a and after b thresholding a b Figure 17 Stained biological cells a after thresholding b National Instruments 14 Machine Vision and Object Sorting PLC Communication with LabVIEW using OPC iil Image filtering Different 1mage filters can be applied for the image processing Ready made filters are available and also user customized filters can be created Linear filters spatial filters FFT Fast Fourier Transform filters etc are some of the filters used in image processing The algorithms of the image processing Figure 18 Filtered
57. on Gatesmark Publishing Logitech 2010 Logitech HD WebCam C615 Accessed 15 March 2013 http www logitech com en us product hd webcam c6 15 Lode s Computer Graphics Tutorial 2004 Image Filtering Accessed 30 April 2013 http lodev org cgtutor filtering html Machine Vision pdf file ebook Accessed 15 J anuary 23 7 April 2013 http www cse usf edu r1k MachineVisionBook Machine Vision pdf Movimed Custom Imaging Solutions 2007 Illumination Accessed 16 April 2013 http www movimed com Illumination htm National Instruments 2013 Connect LabVIEW to any industrial Network and PLC Accessed 13 J anuary 2013 http www ni com white paper 5407 en National Instruments 2012 Introduction to OPC Accessed 7 March 2013 http www ni com white paper 745 1 en National Instruments 2012 LabVIEW 2012 Datalogging and Supervisory Control Module Help Accessed 19 March 2013 http digital ni com manuals nsf websearch 5 1AA757C42C65F0D86257 A0C0029ABD 0 National Instruments 2008 Robotics Fundamental Series Feature Extraction Accessed jg April 2013 http www ni com white paper 8222 en National Instruments 2005 NI Vision for LabVIEW User Manual Accessed 21 Febru ary 2013 http www n1 com pdf manuals 371007b pdf National Instruments 2006 Counting Particles or Cells Using IMAQ Accessed 19 March 2013 http www ni com white paper 3 169 en 49 Machine Vision and Object Sorting PLC Communication with LabVIEW usin
58. on and Object Sorting PLC Communication with LabVIEW using OPC See ee AA AAA AI Appendix 2 STEP 7 Symbol Table SIMATIC Object_sortingl 04 24 2013 01 58 46 PM SIMATIC 300 1 CPU 315 2 DP S7 Program 1 1Symbols Properties of symbol table Name Symbols Author Comment Created on 02 18 2013 01 33 20 PM Last modified on 04 24 2013 01 58 38 PM Last filter criterion All Symbols Number of symbols 39 39 Last Sorting Symbol Ascending Status symbor Address_ Datatype Comment RL LA IE _ A Y Bemsensor Jr 17 BO COMPLETE RESTART OB 100 oB 100 1 O j evtec J 1 o 7 41 o me T MM M Swenigw oN a os Bot AAA Gipper_close output a 11 Boor OOOO rs 1 MAS COI NE Bo AAA aaam Outputs rc 4 rc A A ree umm El NA Program Sequence FC 1 fre 13 mew CNN ET Puh Mve fa oo Boot O E Ps o2 o Puse Move la 02 BoL RedigtON o 0 Boo 3 O Reflective Sensor 15 BOR O O RESET 1 23 B00 J uL Cur jReetSrer rc 2 ro 2 Rome O oe feon
59. on methods can be applied for object sorting depending upon the products and standards to be met Different algorithms made ready for ex ecuting inspection through machine vision by different hard working pro grammers and software companies are available The customers are free to choose from the ready made algorithms or create their own customized al gorithms using the tools provided by the software Some of the methods that can be applied for object sorting are described in the following sub sections 4 1 1 Pattern matching Patten matching is the process where a template image is defined and stored in the memory This template image is also referred to as reference image When the real world images for example image of products in a factory production line are acquired using camera the software searches for instances of the template images stored in the memory and confirms if the product matches the pattern defined in the template image or not A rectangular box around the image often indicates pattern matching Pattern matching 1s a significant machine vision tool as 1t is independent of light ing variation blur and noise 16 Machine Vision and Object Sorting PLC Communication with LabVIEW using OPC Pattern matching technique can be used for gauging measuring lengths diameters angles etc product inspection detecting flaws such as miss ing parts or components from a product and product alignment deter mining the posit
60. present only a simple pattern recognition technique for the object sorting Although the objective of sorting object using machine vision tool was met it was realized that ge ometric matching tool would be more robust for sorting objects The ob jects used in the project were all similar defining only one parameter could be enough in such condition to get the result But the case would not be the same always The objects may have different shapes and sizes in such cases it is not enough to match only the pattern of the object Meas uring distances between two points measuring diameters etc could be added to the application to make it more powerful and error free 48 Machine Vision and Object Sorting PLC Communication with LabVIEW using OPC SOURCES ALLIED Vision Technologies 2006 Application Note Choosing a Machine Vision Camera Accessed 15 March 2013 http www alliedvisiontec com fileadmin content PDF Support Application_Notes AL L ApplNote Choosing A Machine Vision Camera pdf Basic Photography Tutorials 2001 An Introduction To Exposure Accessed 16 March 2013 http www silverlight co uk tutorials compose expose exposure html Davies E 2012 Computer and Machine Vision 4 edition Waltham Academic Press EURESYS 2005 ADR Technology Accessed 18 March 2013 http www euresys com Products grablink ADRTechnology asp Gonzalez R Woods R amp Eddins S 2009 Digital Image Processing using Matlab 2 editi
61. re also available Depending on the sensor technology used different cameras can be classified into two categories as follows 1 CMOS cameras 11 CCD cameras The sensors could be matrix sensors or line sensors An image sensor converts an optical image into an electronic signal Wikipedia 2013 Im age sensor Choosing a machine vision camera can be a difficult task However reso lution sensitivity and type of camera monochrome or color should be considered when buying one ALLIED Vision Technologies GMBH 2006 Also the interface the camera uses for communication should be considered The available interfaces include USB Ethernet Firewire etc CCD cameras A CCD Charge coupled Device camera uses the CCD sensor technolo gy The main features of these sensors and hence cameras are listed as follows Vision Systems Oy 2012 1 The most common camera sensors 11 In coming charges are stored Machine Vision and Object Sorting PLC Communication with LabVIEW using OPC AAA AAA 111 1V V V1 Vil Vill Figure 6 alongside shows a CCD sensor Equivalent to films of traditional film cameras Consist of pixels with a typical size of l0um x 1Oum These are both color and monochrome These are light sensitive diode sensors Each pixel has a micro lens for focus ing the light into the sensor surface Disadvantage of these sensors is the possibility of over exposure Figure 6 CCD image
62. reen light ON in OPC1 Dependendes bs es Build Specifications Figure 54 LabVIEW Project Explorer window showing the added shared variables Pokharel 2013 Now a VI can be added to the project using the following steps 1 Right click My computer on the project window and select New gt gt VI as shown in Figure 55 Untitled Project 1 Project Explorer fs ka File Edit View Project Operate Tools Window Help XControl oe gt NISoftMotion Axis Sse NI SoftMotion Coordinate Space CSN Sof tM tion Table iti aid New Figure 55 Adding a VI to the LabVIEW project Pokharel 2013 11 Then the required kind of program can be coded in the VI The shared variables can be added easily by drag and drop method Machine Vision and Object Sorting PLC Communication with LabVIEW using OPC ASADA eee 8 PATTERN MATCHING USING NI VISION Figure 56 shows the graphical program or the human machine interface HMI created in LabVIEW for object sorting 596 IX8 btimage 154 111 270 Minimum Match Score Pattern Matching 2 joe Figure 56 Pattern matching shown by a rectangular box around the object Pokharel 2013 Express machine vision VIs were used for this purpose with some addi tional LabVIEW blocks and functions Using express VI is easier in com parison to other separate machine vision blocks It also reduces time and mistakes Pattern matching machine vision tool was used
63. rver Pokharel Hence a new channel for OPC communication was created The newly created and configured channel can be visible on the left section of the runtime window shown in Figure 41 above p 32 Next a device needs to be created and configured The steps involved to create a new device are as follows 11 Click on the click to add a new devices that is visible under the created channel as shown in Figure 41 above p 32 If 1t is not visible click the plus sign on the left side of the channel name After this the new device wizard appears Provide a suitable device name for example CPU315 2DP and click Next gt button Machine Vision and Object Sorting PLC Communication with LabVIEW using OPC A AN eee eee ili Follow the wizard until the summary window of the wizard ap pears as shown in Figure 44 Finally click Finish button New Device Summary x ff the following settings are correct click Finish to begin device Figure 44 Summary of the New OPC server Device configuration Pokharel 2013 Thus the device has also been created Next the tags are to be created To create tags click on the Click to add static tags that is visible on the right section of the runtime window shown in Figure 41 above p 32 it is visible only after the device has been created A tag creating window ap pears where the tag can be configured An example tag configuration is shown in Figure 45 LI
64. s consist of issues that are relat ed to machine vision components machine vision process developing a machine vision application deploying the application to the desired con trol station and a method for the industrial communication between PLC and LabVIEW 1 1 Machine vision today With the recent advancement in technology machine vision can be ap plied to extract different properties of the objects such as their dimensions areas etc The application of machine vision has been seen in medical in dustrial and security fields The application made for one machine vision purpose might be also applied for a different but similar purpose for ex ample the application made for object sorting can also be used for object tracking or geometric classification Table 1 shows some machine vision applications in different fields Table 1 Some applications of machine vision Medical Fields Industrial Fields Security fields DAE O O AP diagnosis tion Treatment of Robotic a 1 em eee n skull abnor ministration and surveil lance children 4 Object inspection 5 Pattern recognition 6 Edge detection Machine vision is a broad term Many mathematical theories image ac quisition image processing and analysis etc form the whole machine vi sion world Therefore to define machine vision 1s a difficult task if these things are considered Pages and pages could be written on these different malities in Object detect
65. sion 2 Time stamp Code 04 21 2009 01 06 37 AM Interface 02 15 1996 04 51 10 PM Lengths block logic data 00180 00070 00020 TEMP ee CA 0h OIE c NNN Ria e eor ert A dert In OC RRA ll aL a Oe rs e ed emen ne ee A a ue em n m pA e m eom 16413 Event class 1 Entering event state Event logged in OB100 EV CLASS diagnostic buffer 08100 STRTUP Byte i 16881 82 83 84 Method of startup OB100 PRIORITY Byte No of OB Execution T Tm OB100 OB NUMBR Byte 13 0 100 Organization block 100 OB100 MEM OBI00 RESERVED 1 Byte 4 0 Reserved for system ee OBl100 RESERVED 2 myte 50 Reserved for system n 77 MI Oo oe er fal apatite am ie re OB100 STRT INFO DWord 8 0 Information on how system started OB100 DATE TIME Date And Time Date and time OB100 started Block OB100 Complete Restart Vii i Bl rr PAG M M o tn VEMM Pr I ENBUMNIBMIIM Page 1 of 3 Machine Vision and Object Sorting PLC Communication with LabVIEW using OPC E AN eee SIMATIC Object _sortingl 04 24 2013 01 59 03 PM SIMATIC 300 1 CPU 315 2 DP OB100 offline gt li 1 Wait Wait Ni S Wait O MO 1 R MO 2 a LI M0 5 MO 6 M1 3 M1 4 M1 5 M1 6 gt M2 0 M2 1 R Page 2 of 3 Machine Vision and Object Sorting PLC Communicat
66. st cence yd A i cog a d ecu Seat 3l do INEESDVIEW OPC SE iia 31 7 3 1 Configuration of an OPC server oocccccncccnonononnnnnnnnnononnnnoncnnnnnnnononnnanonnnss 32 7 5 2 UPE QUICK CUM E R 34 SS INDDSC module ii iaa 35 7 3 4 OPC implementation in LabVIEW ooooooonnnnncncnnnnnnnnnccnnnnnnnnnnnnnnononnss 33 7 9 9 LabVIEW ds OPC CHEN c erii obli 36 8 PATTERN MATCHING USING NI VES ION ieietese eae tbi eoe hetero nes 4 Sal AOWICCE eiim 46 Y CONCLUSIONS aaa 48 SOURCES T 49 Appendix 1 Appendix 2 Appendix 3 Appendix 4 Appendix 5 Appendix 6 Appendix 7 Appendix 8 STEP7 OBI Function Calls STEP7 Symbol Table STEP 7 OB100 Complete Restart Organization Block STEP 7 FC1 Function for a complete Automation Sequence STEP 7 FC4 Outputs Defined Function STEP 7 FC2 Sorter Reset Function Signal Module KL1114 Datasheet Signal Module KL2114 Datasheet Machine Vision and Object Sorting PLC Communication with LabVIEW using OPC l INTRODUCTION Machine vision MV is a young discipline in the field of science and technology It has emerged as a useful industrial tool for about 25 years and is growing at a higher speed Davies 2012 Foreword The applica tions of machine vision in industries have been typically seen in measure ments counting quality control object sorting and robotic guidance It has become a yielding tool in product inspection and analysis because it re
67. struments Variable Engine 1 120 National Instruments NIOPCServers V5 Prog ID 7 Instruments NIOPCServers V5 Lox c _ teo Figure 50 Configuring OPC Client I O Server Pokharel 2013 Then a library is created Untitled Library 1 The name of the li brary can be altered as desired On expanding the library name clicking the sign a label OPC Client the label can be altered can be seen Right click OPC Client and select Create Bound Variables as shown in Figure 51 gt Untitled Project 1 Project Explorer ioj x File Edit View Project Operate Tools Window Help 5S 5 x Re ee m An BK My Computer B 3 Untitled Library 1 i Es Dependencies L ES Build Specifications Figure 51 Creating Bound Variables Pokharel 2013 Then the Create Bound Variables Window appears as shown in Figure 52 below From the left of the window expand the device that was created using NI OPC Server and select the variables tags to be implemented in LabVIEW client Multiple tags can be selected and added by clicking Add gt gt button and then click OK Machine Vision and Object Sorting PLC Communication with LabVIEW using OPC Vil Vill Create Bound Variables xj Browse Source Project Items Add gt gt EAE cpu315 2DP Add range gt gt H System Auto Custom base name Belt Emergency ies Green_light_O soe Gripper_dose_ a Gripper dose T Copy prop
68. te_180_output Boolean 0 09 47 59 503 Good Wd ooo mm o e AAN PU a bo neslese aT 008 80 Pu md ls xf ttem Count 313 7 Figure 46 OPC Quick Client showing data type value timestamps and quality of different Items or tags Pokharel 2013 7 3 3 NI DSC module NI DSC Datalogging and Supervisory Control module extends the Lab VIEW graphical development environment by providing additional func tionality to connect to distributed measurement control and high channel count monitoring applications National Instruments 2012 NI LabVIEW Datalogging and Supervisory Control DSC Module The DSC module enables connection through shared variables and pro vides a method for interacting with touch panel devices The details relat ing to it is out of the scope in this thesis 7 3 4 OPC implementation in LabVIEW LabVIEW can be interconnected with other devices or software to share data as well as read and write data using OPC protocol LabVIEW can be connected to both OPC servers and OPC clients to share data The primary component that allows LabVIEW to implement OPC is the SVE Shared Variable Engine that is installed at the time of LabVIEW installation The SVE manages the shared variable using a proprietary technology called the NI Publish Subscribe Protocol NI PSP The SVE runs as a separate process on the computer as soon as the shared variables are deployed to it No LabVIEW or VI needs to be running for the shared items t
69. to reach the goal of object sorting The program follows simple steps Figure 57 shows the block diagram created for object sorting in LabVIEW Figure 57 Block diagram created for object sorting using pattern matching machine vision tool Pokharel 2013 Machine Vision and Object Sorting PLC Communication with LabVIEW using OPC Se eee AAA The steps that were used for developing the application shown in Figures 56 and 57 above are as follows 1 First of all the camera was adjusted in a proper position such that it was perpendicular to the object scene 2 Then image acquisition express VI was launched to check if the cam era was working or not a window as shown in Figure 58 appears This is the place where the acquisition device acquisition type acquisition settings and controls and indicators can be selected NI Vision Acquisition Express xj Select Acquisition Source Select Acquisition Type Configure Acquisition Settings Select Controls Indicators Acquisition Sources for Localhost EGA NI IMAQdx Devices e cam USB Video Device 312FC95AE 1986923 Egg Simulated Acquisition gq Folder of Images 53 AVI Acquiring at 5 fps 1920x1080 32 bit RGB image 93 106 386 0 0 lt lt Back Next gt gt Finish Cancel Figure 58 NI Vision Acquisition Express window where different acquisition settings can be done Pokharel 2013 The acquisition was set to continuous as
70. truments www ni com Programs written in LabVIEW are called VIs virtual instruments It is a powerful tool used by engineers and scientists for different kind of measurements process controls and R amp D Research and Development It can easily be integrat ed with most of the hardware provided the driver of the hardware is in stalled into the computer LabVIEW can also be integrated with other software tools such as Matlab and Simulink It can be connected to different PLCs Programmable Logi cal Controllers via different industrial communication protocols for ex ample through OPC Ethernet Profibus ProfiNET protocols It can be im plemented into process controls ranging from small scale to large scales One advantage of programming in LabVIEW is that we don t have the overhead to write huge codes Just the function of the different blocks needs to be known Also another advantage 1s that it works on Dataflow Programming principle 1 e the output is only obtained when all the in puts get their input data 7 1 LabVIEW basics The installation procedure can be found over the internet or once the in stallation requirements installation CD DVD operating systems etc are available LabVIEW can easily be installed following the onscreen setup wizard As soon as LabVIEW is installed into the computer it can be accessed in the same way as other software is accessed If the operating system 1s Windows it is common that
71. ts should be consid ered Figure 3 shows ring lights and their assembly Low Angle Lights Figure 3 Different low angle ring lights a and their assembly b Movimed custom imaging solutions High intensity LED lights arranged to rectangular oblique illumination units can also be used for direct lighting instead of ring lights and low an gle ring lights as shown in Figure 4 Movimed custom imaging solutions 2007 d Figure 4 Bar lights for direct illumination Movimed custom imaging solutions 2 1 2 Indirect illumination When the illumination is done all over the object it is referred to as indi rect lighting Indirect lighting can be achieved in several ways such as us ing backlights line lights flat ring lights etc Figure 5 below shows some indirect lighting source types Machine Vision and Object Sorting PLC Communication with LabVIEW using OPC ASADA eee 2 2 2 1 c Figure 5 Different types of indirect lighting sources a Flat ring lights b Line lights c Back lights Movimed custom imaging solutions Image acquisition Image acquisition is the most important part in a machine vision system It involves capturing an image of the object to be analysed with the help of camera Different types of cameras can be used for image acquisition they can include an ordinary mobile camera a typical digital camera or even a webcam But cameras that are tailored specially for industrial use a
72. ttings were complete the window was closed using Finish button 3 The created VI was allowed to Run once which was then stopped af ter an image was acquired Machine Vision and Object Sorting PLC Communication with LabVIEW using OPC LEE 4 Then an image was created using IMAQ Create VI Image name and the image type were also defined This can be clearly seen in Figure 57 p 41 5 The New Image output terminal of the IMAQ Create VI was wired to the Image Dst input terminal of IMAQ ExtractSingleColorPlane VI Vision Utilities gt gt Color Utilities This block enables to extract one color plane only from the acquired color image Intensity was select ed for the color plane Also the Image Out output terminal of the vi sion acquisition block was wired to the Image Src output terminal of the IMAQ ExtractSingleColorPlane VI Pattern matching tool does not support RGB 32 bit image and supports only 8 bit image So choos ing only one plane enables pattern matching to be used 6 Then the Vision Assistant express VI was launched and immediately navigated to Machine Vision tab pattern matching was selected under this tab This 1s shown in Figure 60 NI Vision Assistant File Edit View Image Color Grayscale Binary Mac amp ue LARR E SA 20384160 png 8 bit 640x480 A Ue 1 of 1 Max Clamp Measures the maximu distance separating object edges Figure
73. uration done for this project Dh HW Config SIMATIC 300 1 Configuration Object_sorting E nmi xi Ql Station Edit Insert PLC View Options Window Help la x DESE mu eb s S ond da ED E92 Bl xj B 5307754 a me aja CPU 315 2 DP Profile Standard y fe 15 LC310 x PROFIBUS DP SE PROFIBUS PA 48 PROFINET IO 3 0 SIMATIC 300 H A C mcg CP 300 1 3 CPU 300 H FM 300 Gateway H IM 300 M7 EXTENSION H A PS 300 RACK 300 mg SM 300 SIMATIC 400 SIMATIC PC Based Control 300 400 2 SIMATIC PC Station 15 Lco Slot 4 O Order Number Designation SDiBBitdgtslinputs O J 8DI 8 Bitdigitalinputs O 8DI 8 Bit digital inputs Jae 8DQ8 Bit digital outputs 0 k 8Dd8Bit digital outputs t 8DG8Bitdigital outputs 2 ul E l Address Q Address Comment PROFIBUS DP slaves for SIMATIC 7 M7 and C7 Eg distributed rack xj Say Press F1 to get Help Figure 31 An example Hardware configuration for simatic PLC Pokharel 2013 Machine Vision and Object Sorting PLC Communication with LabVIEW using OPC 7 NILABVIEW NI LabVIEW is a graphical program G programming development envi ronment from National Ins

Download Pdf Manuals

image

Related Search

Related Contents

Instrucciones de uso / Genius  400 ST 600 ST  Liquid Level Gauges  Fisher-Price J9632 User's Manual  Analyse des gaz d`échappement des moteurs à essence  pcDNA6/Myc-His A, B and C - Thermo Fisher Scientific    important - Invacare    CDA HC7620  

Copyright © All rights reserved.
Failed to retrieve file