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]
Looking at a closeup of this aliexpress listing:
https://www.aliexpress.us/item/3256806033996899.html (https://www.aliexpress.us/item/3256806033996899.html)
and this pinout of a MAX232:
https://microcontrollerslab.com/max232-ic-pinout-features-pins-description-example/ (https://microcontrollerslab.com/max232-ic-pinout-features-pins-description-example/)
here is how the header pins of the TTL serial module are connected to the MAX232:
Header MAX232
VCC 16 - Vcc
RXD 12 - R1 OUT
TXD 11 - T1 IN
So you want the Arduino TX pin to connect to the TXD of the serial module and the Arduino RX pin to connect to the RXD of the serial module.
See also the attached pic of Table 4-1 from the TI MAX232 datasheet:
https://www.ti.com/lit/ds/symlink/max232.pdf (https://www.ti.com/lit/ds/symlink/max232.pdf)
Update: Just notice that the pin function table in the TI datasheet is missing the entry for pin 12 R1OUT so I've included a pic from the Maxim datasheet.