Skip to the content.

SLMX4 Health Python Wrapper

Back

This folder contains python code for interaction with the SLM-X4 module running the health firmware.

The slmx4_health_wrapper.py file contains an interface which allows python to interact with the SLM-X4 running the health firmware.

Health Firmware Protocol

The health firmware that the python wrapper uses operates on the USB port as a Virtual COM port. On a Windows system, the device will show up in the ‘Device Manager’ with an identification such as ‘COM6’. On Linux, the identification will typically be /dev/ttyACM0.

The health firmware uses USB as the physical interface. On top of that, the health firmware passes messages using Protocol Buffers. The slmx4_usb_vcom_pb2.py file contains the specific protocol buffer specification in python.

The slmx4_usb_vcom_pb2.py specification includes definitions used outside of the health firmware. The included wrapper accesses the necessary functions to operate the health firmware only!

Python Dependencies

The python wrapper uses mostly standard python3 modules. However, since the USB port is used we need a serial interface, pyserial in this case. Installation using pip is the same on Windows and Linux.

On Windows you may need to have admininistrative privileges…

To install pyserial:

python3 -m pip install pyserial

There is also a demo which plots the respiration waveform. This requires use of matplotlib.

To install matplotlib:

python3 -m pip install -U matplotlib

The final dependency is protocol buffers itself.

Windows - Protocol Buffers

  1. Download the appropriate precompiled version of proto from this link and unzip the folder to some location on your PC.
  2. Add the path to the folder’s bin directory to your installation’s Environmental Variables.
  3. Clone the protocol buffers repository.
  4. In the python folder
    python3 setup.py install
    

Linux - Protocol Buffers

To install protocol buffers on Ubuntu Linux:

sudo apt update
sudo apt install protobuf-compiler

Python Demos

There are a number of example python demonstrations.

The python demos have been tested on Ubuntu Linux 20.04 LTS and Windows 10.