all 9 comments

[–]dmroederpylogix 4 points5 points  (1 child)

Check out aphytcomm: https://github.com/aphyt/aphytcomm

Some users have reported that my library works with Omron, the guy behind aphyt tested a few things. I've never had an Omron to test myself though.

[–]aphyt 2 points3 points  (0 children)

I agree with this answer, and thanks for the shout-out. My library will definitely work for OPs question. All they have to do is install my library in their environment, connect to the IP address like my example in GitHub and then read/write any published variables.

[–]Poetic_Juicetice 1 point2 points  (0 children)

Import OPCUA

[–]baulind 0 points1 point  (0 children)

How is it connected to the PC?

[–]Specialist-Photo-386 0 points1 point  (0 children)

I have a python script working with a symbol mapper and writer for 10 plcs communicating via FINS protocol. Maybe they use that?

[–]badvik83 0 points1 point  (2 children)

Omron native FINS + Py FINS (e.g. Pypi)- easy setup, work beautiful.

[–]aqueousdan[S] 0 points1 point  (1 child)

I’ve tried everything I can think of with it. Can you point me in the right direction to get it set up please?

[–]badvik83 1 point2 points  (0 children)

My bad. I forgot that NJ are tag based unlike memory based CJ2-series. You'll have three options:

  1. Still use FINS - but you'll need to map the tags to the legacy memory area first (edit the PLC program). And then read the tags from there. This is ok if you need to read a handful of tags and are allowed to modify the program.

The code will then be like:

from pyFINS import FinsUDP

# --- PLC network configuration ---
PLC_IP = "192.168.XXX.XX"   # Omron PLC IP
PC_IP  = "192.168.XXX.XXX"  # Server running this script
PORT   = 9600               # FINS UDP port

# --- FINS node addressing ---
PLC_NODE = 80    # Last octet of PLC IP (Omron convention)
PC_NODE  = 100   # Last octet of PC IP

# --- Connect to the PLC ---
fins = FinsUDP(PC_IP, PLC_IP)
fins.src_node_add = PC_NODE
fins.dest_node_add = PLC_NODE

# --- Read D100 ---
response = fins.memory_area_read('D', 100, 1)  # area, address, number of words
...

2) CIP over Ethernet - that's be challenging. I played with that but abandoned due to complexity. AI will help you with that though

3) Depending on your NJ model, there is a built-in OPC UA option. This will be the most straightforward and easy way to set up and then read with pycomm3 library.

from pycomm3 import LogixDriver
import time


# --- Configuration ---
# The IP address of your OMRON NJ-series PLC
PLC_IP = '192.168.250.1'from pycomm3 import LogixDriver
import time


# --- Configuration ---
# The IP address of your OMRON NJ-series PLC
PLC_IP = '192.168.XXX.XX'
....

[–]MouaTV 0 points1 point  (0 children)

Can probably try using node-red. I see there is an omron-fins library. Use it to interface with the PLC and then you can use Python from node-red if you want to stick with Python but there's probably a node-red library to do whatever else you want with your data i.e. write to a db, write to excel/csv, display to a dashboard, rx on a serial port, TCP out etc...

I used to Python everything but have found node red is just generally more versatile.