This tutorial shows how Python scripts can be used with the Opto Memory-Mapped Protocol (OptoMMP) to read and write data to Opto 22 memory-mapped devices for simple, powerful I/O control.

This approach was applied to create the optommp Python package for groov EPIC that is detailed after the tutorial section. This open source package is hosted on the Python Package Index (PyPI) via GitHub where you can find a readme for its use.

For API syntax and tips, see the OptoMMP Protocol Guide (form 1465). Sample Python scripts are at the end of this tutorial.


  • A groov EPIC processor with SSH access
  • Programming experience (Python recommended)
  • Experience with hexadecimal values and memory addressing is helpful


OptoMMP is a memory-mapped protocol based on the IEEE 1394 standard that is used to create custom software applications for remote monitoring, industrial control, and data acquisition. For a list of compatible hardware, see the OptoMMP Protocol Guide (form 1465).

Byte-sized Tools

Since Python is so high-level it is missing a few bit- and byte-sized memory manipulation tools, which can make packing and unpacking data somewhat convoluted. This tutorial relies on Python’s socket interface to send and receive data, and I’ll be managing that data using:

  • Built-in arrays to hold the data
  • Built-in bytearray to encode the data
  • Imported struct library to help translate

It is helpful to be familiar with these tools but their basic usage will be covered in this tutorial.

TIP: To keep Python scripts dynamic, pass in arguments at runtime rather than hard-coding them; simply reference these values with sys.argv[#] to get the #th argument value, where the script name is held in sys.argv[0].


Next Step

Continue with Building an OptoMMP Data Package.

Or check out the prebuilt Python package for groov EPIC.