Arduino: send commands to a pump through UART 4 pins

Hi!

I have a syringe pump with a controller, and it should be possible based on the instruction manual to communicate the controller directly through UART (4 pins), sending commands like "q1h1d".

I've been searching quite a lot but couldn't find something very usefulll to me!

  1. I would like first to test this possibility independently from Arduino, using a UART USB cable and maybe a software like puTTY. Maybe does someone have a better idea?

  2. Using Arduino (or Matlab) would be ideal, but I don't even really understand even how to wire it. If someone would have some hints for a completely newby in this UART / data packets exchange story, this would be great!

Cheers

Sebastien

Exactly what sort of interface does the pump have ?

In the manual is there any mention of RS232 or any other kind of interface specification ?

Can you post a link to the device and/or the instruction manual ?

HI!

This is the device: 1 150ML Labor Micro Spritze Pumpe Desktop Präzision Elektrische Injektion Pumpe Propel Pumpe Flüssigkeit Kleber Dispenser DC 12V NEUE| | - AliExpress

There is only one page in the chinese manual, stating following:
"support the USB communication and serial UART communication, and can drive the host computer following UART to RS232 and CAN bus. It can be directly driven by the computer".

The rest are the commands to be sent to execute some actions like "q6h1d" for "save parameters" etc, which would be otherwise done by pushing the buttons of the controllers.

Hope this helps to understand the situation better :slight_smile:

Cheers

Seb

do you have a link to the technical documentation?

if there is an UART interface, you need to know the configuration (baud rate, stop bits, etc) and of course the command format and response if any (the communication protocol)

It looks like the device has an RS232 Serial interface. If so, then it is not directly compatible with the output from an Arduino and you will need a TTL to RS232 converter between the two of them

This is the only thing I have!

Would a TTL to USB work as well to communicate with my laptop?
RPI USB TTL: Raspberry Pi - USB to TTL, 0.9 m, PL2303HX at reichelt elektronik

It might do as the scant "instructions" mention a USB interface but without more details, who knows ?

OK, otherwise I could do TTL to RS232 + RS232 to USB? (sorry, this is really a domain where I start from scratch and have really no clue)

Why complicate things even more by doing 2 conversions ?

that's already a good start.... we don't know exactly the interface if it's 5V UART...

if you are bold enough to give it a try, possibly with a suitable adapter on pin 2 and 3, I would try simple code like this that issues those 3 commands with a trailing CR/LF (which might not be needed or will confuse the module, in which case try with print() instead of println())

image

/*
   RX is digital pin 2 (connect to TX of other device)
   TX is digital pin 3 (connect to RX of other device)
   GND are connected
*/
#include <SoftwareSerial.h>
SoftwareSerial syringe(2, 3); // RX, TX
const char * manualFwd  = "q6h4d";
const char * manualBwd  = "q6h5d";
const char * manualStop = "q6h6d";

void setup()
{
  Serial.begin(115200);
  syringe.begin(9600);
  delay(2000); // wait a bit in case system needs to settle

  // go forward for 1s
  syringe.println(manualFwd);
  delay(1000);

  // stop
  syringe.println(manualStop);
  delay(1000);

  // go backward for 1s
  syringe.println(manualBwd);
  delay(1000);

  // stop
  syringe.println(manualStop);
}

void loop() {
  // print anything at we get back
  if (syringe.available()) {
    int c = syringe.read();
    if (isprint(c)) Serial.write(c);
    else  {
      switch (c) {
        case '\r': Serial.print(F("<CR>")); break;
        case '\n': Serial.print(F("<LF>")); break;
        case '\t': Serial.print(F("<TAB>")); break;
        default:
          Serial.print(F("0x"));
          if (c < 0x10) Serial.write('0');
          Serial.print(c, HEX);
      }
    }
    Serial.write(' ');
  }
}

if that works then you can explore the other commands

I was just thinking to the pure physical connection, if for some reasons a direct connection to USB wouldn't be feasible... :smiley:

Thanks a lot! Before I try, just to be sure for the wiring:
On the left the connection to the pump itself
On the right, the communication port where I installed some cables


So I suppose:
Controller"T" (Black/see picture)=>ArduinoGND
Controller"R" (Green/see picture)=>ArduinoTX (or RX?)
Controller"G" (Blue/see picture)=>ArduinoRX (or TX?)
Controller"V" (Blue/see picture)=>Arduino+5V

Interverting TX and RX would not be such an issue I imagine, just wouldn't work?

Kind Regards

Sebastien

I would read more T as in Transmit, R as in Receive, G as in GND and V as in Voltage

that's a shot in the dark....

Makes absolutely sense, I'll try like that... suspense

hopefully it won't be +12V and -12V or something like this on the Tx and Rx....

It's working !!!
I don't get why it's PIN 2 and 3 and not 0 and 1 from the Arduino, but this is another story!

Thanks a lot, I wouldn't have expected this to be solved so straight forward!

My first choice would also be trying to talk to it over puTTY or another serial terminal.
BTW: there is also this project on github for DIY infusion pump using arduino & the CNC shield that works pretty well. It includes CAD files for 3D printing a holder for the stepper motors and syringes. Haven't used it personally, but I'm working with someone who does.

[edit]
I guess a lot happened in the last few hours before I finished my reponse :slight_smile:

cool

pins 0 and 1 are what's connected to the USB and your serial monitor to see what's going on as well as uploading code. (it's Serial basically - you don't want to mess with it until your code is rock solid and you don't need to upload anymore)

so you needed a second serial port and the UNO does not have hardware one. So using SoftwareSerial we created a "fake" one on pins 2 and 3 which we use to discuss with the syringe

Thanks a lot, I might need to have an easy way to test such communication through UART; You hence recommand puttY as well?

BR

Sebastien