I have a PHD ULTRA syringe pump from Harvard Apparatus. I want to establish communication between an Arduino and the syringe pump. The company provided me with a Python code, but Arduino does not support Python. Therefore, I converted this code to C++ to make it compatible with the Arduino. I am using an RS-232 to TTL converter between the Arduino and the syringe pump.
However, when I attempted to use this code to establish communication, I encountered issues. Could someone please help me amend this code if there are any errors? I have attached a diagram of my setup and will also attach the Python code provided by the company.
Note: The syringe pump successfully responds and turns ON and OFF when using the pump terminal software provided by the company.
The C++ Code is:
include <SoftwareSerial.h>
SoftwareSerial pumpSerial(2, 3);
void setup()
{
Serial.begin(9600);
pumpSerial.begin(9600);
delay(1000);
configurePump();
}
void loop()
{
// Set flow rate to 1 µL/min
pumpSerial.println("44 RAT I 1 UM"); // 44 used: beacuse Address on syringe pump i adjusted to 44,UM used: because i usd the flow rate uL/min
delay(500);
pumpSerial.println("44 RUN");
delay(500);
// Read current flow rate
pumpSerial.println("44 RAT");
delay(500);
while (pumpSerial.available())
{
Serial.write(pumpSerial.read());
}
delay(5000);
}
void configurePump()
{
pumpSerial.println("44 MOD INF");
delay(500);
}
The python code that the company provide and the the prototype of the setup is attached in the picture
[/img]