Python Guide for AMF Microfluidic Component Integration
AMF_Communication-protocole_Python-script
Jun 2025

Communicating with AMF microfluidic components using Python scripts

This technical note serves as a guide for integrating Python with AMF’s microfluidic components, focusing on using the AMFTools library for communication. The goal is to simplify the process of using Python to control and interact with AMF’s OEM components, such as the RVM rotary valve and SPM syringe pump. Whether you’re developing an experimental setup or automating processes in your lab, this guide will help you achieve precise control over microfluidic functions using Python.

Requirements

To get started, you will need:

  • Python 3.8 or higher
  • pyserial 3.4 or higher
  • ftd2xx 1.1.2 or higher
  • AMFTools Python library (pip install AMFTools)
  • AMF components (RVMFS, RVMLP, SPM, LSPone)
  • USB A to USB mini cable or a RS232/RS485 cable with a DB9 connector

Definitions

  • AMFTools: A Python library that allows users to interact with AMF microfluidic components through Python scripts. It simplifies sending commands and receiving data, providing an easy-to-use interface for microfluidic control.
  • USB: A versatile serial communication standard designed for connecting various peripheral devices to computers. It supports both data transfer and power supply, offering plug-and-play functionality and a wide range of compatible devices.
  • RS232/RS485: Serial communication standards used to transmit data between devices. RS232 is often used for point-to-point connections, whereas RS485 supports multiple devices on the same bus using differential signals, making it also suitable for long-distance communication.

Setting up communication with Python

1. Installing the AMFTools library

Install the AMFTools library using pip:

pip install AMFTools

This library will help in controlling AMF microfluidic components by providing high-level functions to send commands and retrieve responses.

2. Connecting to the device

  • Connect the appropriate communication cable (USBmini or RS232/RS485 through DB9) from the AMF component to your computer.
  • Ensure the connections are securely attached.

3. Basic Python setup for communication

1. Importing and connecting to a device

import amfTools
from amfTools import AMF, Device

# Automatically detect a connected product
device_list = amfTools.util.getProductList()
# Display basic information
for product in device_list:
print(product)
selected_device = device_list[0] # Select first available device

# Initialize the AMF product
amf = AMF(product=selected_device)

2. Setting parameters

# Set syringe size to 1000 µL
amf.setSyringeSize(1000)

# Set pump speed (unit: 10 µm/s)
amf.setSpeed(500)

#Get number of ports on your valve head
amf.getPortNumber()

3. Pump actions

# Initialization of your product
amf.home()

# Send a command to move the valve to port 2
amf.valveMoveTo(2)

# Pickup 200 µl into the syringe
amf.pumpPickupVolume(200)

# Send a command to move the valve to port 3
amf.valveMoveTo(3)

# Dispense 200 µl from the syringe
amf.pumpDispenseVolume(200)

4. Advanced functions overview

You can access full configuration and diagnostic data, including:

  • getSerialNumber(), getFirmwareVersion() or getDeviceInformation(full=True) to access all available information about your product
  • getValvePosition(), getPlungerPosition()
  • checkValveStatus(), checkPumpStatus(), getHomeStatus()
  • setMicrostepResolution(0) for 0.01 mm/step
  • home() to initialize your system

Additional commands you may be interested in :

  • setSpeedLowFlow(), setSpeedUltraLowFlow() to control with extreme precision the pump’s speed or SetFlowRate() to control your flow rate in uL/min.
  • pumpPickupVolume(), pumpDispenseVolume() to control by volume or pump(), pumpPickup(), pumpDispense() to control by the pump’s absolute position
  • hardStop(), delay(), executeLastCommand(),…

Example code

  • Retrieve data – get_all_data.py: This script is designed to make data retrieval straightforward. It connects to any AMF device (RVM, SPM, LSPOne) and collects a comprehensive set of data, including device status, valve positions, and other vital metrics. This example is ideal for monitoring and diagnostics, ensuring you have all the necessary information at your fingertips.
  • Basic functions with SPM & LSPone – pump_with_SPM.py: This example demonstrates how to control basic functions of the SPM and LSPOne devices. It includes code snippets for adjusting acceleration, deceleration, and speed, setting the syringe size, and executing core actions like pumping, dispensing, and volume control. It’s particularly useful for routine laboratory procedures, allowing for precise fluid handling.
  • Move RVM Valve – valve_move.py: This example highlights how easily you can control the valve of an AMF RVM device or the valve of an AMF SPM device. The script automatically detects connected products, connects to the RVM and performs a simple sequence of valve movements. It showcases smooth transitions between ports with built-in safety checks, making it ideal for demonstrations, testing routines, or integrating valve control into your own workflow. A perfect starting point to explore the responsiveness and reliability of AMF’s products.

Example applications

  • Fluid routing: Use Python with AMF products to develop a more advanced liquid-routing system that can be dynamically controlled via scripts. This allows integration with larger automated workflows or timed experiments.
  • Automated liquid handling: Combine valve switching and syringe control for multi-sample processing or gradient generation.
  • Timed experiment control: Use Python scripts and time.sleep() to build sequences and automate incubation or flow steps.
  • Real-time diagnostics: Monitor valve or plunger status and log real-time feedback from experiments.
  • Data logging: Automate and log responses from the SPM syringe pump using Python, making it easier to record data for precision dispensing tasks in research settings.

Conclusion

Using Python with AMF components provides flexibility and power for advanced automation and control. The AMFTools library is an effective solution to interface with microfluidic devices using common communication protocols like USB, RS232 or RS485. By integrating Python scripts, you can create customized, highly functional fluidic control systems suitable for diverse applications.

Feel free to reach out to AMF for more details on the AMFTools library, command set examples, and guidance on integrating custom workflows.

Please fill the form and one of our experts will get back to you with details.

Ready to bring your microfluidic vision to life? Fill the form:
Made in Switzerland
10+ years of experience
Short Lead Time