产品简介
Gravity 蠕动泵 V2 是一款基于 V1.0 升级而来的高可靠性液体传输模块。它在保持一代产品简单易用、Gravity 接口与舵机 PPM 信号驱动等优点的同时,进一步提升了驱动性能与结构可靠性。V2 采用 12V 供电,为长时间连续运行提供充足动力;内部传动结构由滑动结构升级为 齿轮结构,彻底解决了上一代产品在高负载情况下输出轴打滑的问题。泵管沿用耐腐蚀的 BPT 材质,可满足酸碱滴定、溶液定量分配、连续滴液等自动化实验与工业场景需求。
产品特性
- 无打滑齿轮传动:泵体内部采用齿轮结构替代滑动传动,杜绝高负载时的输出轴打滑,运行更平稳、计量更准确
- 12V 强劲动力:提供充足扭矩储备,支持长时间连续运行及高粘度液体输送
- Gravity 即插即用接口:沿用 DFRobot Gravity 标准接口,无需焊接,快速接入 Arduino、树莓派、micro:bit 等控制器
- 舵机 PPM 信号驱动:控制方式与标准舵机完全兼容(周期 20ms,脉冲宽度 0.5~2.5ms),极大降低学习成本
- 耐腐蚀 BPT 泵管:优异的耐酸碱性能,同时耐受反复挤压,延长使用寿命,适用于食品、医疗等洁净场景
- 全球通用可换插头适配器:随产品附带美标(国标)、英标、欧标三种可替换插头,适配不同地区插座,无需额外购买转换器
技术规格
| 参数 | 值 |
|---|---|
| 供电电压 | DC 12V |
| 供电接口 | DC2.1(外径 5.5mm / 内径 2.1mm) |
| 控制信号 | PPM(舵机信号,周期 20ms,高电平脉冲 0.5~2.5ms) |
| 控制接口 | Gravity 3Pin(兼容舵机线序:信号 / VCC / GND) |
| 泵管材质 | BPT(耐酸碱、耐油、耐老化) |
| 适配器输入 | 100~240V AC,50/60Hz |
| 适配器插头类型 | 美标(国标)、英标、欧标(可更换) |
引脚说明

| 引脚 | 说明 |
|---|---|
| D | 数字信号(舵机信号)输入 |
| - | 供电地 |
| + | DC3.3~5V逻辑供电 |
| DC2.1接口 | 12V直流供电 |
Arduino IDE使用教程
软硬件准备
硬件准备
| 产品名 | SKU | 数量 | 购买链接 | 描述 |
|---|---|---|---|---|
| DFRduino UNO + Gravity IO 扩展板 | DFR0216-2 | 1 | https://www.dfrobot.com.cn/goods-3709.html | 主控 |
| Gravity: 蠕动泵 V2 | DFR1261 | 1 | 驱动器 |
软件准备
- 下载Arduino IDE: 点击下载Arduino IDE
- 下载DFRobot蠕动泵V2库:DFRobot蠕动泵V2库
- Arduino IDE V1.8.19(或以下)安装库文件: 如何加载库文件
- Arduino IDE V2.0.0(或以上)可直接在库管理中搜索并安装"DFRobot_PeristalticPump_V2"库
接线图

| 蠕动泵侧 | 引脚名称 | 主控侧 | 引脚名称 |
|---|---|---|---|
| Gravity 蠕动泵V2 | - | DFRduino UNO | GND |
| Gravity 蠕动泵V2 | + | DFRduino UNO | VCC |
| Gravity 蠕动泵V2 | D | DFRduino UNO | D9 |
示例代码1-指定时间工作
指定蠕动泵工作5秒后停止
/*!
* @file setPumpRun.ino
* @brief This example drives a peristaltic pump to run.
* @copyright Copyright (c) 2026 DFRobot Co.Ltd (http://www.dfrobot.com)
* @license The MIT License (MIT)
* @author JiaLi(zhixin.liu@dfrobot.com)
* @version V1.0
* @date 2026-02-10
* @url https://github.com/DFRobot/DFRobot_PeristalticPump_V2
*/
#include "DFRobot_PeristalticPump_V2.h"
/* For continuous rotation servo:
* speed = 0 : full speed counterclockwise
* speed = 90 : stop
* speed = 180 : full speed clockwise
*/
#if defined(ESP32)
int servoPin = 17;
#else
int servoPin = 9;
#endif
DFRobot_PeristalticPump_V2 pump(servoPin);
int setPumpRunFlag = 0;
void onPumpRunDone()
{
// Task finished. This demo keeps one-shot behavior, so the flag is not reset.
// setPumpRunFlag = 0;
Serial.println(F("Pump run task finished!"));
}
void setup()
{
Serial.begin(115200);
pump.begin();
// set pump run done callback function
pump.setPumpRunDoneCallback(onPumpRunDone);
Serial.println(F("setPumpRun callback demo."));
Serial.println(F("One-shot task: run clockwise for 5000ms."));
}
void loop()
{
// Update pump status; this must be called repeatedly in loop().
pump.updatePumpStatus();
if (setPumpRunFlag == 0) {
setPumpRunFlag = 1;
// run clockwise for 5000ms
/* Note:
* 1. setPumpRun() can be called repeatedly.
* If a task is still running, this call returns false.
* After the current task finishes, it returns true and starts a new task.
* 2. The pump can be forcibly stopped at any time by calling stopPump().
*/
if (pump.setPumpRun(180, 5000)) {
Serial.println(F("Run clockwise task started!"));
} else {
Serial.println(F("The task of setting the water pump to operate failed!"));
}
}
}
结果
上传代码后,串口监视器打印如下信息。蠕动泵工作五秒后停止

示例代码2-校准蠕动泵
蠕动泵可自行校准,并将校准信息储存在主控板的EEPROM中。以便后续进行精准的定量液体输送。
如需进行校准,请提前确保管内液体充满,可先运行一段时间的示例代码1
/*!
* @file calPump.ino
* @brief Calibrate peristaltic pump flowRate and store it in EEPROM
* @copyright Copyright (c) 2026 DFRobot Co.Ltd (http://www.dfrobot.com)
* @license The MIT License (MIT)
* @author JiaLi(zhixin.liu@dfrobot.com)
* @version V1.0
* @date 2026-02-10
* @url https://github.com/DFRobot/DFRobot_PeristalticPump_V2
*/
#include "DFRobot_PeristalticPump_V2.h"
#if defined(ESP32)
int servoPin = 17;
#else
int servoPin = 9;
#endif
DFRobot_PeristalticPump_V2 pump(servoPin);
void onCalPumpEvent(eCalPumpEvent_t event, float value)
{
switch (event) {
case eCalEventWaitSetCal:
Serial.println(F("Type \"SETCAL\" to start calibration."));
break;
case eCalEventInvalidSetCal:
Serial.println(F("Invalid command. Type \"SETCAL\" to start calibration."));
break;
case eCalEventStart:
Serial.println(F("Calibration started..."));
break;
case eCalEventCountdown:
Serial.print(F("Calibration count down: "));
Serial.print((int)value);
Serial.println(F("s"));
break;
case eCalEventStop:
Serial.println(F("Calibration stop."));
break;
case eCalEventWaitVolume:
Serial.println(F("Input pumped volume (ml):"));
break;
case eCalEventInvalidVolume:
Serial.println(F("Invalid value. Please input a number > 0."));
break;
case eCalEventWriteFailed:
Serial.println(F("Write flowRate to EEPROM failed."));
break;
case eCalEventDone:
Serial.println(String(F("flowRate(ml/s): ")) + String(value, 4));
break;
default:
break;
}
}
void setup()
{
Serial.begin(115200);
pump.begin();
pump.setCalPumpEventCallback(onCalPumpEvent);
Serial.println(F("DFROBOT Peristaltic Pump - Calibration"));
Serial.println(F("Type \"SETCAL\" and send newline to start."));
}
void loop()
{
/**
* note:
* 1. Prime the tubing first: run setPumpRun.ino until the tubing is fully filled with water.
* 2. Skipping priming can lead to inaccurate calibration results.
*/
if (pump.calPump()) {
Serial.println(F("Calibration success, pump flow rate is stored in EEPROM."));
} else {
Serial.println(F("Calibration failed."));
}
while(1);
}
结果
在串口窗口中输入SETCAL启动校准。
蠕动泵将运行15秒,请确保管子内液体呈满管状态。校准请使用提供的量筒或自行准备量筒。
再次在串口窗口输入液体毫升数,输入回车后即可完成校准。

示例代码3-定量泵取液体
可设置蠕动泵定量泵取xx毫升的液体,此功能在校准后精度较高,建议校准后使用。
/*!
* @file volumePump.ino
* @brief Run the pump by fixed volume (call once)
* @copyright Copyright (c) 2026 DFRobot Co.Ltd (http://www.dfrobot.com)
* @license The MIT License (MIT)
* @author JiaLi(zhixin.liu@dfrobot.com)
* @version V1.0
* @date 2026-02-10
* @url https://github.com/DFRobot/DFRobot_PeristalticPump_V2
*/
#include "DFRobot_PeristalticPump_V2.h"
#if defined(ESP32)
int servoPin = 17;
#else
int servoPin = 9;
#endif
DFRobot_PeristalticPump_V2 pump(servoPin);
uint8_t volumePumpFlag = 1;
float runTime = 0.0f;
void onVolumePumpCallback(float volume, bool finished)
{
if (finished) {
Serial.print(F("Final volume(ml): "));
Serial.println(volume, 4);
} else {
Serial.print(F("Current volume(ml): "));
Serial.println(volume, 4);
}
}
void setup()
{
Serial.begin(115200);
pump.begin();
pump.setVolumePumpCallback(onVolumePumpCallback, 50);
Serial.println(F("volumePump demo (call once)."));
Serial.println(F("Run calPump.ino first to store flowRate in EEPROM."));
}
void loop()
{
// Update pump status; this must be called repeatedly in loop().
pump.updatePumpStatus();
/**
* Note:
* 1. Use volumePump() to run the pump for a target volume.
* 2. Parameter 1: target pumped volume in milliliters (ml).
* 3. Parameter 2: pointer to a float for the expected run time (s).
* 4. Return true: task started successfully.
* 5. Return false: start failed.
* - A task may already be running. Wait until it finishes, or call stopPump().
* - Calibration data may be invalid. Run calPump.ino to recalibrate flow rate.
*/
if (volumePumpFlag) {
volumePumpFlag = 0;
Serial.println(F("Start: volumePump 100 ml"));//此行修改100可设置串口打印的提示信息
if (pump.volumePump(100, &runTime)) {//此行修改100可设置液体泵取量,单位为毫升
Serial.print(F("Expected run time(s): "));
Serial.println(runTime, 2);
} else {
Serial.println(F("volumePump start failed."));
}
}
}
结果
蠕动泵会泵取指定含量的液体。串口监视器中打印已经泵取的液体量

示例代码4-泵取指定时间的液体
可设置蠕动泵泵取XX秒的液体,串口可输出这段时间内泵取的液体容量。此功能在校准后精度较高,建议校准后使用。
/*!
* @file timerPump.ino
* @brief Run the pump by fixed time (call once)
* @copyright Copyright (c) 2026 DFRobot Co.Ltd (http://www.dfrobot.com)
* @license The MIT License (MIT)
* @author JiaLi(zhixin.liu@dfrobot.com)
* @version V1.0
* @date 2026-02-10
* @url https://github.com/DFRobot/DFRobot_PeristalticPump_V2
*/
#include "DFRobot_PeristalticPump_V2.h"
#if defined(ESP32)
int servoPin = 17;
#else
int servoPin = 9;
#endif
DFRobot_PeristalticPump_V2 pump(servoPin);
uint8_t timePumpFlag = 1;
float volume = 0.0f;
void onTimerPumpCallback(float volume, bool finished)
{
if (finished) {
Serial.print(F("Final volume(ml): "));
Serial.println(volume, 4);
} else {
Serial.print(F("Current volume(ml): "));
Serial.println(volume, 4);
}
}
void setup()
{
Serial.begin(115200);
pump.begin();
pump.setTimerPumpCallback(onTimerPumpCallback, 50);
Serial.println(F("timerPump demo (call once)."));
Serial.println(F("Run calPump.ino first to store flowRate in EEPROM."));
}
void loop()
{
// Update pump status; this must be called repeatedly in loop().
pump.updatePumpStatus();
/**
* Note:
* 1. Use timerPump() to run the pump for a fixed duration.
* 2. Parameter 1: run time in milliseconds.
* 3. Parameter 2: pointer to a float for the precalculated pumped volume (ml).
* 4. Return true: task started successfully.
* 5. Return false: start failed.
* - A task may already be running. Wait until it finishes, or call stopPump().
* - Calibration data may be invalid. Run calPump.ino to recalibrate flow rate.
*/
if (timePumpFlag) {
timePumpFlag = 0;
Serial.println(F("Start: timerPump 5000ms"));//此处修改5000可设置串口监视器的提示信息
if (pump.timerPump(5000, &volume)) {//此处修改5000可设置泵取的指定时间,单位ms
Serial.print(F("Precalculated volume(ml): "));
Serial.println(volume, 4);
} else {
Serial.println(F("timerPump start failed."));
}
}
}
结果
蠕动泵会泵取指定时间的液体。串口监视器中打印已经泵取的液体量
