Skip to main content

Omron FINS Driver in Python 3

This project is a Python 3 library for communicating with Omron PLC's that use the FINS (Factory Intelligent Network Services) protocol. This library will allow the programmer to write a platform independent computer program to supervise and modify memory areas in the PLC for reporting or providing user input into the PLC. This project has been tested on an extremely limited amount of hardware, so please confirm that it works with your system. Omron has been pretty consistent with how they implement FINS across PLC platforms, so I'm optimistic that it will work for most systems using Ethernet based CP/CS/CJ processors, but as stated in the license, this code is provided "as-is" with the user being responsible for determining suitability.

If you're interested in trying it out, or just taking a look at it to see how the FINS protocol works, you can download it from my GitHub Page.

documentation

Examples

The following program demonstrates the most common application, which is reading and writing to memory areas. The program below will set the five low bits of CIO 100 (write 0x1f) , read them back, and then reset the five low bits ( write 0x00) and read them back. For the CP1 PLC that I am using, those five bits correspond to the relay outputs, so if you have a similar system, you would hear the relays click on and off.

import fins.udp
import time

fins_instance = fins.udp.UDPFinsConnection()
fins_instance.connect('192.168.250.1')
fins_instance.dest_node_add=1
fins_instance.srce_node_add=25

for i in range(2):
    fins_instance.memory_area_write(fins.FinsPLCMemoryAreas().CIO_WORD,b'\x00\x64\x00',b'\x00\x1f',1)
    mem_area = fins_instance.memory_area_read(fins.FinsPLCMemoryAreas().CIO_WORD,b'\x00\x64\x00')
    print(mem_area)
    time.sleep(1)
    fins_instance.memory_area_write(fins.FinsPLCMemoryAreas().CIO_WORD,b'\x00\x64\x00',b'\x00\x00',1)
    mem_area = fins_instance.memory_area_read(fins.FinsPLCMemoryAreas().CIO_WORD,b'\x00\x64\x00')
    print(mem_area)
    time.sleep(1)

Another useful application would be to transfer the program from the PLC into a hex file so that it could be transferred into another PLC of the same model. This might be necessary if you wanted to send an updated program to a customer PLC that does not have Omron's CX-One programming suite. The code below will connect to the PLC and transfer the program and store it in a file named "plcprogram.hex".

import fins.udp
import time

fins_instance = fins.udp.UDPFinsConnection()
fins_instance.connect('192.168.250.1')
fins_instance.dest_node_add=1
fins_instance.srce_node_add=25

fins_instance.plc_program_to_file('plcprogram.hex')

If you want to turn around and download that program to the same model of PLC you could use the follow code (assuming your "plcprogram.hex" file is in the same directory as where you execute the Python code, otherwise use relative or absolute paths appropriate for your operating system):

import fins.udp
import time

fins_instance = fins.udp.UDPFinsConnection()
fins_instance.connect('192.168.250.1')
fins_instance.dest_node_add=1
fins_instance.srce_node_add=25

fins_instance.file_to_plc_program('plcprogram.hex')

Notes

The source code also contains a fins.usb connection, but it does not work (nor was it intended to work) with the driver that Omron ships with their CX-One suite. It requires the user to generate their own USB driver with a package like LibUSBK, and use Omron's Vendor ID and Product ID. I would not recommend it unless you have a very good idea what you are doing.

Metadata

Release files for fins 1.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fins 1.0.5
File Size Uploaded
fins-1.0.5.tar.gz 17.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for fins 1.0.5
File Interpreter ABI Platform
fins-1.0.5-py3-none-any.whl Python 3 none any Details

Total release size: 34.8 kB

Release files / fins-1.0.5.tar.gz

Download URL fins-1.0.5.tar.gz
Size 17.4 kB
Tags Source
SHA-256 checksum
How to use checksums
5d7ce0289fbf2b6a96eef5f9814dded917c86193ac6ff6fe71f40d0f55bd50e2
BLAKE2b-256 checksum
How to use checksums
e285f7da6de822cd37697787e3e49cb0f0f9d5b4e5678ec5d7d0db814eb920b7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.4

Release files / fins-1.0.5-py3-none-any.whl

Download URL fins-1.0.5-py3-none-any.whl
Size 17.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4ec970b297b93108b8e246e4c0e9822409f84c1ce973589b44cbe099145ee447
BLAKE2b-256 checksum
How to use checksums
6ccb6068112fe79a421aead51824af3bdba1e32fa44100ce38c4b6b00f61c048
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.4

Release history Release notifications | RSS feed

This release

1.0.5 This release

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

1 release file

1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page