Adixen A1803H Dry Pump Arduino Uno Rs232 Address Data reading

Hi guys we are a team of students from doing our major project for the final year of our college year. So do help us if you really know what am I trying to ask.

Our project requires us to read the temperature and pressure from the Dry Pump(Adixen A1803H) via the RS232 communication port. We already brought the RS232 to TTL converter but we are unable to read any data from the pump.

From what we believed we are to extract data thru the address link to the dry pump where example: Temperature address linked to 35, 36, 37.

Please help us we are really desperate, do pardon our Arduino knowledge as we only recently picked it up.

assuming this is the pump (https://poltar.jlab.org/filedir/Manuals/Adixen%20A803h.pdf and you follow the setup steps on page 94,

Assuming the address of your pump is "000" then something like this might work:

(compiles, not tested!)

//Example code to read parameters from the dry pump Adixen A1803H
//(https://poltar.jlab.org/filedir/Manuals/Adixen%20A803h.pdf)
#include <SoftwareSerial.h>

SoftwareSerial mySerial(2, 3); // RX, TX connector to RS232-TTL converter

char STA[] = "#000STA\r"; //command to get pump status
uint8_t i = 0;

void setup()
{
  // Open serial communications and wait for port to open:
  Serial.begin(115200);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for Native USB only
  }

  Serial.println("Adixen A1803H");

  // set the data rate for the SoftwareSerial port as specified in manual
  mySerial.begin(9600);

  char SEP[] = "#000SEP044\r"; //Change the separator character between two consecutive data items in the response to ASCII decimal value 44 [comma (,)]

  i = 0;
  //output the command to change character seperator to the dry pump
  while (SEP[i++] != 0) {
    mySerial.write(SEP[i]);
  }

  //arbirtrary delay
  delay(1000);

  //clear serial input buffer
  if (mySerial.available()) {
    while (mySerial.available()) {
      char temp = mySerial.read();
    }
  }

  i = 0;
  //output command to get pump status
  while (STA[i++] != 0) {
    mySerial.write(STA[i]);
  }
}

void loop() // run over and over
{
  if (mySerial.available() > 73) { //receipt of response frame complete
    char response[80];
    i = 0;
    while (mySerial.available()) {
      response[i++] = mySerial.read();
    }

    //Returns first token
    char *token = strtok(response, ",");

    // Keep printing tokens while one of the delimiter(,) present in response[].
    while (token != NULL)
    {
      Serial.println(token);
      token = strtok(NULL, ",");
    }

    i = 0;
    //re-send command to get pump status
    while (STA[i++] != 0) {
      mySerial.write(STA[i]);
    }
  }

  //arbitrary delay
  delay(1000);

}

hope that helps....

Edit: replaced '\n' (newline) with '\r' (carriage return) as per command requirement

Hi sherzaad, you are a lifesaver. We have yet to test the codes as we only have access to the dry pump next Wednesday(15th/7). We will update you, thanks a lot!! Can't wait to test the codes!

good luck!

just a quick note though

if you look at the example in the manual on page C90 5/6,

Command #000STA
Response #000,00000,2,0080,2530,0127,1230,0000000000

the Response length is actually 43 characters (bytes) long vs the 73 characters (bytes) described in the STA response on page C90 4/6

so you may need to experiment a bit with the value to be used on this line in the code!

if(mySerial.available() > 73) <---- the response frame might well be less than that!

maybe try this code first for confirm the actual response frame length:

(compiles, not tested!)

//Example code to read parameters from the dry pump Adixen A1803H
//(https://poltar.jlab.org/filedir/Manuals/Adixen%20A803h.pdf)
#include <SoftwareSerial.h>

SoftwareSerial mySerial(2, 3); // RX, TX connector to RS232-TTL converter

char STA[] = "#000STA\r"; //command to get pump status
uint8_t i = 0;

void setup()
{
  // Open serial communications and wait for port to open:
  Serial.begin(115200);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for Native USB only
  }

  Serial.println("Adixen A1803H");

  // set the data rate for the SoftwareSerial port as specified in manual
  mySerial.begin(9600);

  char SEP[] = "#000SEP044\r"; //Change the separator character between two consecutive data items in the response to ASCII decimal value 44 [comma (,)]

  i = 0;
  //output the command to change character seperator to the dry pump
  while (SEP[i++] != 0) {
    mySerial.write(SEP[i]);
  }

  //arbirtrary delay
  delay(1000);

  //clear serial input buffer
  if (mySerial.available()) {
    while (mySerial.available()) {
      char temp = mySerial.read();
    }
  }

  i = 0;
  //output command to get pump status
  while (STA[i++] != 0) {
    mySerial.write(STA[i]);
  }

  i = 0;
}

void loop() // run over and over
{
  if (mySerial.available()) { //receipt of response frame complete
    char c = mySerial.read();
    Serial.print(c);
  }

}

hope that helps....

How big is SoftwareSerial's input buffer?

Hi, we're stuck as we used the code you provided didn't give us the reading we wanted.
I hope anyone that read this and understands will help us. our dateline is coming soon.

Hi @AWOL where can we find the software buffer?

shawnjoshua:
Hi @AWOL where can we find the software buffer?

As @AWOL rightly pointed out, the softwareSerial buffer is small (default is 64 characters last I checked). This can be easily increased though...

However IMHO this is not the issue at hand as it seems that you are NOT receiving ANY kind of response from your pump. Had it responded correctly with the current code (assuming you tried the code in rely #3) some data might have been missing/lost due to the buffer size but you would still have got some of the information

Are you sure you are the pump address is 000?

Did you correctly wire the RX and TX pins to the RS232 converter? did you try swapping the wires?

Have you tried communicating with it using something like Teraterm or Putty? did it respond then?

Hi Sherzaad, thank you for providing us the codes. we somehow managed to extract data. But we hit a set back where we are receiving the data in one entire line. We tried printing the results where we wanted for example "pressure" is "17-20" and "temperature" is "27-29". But failed doing so
We really appreciate all the help that you are doing. Any tips on doing that?
We project also aims to transfer the data onto thingspeak.iot where we can observe data remotely. We got an ESP01 module as well as a NodeMCU. Any idea on how can we patch it up and code it so everything can run smoothly?

shawnjoshua:
Hi Sherzaad, thank you for providing us the codes. we somehow managed to extract data. But we hit a set back where we are receiving the data in one entire line. We tried printing the results where we wanted for example "pressure" is "17-20" and "temperature" is "27-29". But failed doing so
We really appreciate all the help that you are doing. Any tips on doing that?
We project also aims to transfer the data onto thingspeak.iot where we can observe data remotely. We got an ESP01 module as well as a NodeMCU. Any idea on how can we patch it up and code it so everything can run smoothly?

Glad to hear you managed to get it working! :wink:

looks like you made some changes to the code that I posted... Would you care to share the code you are ACTUALLY using?

Hey this is the code we are using as you can see we tried to print out just the Pressure and Temperature, but apparently we can't do it

//Example code to read parameters from the dry pump Adixen A1803H
//(https://poltar.jlab.org/filedir/Manuals/Adixen%20A803h.pdf)
#include <SoftwareSerial.h>

SoftwareSerial mySerial(2, 3); // RX, TX connector to RS232-TTL converter

char STA[] = " #000STA44\r"; //command to get pump status
char Din[43];
char c;
uint8_t i = 0;
int r = 1;
int j = 1;//
void setup()
{
// Open serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for Native USB only
}

Serial.println("Adixen A1803H");

// set the data rate for the SoftwareSerial port as specified in manual
mySerial.begin(9600);

char SEP[] = "#000SEP044\r"; //Change the separator character between two consecutive data items in the response to ASCII decimal value 44 [comma (,)]

i = 0;
//output the command to change character seperator to the dry pump
while (SEP[i++] != 0) {
mySerial.write(SEP*);*

  • }*
  • //arbirtrary delay*
  • delay(1000);*
  • //clear serial input buffer*
  • if (mySerial.available()) {*
  • while (mySerial.available()) {*
  • char temp = mySerial.read();*
  • }*
  • }*
  • i = 0;*
  • Serial.print("Sending command");*
  • Serial.println();*
  • //output command to get pump status*
  • while (STA[i++] != 0) {*
    _ mySerial.write(STA*);_
    _ Serial.println(STA);
    }
    i = 0;
    }
    void loop() // run over and over
    {
    // delay read one at a time*
    * if (mySerial.available()) { //receipt of response frame complete*
    * c = mySerial.read();
    Serial.print(c);// this one actually no need. for bebugging purpose*
    * delay(500);
    }
    if (j <= 44) {
    c = Din;
    j = j + 1;
    }
    else if (j > 44) {
    Serial.print(" The Pressure of the pump is: ");
    Serial.print(Din[17]);
    Serial.print(Din[18]);
    Serial.print(Din[19]);
    Serial.print(Din[20]);
    Serial.println(" mbar");
    Serial.print(" The temperature of the pump is: ");
    Serial.print(Din[35]);
    Serial.print(Din[36]);
    Serial.print(Din[37]);
    Serial.print(" Degrees C");
    delay(2000);
    }
    else if (j == 46) {
    j = 1;
    }
    }*_

...and that's why we have code tags.

in you r code:

  if (j <= 44) {
    c = Din[i];
    j = j + 1;
  }

should be IMHO

  if (j <= 44) {
    Din[j] = c;
    j = j + 1;
  }

also increase char Din[43]; to at least char Din[45];

and why are you initialising/re-initialising 'j' to 1!? surely it should j=0...

hope that helps...