An open-source, Python3-based GUI to control stepping motor-driven syringe pumps with G-codes.
SyringeGUI (latest version: 2.4.1) and its config-generator (latest version: 1), to control DIY syringe pumps (max. 3 pumps) connected to an Arduino device.SyringeGUI and config-generator are free software, released under the MIT license.config-generator might also be helpful for CNC users to determine Steps/mm values for the machine..app / .exe) are available from releases.
stepping motors (bipolar/4-wire) and an actuator such as lead screws and tables/sliders.Arduino Uno/Nano and stepping motor drivers (as many as needed) like DRV8825, A4988, etc.CNC shield v3.0 for Arduino Uno or CNC shield v4.0 for Arduino NanoAC-to-DC converter (12 V, at least 3 A for 2 pumps).Any computer that can run Python 3.10 or higher (Mac, Win, Linux, or Raspberry Pi).You can find many great instructions on making DIY syringe pumps. To start this project, I was highly impressed and inspired by the “poseidon” system.
Note: In this project, the mechanical syringe pump parts were obtained from a Chinese company.
The details are well described in poseindon system. Here I just tell you techinical tips to adjust the Vref (reference voltage), which determines the maximum current flowing to the motor, for stepping motor drivers, such as DRV8825 and A4988. Proper adjustment is critical to maximize motor performance while avoiding the overheating of the motors and drivers.
For this process, you will need a multimeter (electrical tester) to check the voltage.
The following site could help you to calculate and set Vref.
https://www.circuitist.com/how-to-set-driver-current-a4988-drv8825-tmc2208-tmc2209/
Vref = Imax × Rs × C × RF
- Imax: Rated current of the motor
- Rs: Sense resistor value (DRV8825:
0.1 Ω, A4988:0.05-0.1 Ω)- C: Coefficient specific to drivers (DRV8825:
5, A4988:8)- RF: Reducing factor to keep the circuit safe (typically
0.8-0.9)
To find the rated current, check the datasheet of your stepping motor. It is typically 0.8 - 2.0 A for NEMA17 stepping motors, which are commonly used in DIY syringe pumps. If you do not know the specifications of your motor, start with 0.8 A as Imax for safety. For the DRV8825, a Vref value around 0.5 V is usually optimal for controlling standard NEMA17 motors.
Before running the SyringeGUI software, you need to flash your Arduino with a sketch that includes the script to control stepping motors via the GRBL library.
Steps (Verified on Arduino IDE 2.3.8 for macOS):
grbl folder, zip only this internal folder again.Sketch -> Include Library -> Add .ZIP Library...grbl file you just created.File tab -> Examples -> grbl (usually found at the bottom) -> grblUpload.Tools tab -> Board: -> Select Arduino Uno or Nano.Tools tab -> Port: -> Select the USB serial port connected to the Arduino./dev/cu.usbserial-XXXX or /dev/cu.usbmodem-XXXX on Mac; COMx on Windows)Processor:.→).
This project consists of two main tools:
SyringeGUI: The main controller application for the syringe pumps.config-generator: An utility to create and manage the config.json file for mechanical setups and syringe types.Prerequisites
pip (Python package installer).
This GUI is built using Python’s standard tkinter library and pyserial.
Alternatively, standalone pre-compiled packages (.app for Mac / .exe for Windows) are available. Since they are compiled with PyInstaller, Python 3 and its libraries are not required to run them. Please download from releases.
Open your terminal (Command Prompt/PowerShell for Windows) and follow these steps:
bash
git clone https://github.com/hiro-shikata/SyringeGUI.git
cd SyringeGUI
pip3 install --upgrade pip
If you have not installed Python3, please download and install it from python.org
pip install pyserial
Important Note for Linux & Raspberry Pi OS:
Tkinter is often not included by default in Linux distributions.
Please run:
sudo apt update
sudo apt install python3-pip
pip3 install pyserial
If you encounter issues installing pyserial, it is recommended to install it within a virtual environment (venv):
python3 -m venv venv
source venv/bin/activate
pip install pyserial
🍎 macOS
Miniconda/Anaconda Users: If you encounter errors like _tkinter not found, ensure you are using the base environment or have installed tk via conda (conda install tk).
Security: You may need to grant “Input Monitoring” or “Serial Port” access depending on your macOS version.
💻 Windows
Port Discovery: Look for COM ports (e.g., COM3) in the Device Manager.
Python Path: Ensure “Add Python to PATH” was checked during installation.
🍓 Raspberry Pi OS / Linux
Permissions: You might need permission to access the serial port. Add your user to the dialout group:
Bash
sudo usermod -a -G dialout $USER
(Please Log out and log back in for changes to take effect.)
CPU Load: On older Raspberry Pi models, high-frequency GUI updates might cause slight lag.
If you use venv to install pyserial, you need to activate venv before running SyringeGUI.py.
Bash
source /home/USER/venv/bin/activate # Replace USER with your USER directory
python3 /home/PATH/SyringeGUI_raspi.py # Replace PATH with your path to locate the `SyringeGUI`
Alternatively, you can use Desktop Entry as a shootcut to run SyringeGUI without operating Terminal. Please replace PATH on the distributed SyringeGUI.desktop file with your correct path. Then, please place the file on your desktop or somewhere and just click it.
The code for Raspberry Pi OS is distributed as Syringe_GUI_raspi.py in rasp folder. That GUI appearance is optimized when Raspberry Pi 7-inch Touch Screen Display or its alternatives are used.
Run the config-generator app to define your pump’s mechanical settings (Steps/mm, Max Rate, etc.). While you can modify these settings via the Arduino IDE, using this interactive app is much easier.
Bash
python3 --version # Check the installed Python 3 version
python3.XX config-generator_v1.py # Replace XX with your actual version (e.g., python3.10)
Steps/mm value, which is the most crucial setting for this system.
1.8°.1/32 microstepping.
1 in this box. If your specific hardware setup includes a gear assembly between the motor and the lead screw, please specify that precise ratio.
Max rate (mm/min), Accel (mm/sec²), and Max Travel Distance (mm) according to the on-screen instructions.Name, Volume (mL), and Length (mm) for each syringe.
Tip for Accuracy: For the highest precision, it is highly recommended to calibrate this value by measuring the weight of the dispensed water using a precision weighing scale (mass-to-volume calibration).
Generate New Config File to save your settings. Save the generated file as XXX.json (replace XXX with your desired configuration name) into the directory ~/SyringeGUI_Data/CONFIG.onfig.json first.
⚠️ Setting Notes
Rate Limitation: For Arduino Uno/Nano based setups, ensure your Max Rate does not exceed the theoretical limit calculated in the config-generator_v1. Exceeding a 20kHz pulse frequency may cause the stepper motor to stall or behave unpredictably.
Invert Direction: Check this setting in the config-generator_v1 if your pump moves in the opposite direction than expected.
Bash
python3.XX SyringeGUI.py
Settings tab./dev/cu.usbserial-XXXX / /dev/cu.usbmodem-XXXX on Mac, COMx on Windows, /dev/ttyACM0 on Raspberry Pi).Connect button.Log window on the Manual tab.Current Configuration in the Settings tab. By default, the internal default settings are applied.Load Different Config JSON.~/SyringeGUI_Data/CONFIG and choose your generated JSON file.Sync to Grbl EEPROM.Manual tab.By default, the path ~/SyringeGUI_Data/ is selected as the default save directory. You can change this destination folder at any time by clicking Select Directory.
Once you select a new directory, CSV files for experimental settings will be generated there immediately. To apply the new path to the main system log file, you will need to restart SyringeGUI.
photo
Manually control your syringe pumps using the following features:
Choose Pumps:
Checkboxes are located at the top of the three columns named Pump X, Y, and Z. Checking them activates the respective pump for operation.
Select Syringe:
Select your syringe type from the populated combobox list.
Flow: Input the desired flow rate speed to inject or draw. Entering a negative value will move the pump in the opposite direction. Changing the unit automatically recalculates the flow rate value.
Duration:
Defines the total operating run time for the pump.
Max Vol.: Specifies the maximum volume capacity the syringe can handle. If your syringe is partially filled, set that specific limit here. If the calculated volume (Flow × Duration) exceeds the Max Vol, the app will block the pump execution for safety.
RUN/STOP X, Y, Z:
Runs each pump individually. Note: If at least one pump is already running, you cannot start another individual pump. This is a technical hardware limitation of the current GRBL setup.
RUN/STOP ALL:
Runs all activated pumps simultaneously using their respective individual settings.
Reset Position:
Displays the current real-time position and volume for each pump. These values initialize to 0 when the app starts. It is good practice to click RESET POSITION before starting a new experiment.
Jog:
Provides manual jog controls for fine adjustments. Adjust the rate using the slider bar or input a precise numerical value. Maximum and minimum jog rates are automatically bounded.
Log & Command window:
Displays real-time serial communication between the app and the Arduino. You can also manually input GRBL-supported hex commands (e.g., enter $$ to view the active GRBL core settings).
Execute sequential, complex automated profiles using this tab. You can load a custom CSV file to specify your sequence recipes.
The configuration CSV file must follow this exact format:
Pump, Start time (s), End time (s), Flow (µm/min)
Example recipe:
X, 0, 60, 100
X, 60, 120, 200
Y, 0, 120, 100
Z, 90, 120, 50
Note: Only commas (,) must be used as delimiters to separate values in the CSV file.
Note: There is no restriction on the number of sequence rows.
Note: Only the specific pumps declared in the CSV recipe will engage in motion.

How it executes:
To achieve maximum pumping accuracy, performing a physical calibration is highly recommended. Use the following procedure:
Reset Position in the UI.RUN or Jog controls. Physical Distance Travelled: A mmDisplayed Position: X mmRemaining Distance: B mmCalibrated Steps/mm = Current Steps/mm × (X / |A - B|)Config-Generator utility, open your JSON config file, and update the Steps/mm field with this new calibrated value.Sync to Grbl EEPROM to commit the change to your hardware.
In this case, current Steps/mm value was 6500. Calibrated value = 6500 x (100 / |14.20 - 115.75|) = 6400.8 Steps/mm
This project was supported by the grants from the Japan Society for the Promotion of Science (Grant# JP24H01499) and the Kato Memorial Bioscience Foundation.