Author Topic: PHD ULTRA syringe Pump integrate with Arduino  (Read 985 times)

0 Members and 1 Guest are viewing this topic.

Offline ZainiiiTopic starter

  • Contributor
  • Posts: 15
  • Country: us
PHD ULTRA syringe Pump integrate with Arduino
« on: July 27, 2024, 04:08:51 am »
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: [Select]
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]
 

Offline pcprogrammer

  • Super Contributor
  • ***
  • Posts: 4174
  • Country: nl
Re: PHD ULTRA syringe Pump integrate with Arduino
« Reply #1 on: July 27, 2024, 05:31:04 am »
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.

Online ledtester

  • Super Contributor
  • ***
  • Posts: 3189
  • Country: us
Re: PHD ULTRA syringe Pump integrate with Arduino
« Reply #2 on: July 27, 2024, 05:49:42 am »
fwiw, the user manual may be found here:

https://www.harvardapparatus.com/media/manuals/Product%20Manuals/PHD%20ULTRA%20Manual-70-3xxx_5419-002REV1.0.pdf

Page 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?
« Last Edit: July 27, 2024, 06:05:52 am by ledtester »
 

Offline ZainiiiTopic starter

  • Contributor
  • Posts: 15
  • Country: us
Re: PHD ULTRA syringe Pump integrate with Arduino
« Reply #3 on: July 27, 2024, 08:04:45 pm »
Dear Sir
Thanks 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 pump
Now 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
 

Offline ZainiiiTopic starter

  • Contributor
  • Posts: 15
  • Country: us
Re: PHD ULTRA syringe Pump integrate with Arduino
« Reply #4 on: July 27, 2024, 08:13:49 pm »
Dear
Thanks 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
 

Online ledtester

  • Super Contributor
  • ***
  • Posts: 3189
  • Country: us
Re: PHD ULTRA syringe Pump integrate with Arduino
« Reply #5 on: July 27, 2024, 09:08:53 pm »
Looking at a closeup of this aliexpress listing:

https://www.aliexpress.us/item/3256806033996899.html

and 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: [Select]
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

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.
« Last Edit: July 27, 2024, 09:43:24 pm by ledtester »
 

Offline pcprogrammer

  • Super Contributor
  • ***
  • Posts: 4174
  • Country: nl
Re: PHD ULTRA syringe Pump integrate with Arduino
« Reply #6 on: July 28, 2024, 06:29:48 am »
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.

Offline ZainiiiTopic starter

  • Contributor
  • Posts: 15
  • Country: us
Re: PHD ULTRA syringe Pump integrate with Arduino
« Reply #7 on: July 29, 2024, 06:14:00 pm »
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
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf