Re: Adixen A1803H Dry Pump Arduino Uno Rs232 Address Data reading

continuation of first topic started here:

[quote author=nnaasshh ]Mon Nov 23 2020 08:31:34 GMT+0000 (Greenwich Mean Time)

Hi Sherzaad,

I saw the Arduino forum on Adixen A1803H Vacuum Pump using RS232.

I was wondering if you know how to extract the temperature and pressure reading on vacuum pump to Arduino serial monitor? extract the temperature address linked of 35-37 and pressure of 17-20. If you do have information on how to show the temperature and pressure readings to serial monitor, I would be more than happy if you could help. Using the serial print below to record temp and pressure does not work.

Vacuum Pump Manual

This is the code from arduino forum.
#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[45];
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”);

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

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); // for bebugging purpose
delay(500);
}

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

else if (j > 44) {
Serial.print(" Pressure recorded of the vacuum pump is: “);
Serial.print(Din[17]);
Serial.print(Din[18]);
Serial.print(Din[19]);
Serial.print(Din[20]);
Serial.println(” mbar");
Serial.print(" Temperature recorded of the vacuum 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 = 0;
}

}

[/quote]

Try something like this:
(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
const byte numChars = 100;
char receivedChars[numChars];

boolean newData = false;

void getPumpStatus() {
  char STA[] = "#000STA\r"; //command to get pump status,"#000STA44\r"
  char i = 0;

  while (STA[i] != 0) {
    Serial.print(STA[i]); //for debugging purposes
    mySerial.write(STA[i++]);
  }
  Serial.println(""); //for debugging purposes

}

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

  while (SEP[i] != 0) {
    Serial.print(SEP[i]); //for debugging purposes
    mySerial.write(SEP[i++]);
  }
  Serial.println(""); //for debugging purposes

}

void recvData() {
  static boolean recvInProgress = false;
  static byte ndx = 0;
  char startMarker = '#'; //header character
  char endMarker = '\r'; // <CR>, end character
  char rc;

  if (mySerial.available() > 0 && newData == false) {
    rc = mySerial.read();

    if (recvInProgress == true) {
      if (rc != endMarker) {
        receivedChars[ndx] = rc;
        ndx++;
        if (ndx >= numChars) {
          ndx = numChars - 1;
        }
      }
      else {
        receivedChars[ndx] = '\0'; // terminate the string
        recvInProgress = false;
        ndx = 0;
        newData = true;
      }
    }

    else if (rc == startMarker) {
      recvInProgress = true;
    }
  }
}

void parseNewData() {
  const char *dataframe[11] = {"Address: ", "Pump Status: ", "Pressure(mBar): ", "Power(W): ", "FB Temp(degC): ", "Unused: ", "LP Temp(degC): ", "Analog Input(mV):", "MPS: ", "Fault Status: ", "N2 Purging (s): "};
  const char delim[] = " ,";
  char *token, i = 0;

  if (newData == true) {
    /* get the first token */
    token = strtok(receivedChars, delim);

    /* walk through other tokens */
    while ( token != NULL ) {
      if (i < 11)Serial.print(dataframe[i++]);
      Serial.println(token);

      token = strtok(NULL, delim);
    }
    //newData = false; //required if variable is not set to 'false' outside of function 
  }
}


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

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

  modSeperator(); //send command to modify seperator character
  
  //arbirtrary delay
  delay(1000);

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

  Serial.println("Adixen A1803H");
  Serial.print("Requesting pump status...");
  getPumpStatus(); //send command to request pump status

}

void loop() // run over and over
{
  recvData();
  parseNewData();

  //data was received and processed
  if (newData == true) {
    getPumpStatus(); //new pump status request
    newData = false;
    delay(5000); //arbitrary delay for requesting periodicaly
  }
}

Screenshot 2020-12-02 105602.png

Hello nnaasshh,
I'm glad to hear the code I provided worked! :sunglasses:

Extract from the manual regarding the status data string:

The example I provided simply split the received datastring and printed it out.

If you want to further use the data outside of the routine, you could save it to another array to then be able to use it.

something like this maybe:
(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
const byte numChars = 100;
char receivedChars[numChars];
char i, *splitdata[11];

boolean newData = false;

void getPumpStatus() {
  char STA[] = "#000STA\r"; //command to get pump status,"#000STA44\r"
  char c = 0;

  while (STA[c] != 0) {
    Serial.print(STA[c]); //for debugging purposes
    mySerial.write(STA[c++]);
  }
  Serial.println(""); //for debugging purposes

}

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

  while (SEP[c] != 0) {
    Serial.print(SEP[c]); //for debugging purposes
    mySerial.write(SEP[c++]);
  }
  Serial.println(""); //for debugging purposes

}

void recvData() {
  static boolean recvInProgress = false;
  static byte ndx = 0;
  char startMarker = '#'; //header character
  char endMarker = '\r'; // <CR>, end character
  char rc;

  if (mySerial.available() > 0 && newData == false) {
    rc = mySerial.read();

    if (recvInProgress == true) {
      if (rc != endMarker) {
        receivedChars[ndx] = rc;
        ndx++;
        if (ndx >= numChars) {
          ndx = numChars - 1;
        }
      }
      else {
        receivedChars[ndx] = '\0'; // terminate the string
        recvInProgress = false;
        ndx = 0;
        newData = true;
      }
    }

    else if (rc == startMarker) {
      recvInProgress = true;
    }
  }
}

void parseNewData() {
  const char *dataframe[11] = {"Address: ", "Pump Status: ", "Pressure(mBar): ", "Power(W): ", "FB Temp(degC): ", "Unused: ", "LP Temp(degC): ", "Analog Input(mV):", "MPS: ", "Fault Status: ", "N2 Purging (s): "};
  const char delim[] = " ,";
  char *token;

  i = 0;

  if (newData == true) {
    /* get the first token */
    token = strtok(receivedChars, delim);

    /* walk through other tokens */
    while ( token != NULL ) {
      if (i < 11) {
        Serial.print(dataframe[i]);
        splitdata[i] = token; //store token to array for later use
        ++i;
      }
      Serial.println(token);

      token = strtok(NULL, delim);
    }
    //newData = false; //required if variable is not set to 'false' outside of function
  }
}


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

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

  modSeperator(); //send command to modify seperator character

  //arbirtrary delay
  delay(1000);

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

  Serial.println("Adixen A1803H");
  Serial.println("Requesting pump status...");
  getPumpStatus(); //send command to request pump status

}

void loop() // run over and over
{
  recvData();
  parseNewData();

  /*
    i=0 -> Address
    i=1 -> Pump Status
    i=2 -> Pressure(mBar)
    i=3 -> Power(W)
    i=4 -> FB Temp(degC)
    i=5 -> Unused
    i=6 -> LP Temp(degC)
    i=7 -> Analog Input(mV)
    i=8 -> MPS
    i=9 -> Fault Status
    i=10 -> N2 Purging (s)
  */

  if (i > 6) {
    Serial.print("The temperature of the vacuum pump is LP Temp(degC): ");
    Serial.println(splitdata[6]);
  }

  if (i > 2) {
    Serial.print("The pressure of the vacuum pump is(mBar): ");
    Serial.println(splitdata[2]);
  }

  //data was received and processed
  if (newData == true) {
    newData = false;
    getPumpStatus(); //new pump status request
    delay(5000); //arbitrary delay for requesting periodicaly
  }
}

hope that helps....

Hi Sherzaad, I am able to print out the temperature and pressure, thanks to you!! 8) However, in the void loop, using the "if" function, both temp & pressure conditions are met causing it to only print out once in OP of serial monitor. I would like it to print both temperature and pressure for every 5 seconds in the serial monitor. I tried adding loop() and delay(5000); however, I learnt that it is called recursion and unable to loop a loop. (sorry for my lack of knowledge in Arduino, just started learning since October)
An advice I get from the forum is that, to set a timer instead of using a delay. I have added the timer code (every 5sec) and unsure if it is correct, please advice me if the edited codes are wrong. Thanks in advance!!!

#include <SoftwareSerial.h>

SoftwareSerial mySerial(2, 3);                             // RX, TX connector to RS232-TTL converter
const byte numChars = 100;
char receivedChars[numChars];                              // store and receive the data 
char i, *splitdata[11];                                     
unsigned long currentMillis; 

boolean newData = false;

void getPumpStatus() {
  char STA[] = "#000STA\r";                                //command to get pump status,"#000STA44\r"
  char c = 0;

  while (STA[c] != 0) {
    Serial.print(STA[c]); 
    mySerial.write(STA[c++]);
  }
  Serial.println(""); 

}

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

  while (SEP[c] != 0) {
    Serial.print(SEP[c]); 
    mySerial.write(SEP[c++]);
  }
  Serial.println("");

}

void recvData() {
  static boolean recvInProgress = false;
  static byte ndx = 0;
  char startMarker = '#';                                      //header character
  char endMarker = '\r';                                       // <CR>, end character
  char rc; 

  if (mySerial.available() > 0 && newData == false) {
    rc = mySerial.read();

    if (recvInProgress == true) {
      if (rc != endMarker) {
        receivedChars[ndx] = rc;
        ndx++;
        if (ndx >= numChars) {
          ndx = numChars - 1;
        }
      }
      else {
        receivedChars[ndx] = '\0';                             // terminate the string
        recvInProgress = false;
        ndx = 0;
        newData = true;
      }
    }

    else if (rc == startMarker) {
      recvInProgress = true;
    }
  }
}

void parseNewData() {
  const char *dataframe[11] = {"Address: ", "Pump Status: ", "Pressure(mBar): ", "Power(W): ", "FB Temp(degC): ", "Unused: ", "LP Temp(degC): ", "Analog Input(mV):", "MPS: ", "Fault Status: ", "N2 Purging (s): "};
  const char delim[] = " ,";
  char *token;

  i = 0;

  if (newData == true) {
    /* get the first token */
    token = strtok(receivedChars, delim);

    /* walk through other tokens */
    while ( token != NULL ) {
      if (i < 11) {
        Serial.print(dataframe[i]);
        splitdata[i] = token;                           //store token to array for later use
        ++i;
      }
      Serial.println(token);

      token = strtok(NULL, delim);
    }
    //newData = false;                                   //required if variable is not set to 'false' outside of function
  }
}


void setup()
{
  // Open serial communications and wait for port to open:
  Serial.begin(9600);
  while (!Serial);       

  mySerial.begin(9600);                                  // set the baud rate to 9600 @ manual Adixen A1803H

  modSeperator();                                        //send command to modify seperator character
  delay(5000); 

  //arbirtrary delay
  delay(1000);

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

  Serial.println("Adixen A1803H");
  Serial.println("Requesting pump status...");
  getPumpStatus();                                         //send command to request pump status for STA to get the data 

}

void loop() // run over and over
{ 
  recvData();
  parseNewData();

  uint32_t myTimer = 0 ;
  if ( millis() - myTimer > 5000 ) {            // 5 seconds
    myTimer = millis() ;                        // write to Serial
}
  
  if (i > 6) {
    Serial.print("The temperature of the vacuum pump is LP Temp(degC): "); Serial.print(" degC");
    Serial.println(splitdata[6]);
  }

  if (i > 2) {
    Serial.print("The pressure of the vacuum pump is Pressure(mBar): "); Serial.println(" mbar");
    Serial.println(splitdata[2]);
  }

  //data was received and processed
  if (newData == true) {
    newData = false;
    getPumpStatus();                                 //new pump status request
    delay(5000);                                     //arbitrary delay for requesting periodicaly
  }
}

nnaasshh:
I would like it to print both temperature and pressure for every 5 seconds in the serial monitor…

using the code provided in reply #4 you should be able to do just that.
If you are not getting any more reply after the FIRST reply, it may be due to the fact that the software serial Buffer is limited to 64 Character only (your receiving string is longer than that!). this can be resolved by adding an a couple if lines at the top of the code to increase the buffer size to 128 for example to be able to take in the whole string.

something like this maybe…
(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>

#ifdef _SS_MAX_RX_BUFF
#undef _SS_MAX_RX_BUFF
#endif
#define _SS_MAX_RX_BUFF 128 // Re-size RX SS buffer

SoftwareSerial mySerial(2, 3);                             // RX, TX connector to RS232-TTL converter
const byte numChars = 100;
char receivedChars[numChars];
char i, *splitdata[11];

boolean newData = false;

void getPumpStatus() {
  char STA[] = "#000STA\r"; //command to get pump status,"#000STA44\r"
  char c = 0;

  while (STA[c] != 0) {
    Serial.print(STA[c]); //for debugging purposes
    mySerial.write(STA[c++]);
  }
  Serial.println(""); //for debugging purposes

}

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

  while (SEP[c] != 0) {
    Serial.print(SEP[c]); //for debugging purposes
    mySerial.write(SEP[c++]);
  }
  Serial.println(""); //for debugging purposes

}

void recvData() {
  static boolean recvInProgress = false;
  static byte ndx = 0;
  char startMarker = '#'; //header character
  char endMarker = '\r'; // <CR>, end character
  char rc;

  if (mySerial.available() > 0 && newData == false) {
    rc = mySerial.read();

    if (recvInProgress == true) {
      if (rc != endMarker) {
        receivedChars[ndx] = rc;
        ndx++;
        if (ndx >= numChars) {
          ndx = numChars - 1;
        }
      }
      else {
        receivedChars[ndx] = '\0'; // terminate the string
        recvInProgress = false;
        ndx = 0;
        newData = true;
      }
    }

    else if (rc == startMarker) {
      recvInProgress = true;
    }
  }
}

void parseNewData() {
  const char *dataframe[11] = {"Address: ", "Pump Status: ", "Pressure(mBar): ", "Power(W): ", "FB Temp(degC): ", "Unused: ", "LP Temp(degC): ", "Analog Input(mV):", "MPS: ", "Fault Status: ", "N2 Purging (s): "};
  const char delim[] = " ,";
  char *token;

  i = 0;

  if (newData == true) {
    /* get the first token */
    token = strtok(receivedChars, delim);

    /* walk through other tokens */
    while ( token != NULL ) {
      if (i < 11) {
        Serial.print(dataframe[i]);
        splitdata[i] = token; //store token to array for later use
        ++i;
      }
      Serial.println(token);

      token = strtok(NULL, delim);
    }
    //newData = false; //required if variable is not set to 'false' outside of function
  }
}


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

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

  modSeperator(); //send command to modify seperator character

  //arbirtrary delay
  delay(1000);

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

  Serial.println("Adixen A1803H");
  Serial.println("Requesting pump status...");
  getPumpStatus(); //send command to request pump status

}

void loop() // run over and over
{
  recvData();
  parseNewData();

  /*
    i=0 -> Address
    i=1 -> Pump Status
    i=2 -> Pressure(mBar)
    i=3 -> Power(W)
    i=4 -> FB Temp(degC)
    i=5 -> Unused
    i=6 -> LP Temp(degC)
    i=7 -> Analog Input(mV)
    i=8 -> MPS
    i=9 -> Fault Status
    i=10 -> N2 Purging (s)
  */

  if (i > 6) {
    Serial.print("The temperature of the vacuum pump is LP Temp(degC): ");
    Serial.println(splitdata[6]);
  }

  if (i > 2) {
    Serial.print("The pressure of the vacuum pump is(mBar): ");
    Serial.println(splitdata[2]);
  }

  //data was received and processed
  if (newData == true) {
    newData = false;
    delay(5000); //arbitrary delay for requesting periodicaly
    getPumpStatus(); //new pump status request
  }
}

hope that helps…

I realised a potential issue and was in the process of updating reply #6 with some code! :wink:

Please try it out and let us know.

sherzaad:
I realised a potential issue any was in the process of updating reply #6 with some code! :wink:

Please try it out and let us know.

Thanks Sherzaad! saw your reply #6. Will try these code and hopefully it can run continuously. Thanks once again :grin:

Hi Sherzaad,

I have trouble transferring temperature and pressure data from rs232 to nodeMCU. (Serial communication between rs232 and nodeMCU.) I am not getting any data from nodemcu. I saw a forum on using SerialTransfer, and saw examples/advices on the forum that using SerialTransfer is better than using UART or JSON etc. I might have not declare the variable data correctly on nodemcu, which may be the reason why it is unable to transfer both temperature and pressure.

Here are the codes below: Hope you can advice me. Thank You.

TX:

#include <SerialTransfer.h>
#include <SoftwareSerial.h>

#ifdef _SS_MAX_RX_BUFF
#undef _SS_MAX_RX_BUFF
#endif
#define _SS_MAX_RX_BUFF 128 // Re-size RX SS buffer

SerialTransfer myTransfer;
SoftwareSerial mySerial(2, 3);                                 // RX, TX connector to RS232-TTL converter
SoftwareSerial sSerial (4, 5);                                 // sSerial for nodeMCU connnection 

const byte numChars = 100;
char receivedChars[numChars];
char i, *splitdata[11];

boolean newData = false;

void getPumpStatus() {
  char STA[] = "#000STA\r"; //command to get pump status,"#000STA44\r"
  char c = 0;

  while (STA[c] != 0) {
    Serial.print(STA[c]); //for debugging purposes
    mySerial.write(STA[c++]);
  }
  Serial.println(""); //for debugging purposes
}

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

  while (SEP[c] != 0) {
    Serial.print(SEP[c]); //for debugging purposes
    mySerial.write(SEP[c++]);
  }
  Serial.println(""); //for debugging purposes
}

void recvData() {
  static boolean recvInProgress = false;
  static byte ndx = 0;
  char startMarker = '#'; //header character
  char endMarker = '\r';  // <CR>, end character
  char rc;

  if (mySerial.available() > 0 && newData == false) {
    rc = mySerial.read();

    if (recvInProgress == true) {
      if (rc != endMarker) {
        receivedChars[ndx] = rc;
        ndx++;
        if (ndx >= numChars) {
          ndx = numChars - 1;
        }
      }
      else {
        receivedChars[ndx] = '\0'; // terminate the string
        recvInProgress = false;
        ndx = 0;
        newData = true;
      }
    }

    else if (rc == startMarker) {
      recvInProgress = true;
    }
  }
}

void parseNewData() {
  const char *dataframe[11] = {"Address: ", "Pump Status: ", "Pressure(mBar): ", "Power(W): ", "FB Temp(degC): ", "Unused: ", "LP Temp(degC): ", "Analog Input(mV):", "MPS: ", "Fault Status: ", "N2 Purging (s): "};
  const char delim[] = " ,";      
  char *token;

  i = 0;

  if (newData == true) {
    /* get the first token */
    token = strtok(receivedChars, delim);

    /* walk through other tokens */
    while ( token != NULL ) {
      if (i < 11) {
        Serial.print(dataframe[i]);
        splitdata[i] = token;                 //store token to array for later use
        ++i;
      }
      Serial.println(token);

      token = strtok(NULL, delim);
    }
    //newData = false; //required if variable is not set to 'false' outside of function
  }
}

void setup()
{
  Serial.begin(9600);
  while (!Serial);      

  mySerial.begin(9600);                            // set the baud rate to 9600 for RS232 
  sSerial.begin(9600);                             // set the baud rate for connection to nodeMCU 
  myTransfer.begin(sSerial); 

  modSeperator();                                  //send command to modify seperator character 
  delay(5000);                                     // delay in changing the modSeperator 

  //arbirtrary delay
  delay(1000);

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

  Serial.println("Adixen A1803H");
  Serial.println("Requesting pump status...");
  getPumpStatus();                                      //send command to request pump status
}

void loop() // run over and over
{
  recvData();
  parseNewData();

  /*
    i=0 -> Address
    i=1 -> Pump Status
    i=2 -> Pressure(mBar)
    i=3 -> Power(W)
    i=4 -> FB Temp(degC)
    i=5 -> Unused
    i=6 -> LP Temp(degC)
    i=7 -> Analog Input(mV)
    i=8 -> MPS
    i=9 -> Fault Status
    i=10 -> N2 Purging (s)
  */


  if (i > 6) {
    Serial.print("The temperature of the vacuum pump is LP Temp(degC): ");
    Serial.println(splitdata[6]);
  }

  if (i > 2) {
    Serial.print("The pressure of the vacuum pump is(mBar): ");
    Serial.println(splitdata[2]);
  }
  //data was received and processed
  if (newData == true) {
    newData = false;
    getPumpStatus();                                         //new pump status request
    delay(5000);                                             //arbitrary delay for requesting periodicaly
  }
    {
    uint8_t sendSize = 0;

    myTransfer.txObj(splitdata[6], sizeof(splitdata[6]), sendSize);
    sendSize += sizeof(splitdata[6]);

    myTransfer.txObj(splitdata[2], sizeof(splitdata[2]), sendSize);
    sendSize += sizeof(splitdata[2]);
  
    myTransfer.sendData(sendSize);
    delay(100);
}
}

RX (nodemcu)

#include <SoftwareSerial.h>
#include <ESP8266WiFi.h>
#include <WiFiClient.h> 
#include "SerialTransfer.h"

const char* ssid = "ESP";
const char* password = "12345678";
const int httpPort = 80;
WiFiClient client;

SoftwareSerial sSerial(4, 5);    // nodemcu connect
SerialTransfer myTransfer;
char i, *splitdata[11]; 


uint8_t recSize = 0;

void setup()
{
   Serial.begin(9600);
   sSerial.begin(9600);
   myTransfer.begin(sSerial);

   Serial.print("Connecting to ");
   Serial.println(ssid);
   WiFi.begin(ssid, password);
   while (WiFi.status() != WL_CONNECTED)
  {
    delay(500);
    Serial.print(".");
  }
}

void loop()
{
  if (myTransfer.available())
  {
    uint8_t recSize = 0;

    myTransfer.txObj(splitdata[6], sizeof(splitdata[6]), recSize);
    recSize += sizeof(splitdata[6]);

    myTransfer.txObj(splitdata[2], sizeof(splitdata[2]), recSize);
    recSize += sizeof(splitdata[2]);

    Serial.print("Temperature: ");
    Serial.println(splitdata[6]);
    Serial.println();
    Serial.print("Pressure: ");
    Serial.println(splitdata[2]);
    Serial.println();
  }
  else if (myTransfer.status < 0)
  {
    Serial.print("ERROR: ");

    if (myTransfer.status == -1)
      Serial.println(F("CRC_ERROR"));
    else if (myTransfer.status == -2)
      Serial.println(F("PAYLOAD_ERROR"));
    else if (myTransfer.status == -3)
      Serial.println(F("STOP_BYTE_ERROR"));
  }
}

I referred to this and downloaded the library:
https://github.com/PowerBroker2/SerialTransfer
https://github.com/PowerBroker2/SerialTransfer/issues/20

thanks again!!

Hello nnaasshh,

Why not connect the serial interface directly to the nodeMCU? The TX code would then be part of the RX code in that case and get rid of the additioal 'SerialTransfer' requirement. I fail to understand what you are trying to achive...

could you please post a schematic or block diagram of how the various parts detailing how they are connected?

sherzaad:
Hello nnaasshh,

Why not connect the serial interface directly to the nodeMCU? The TX code would then be part of the RX code in that case and get rid of the additioal 'SerialTransfer' requirement. I fail to understand what you are trying to achive...

could you please post a schematic or block diagram of how the various parts detailing how they are connected?

Hello,
I connected the serial interface directly to nodemcu. Attached picture below is how I connect RS232 and nodemcu to Arduino. The connection of RS232 works perfectly with the vacuum pump itself. Just had some trouble to transfer vacuum pump temperature and pressure values to nodemcu.
Arduino Uno nodemcu
GND GND
Pin 4 D4
Pin 5 D5

I will try again in the next lesson and remove the "SerialTransfer", and see what is the outcome of it. I do believe that if I remove the "SerialTransfer", the RX (nodemcu) code not required anymore?
Thankyou for your advice and reply

Hello nnaasshh,
Thank your for sharing the connections.

As I suspected you are currently connecting:

Adixen A1803H <--> Rs232 Interface <--> Arduino UNO <--> NodeMCU.

however IMHO the UNO is unecessary here as the NodeMCU can and should be able to do the same task currently done on the UNO in addition to being a WebServer ie:

Adixen A1803H <--> Rs232 Interface <--> NodeMCU <--> Web

Please be aware that while the pins on the NodeMCU are somewhat 5V tolerant, its probably better to use a level shifter between it and the RS232 interface as Nodemcu works on 3.3 volts
OR
just try connecting the Vcc of the Rs232 interface to 3.3V! :wink:

hope that helps...