Best way to communicate my Python script with Keyence PLC?

159 views Asked by At

So, I've been looking into this for a few days already but haven't figured out how to have Python "talk" to the PLC. I've been able to find some documentation where they explain how to connect to third-party accessories, but what I need is to send signals depending on what my Python script is able to retrieve from the DB. Here's a brief explanation of what I'm trying to do: We have a conveyor line, items (previously entered in our DB) come down the line and depending on what their status is, the PLC should push them to a different lane. We already have all the infrastructure working, but we haven't been able to send a signal from the script that checks the items against the DB. We have a PC running the ladder logic and the Python script. This PC is connected via Ethernet cable to the Keyence PLC (KV-NC32T paired with the Ethernet module KV-NC1EP to be precise). I'm able to send signals from the ladder logic to the PLC by turning individual registers on, but then again, I need to automate this so that the Python script can decide what should be done with the item. I've been messing with Python sockets in order to accomplish this, but when checking on the ladder logic side (KV Studio) no information is received. I also added the PC as a generic device under the Ethernet module, gave it the proper IP address but still, no connection is made.

I have this test script that is sending information to the PLC IP address via sockets on different ports (5000, 5001, 8500-8506) but the PLC monitor shows no data is being received.

Does anyone know what is the best way to accomplish this or if I'm even heading down the right direction? 'Preciate your help!

0

There are 0 answers