I'm using image processing to find defective pens with their writing. Reference image and a defective image is shown below.
I used python and openCV and I got below image using XOR (subtraction) operation.
Now I want to send a digital signal when such a defective pen is detected. How can I do that?
解决方案
Well there are different ways to achieve communication between a PLC and your python script. I have had some succes with communication between a Siemens S7-1200 with using the snap7 module which you can install via pip. It is quite simple to use and I could read/write inputs, outputs, markers,... I am not sure but I think that LOGO has a similar communitaion protocol as the S7. You could check out this link Snap7 - LOGO. You can also just google "snap7 python" and read the documentation.
There is another module called libnodave. I have not tried it but I heard people had succses with it. You can also google it and read the documentation.
I have also had succses with communicating the S7-200 (older PLC) which doesn't have an ethernet port. I used Arduino and an I/O shield that has 24V rele outputs. You can easily communicate with Arduino via Serial communication and this solution could definetly be used for LOGO. Note that Arduino is not an robust solution and it could get interferences from near high voltage devices. You could make a faradei cage to supress the interference though I have never tried it.
You can also try an on-machine modules that can get signal from almost anything and communicate with PLC but theye are probably expensive.
Hope it helps a bit or at least widen your area on finding the solution. If you wish, I can post sample codes for arduino communication or the snap7 library communication. Cheers!
Note: This kind of question would be better on Signal Processing Stack Exchange