PHD ULTRA syringe Pump integrate with Arduino - Page 1
Forum section: electronics / general

author: Zainiii
author_rank: Contributor
timestamp: July 27, 2024, 04:08:51 am
content: 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:Code: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/minpumpSerial.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/mindelay(500);pumpSerial.println("44 RUN");delay(500);// Read current flow ratepumpSerial.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

author: pcprogrammer
author_rank: Super Contributor
timestamp: July 27, 2024, 05:31:04 am
content: I'm not to familiar with Arduino and SoftwareSerial, but in the Python script the serial port is set to odd parity, two stop bits and only seven data bits.My guess is that the Arduino code uses no parity, one stop bit and eight data bits, and that this does not match with the PHD ULTRA.A simple test can be to connect your TTL-RS232 converter via an USB-TTL serial converter to your computer and use a terminal program to see which settings make it work.

author: ledtester
author_rank: Super Contributor
timestamp: July 27, 2024, 05:49:42 am
content: fwiw, the user manual may be found here:https://www.harvardapparatus.com/media/manuals/Product%20Manuals/PHD%20ULTRA%20Manual-70-3xxx_5419-002REV1.0.pdfPage 80 has instructions for setting up HyperTerminal where it says to use 8/N/ and 2 stop bits.Pages 115-116 have RS232 wiring diagrams where it suggests that 8/N/1 is a valid transmission format.Is it possible you need a 2/3 crossover cable?

author: Zainiii
author_rank: Contributor
timestamp: July 27, 2024, 08:04:45 pm
content: Dear SirThanks a lot for the reply.I have amended the program and make changes related to parity and bit wise and write it 7O2, for seven data bit, ODD parity and 2 for stop bits.I am also going to change the Arduino UNO to Arduino Mega as it support multiple serial ports.Before that, i connected a USB cable between syringe pump and Computer and run the Pump terminal program it work fine and i turn ON and OFF the syringe pumpNow you are saying, i also test by using a cable having one side USB port and option has option to connect with TTL. The USB port side i will connect with the computer and the TTL side with the TTL side of RS 232 to TTL converter module to verify either whether the RS 232 to TTL converter module transfer the signal correctly or not.I will verify using this method.Thanks for the suggestion, its highly appreciated

author: Zainiii
author_rank: Contributor
timestamp: July 27, 2024, 08:13:49 pm
content: DearThanks a lot for the reply.The Rx and Tx cable from the from the RS 232 to TTLS converter connect with the opposite cable on the syringe pumop.My whole setup has following configuration , which is attached in the picture.Can you confirm this is correct configuration or not

author: ledtester
author_rank: Super Contributor
timestamp: July 27, 2024, 09:08:53 pm
content: Looking at a closeup of this aliexpress listing:https://www.aliexpress.us/item/3256806033996899.htmland this pinout of a MAX232: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:Code:Header MAX232VCC 16 - VccRXD 12 - R1 OUTTXD 11 - T1 INSo 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.pdfUpdate: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.

author: pcprogrammer
author_rank: Super Contributor
timestamp: July 28, 2024, 06:29:48 am
content: ledtester's reply shows the correct way to approach problems like these. When in doubt get yourself the datasheets and manuals to verify on a very low level that everything is correct. Then by testing with different methods look for where the root of the problem might lie.I did not check the manual of the pump very deeply but did notice that the hyperterminal settings are indeed with 8/N/2 but at a high baudrate (115200). There is also a command that can be send over the serial port to set the baudrate. This makes me wonder if the device has a user interface with which it is possible to set the serial configuration. I suggest you read the manual that ledtester provided to see if this is true.

author: Zainiii
author_rank: Contributor
timestamp: July 29, 2024, 06:14:00 pm
content: Thank you so much for explain in the detail.I have problem in the RS 232 to TTL converter.i have verifies this thing and now shorted the wires.thanks again for the detail description