901P 42030 Transducer Issues

For Short Term Learning Discussions ONLY. This area is for CURSORY questions and connecting with other users ONLY. ALL technical contributions need to be made in the appropriate forums and NOT HERE. All posts are temporary and will be deleted within weeks or months. You should have already search the extensive FAQs in each of the forums before posting here as your question may already be answered.
Post Reply
Matthew Nikolaenko
Posts: 9
Joined: Wed Mar 09, 2022 3:26 am
Real name: Matthew Nikolaenko

901P 42030 Transducer Issues

Post by Matthew Nikolaenko »

I am struggling to operate the 901P 42030 and I am using this code from another part of the forum:

#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define OLED_RESET 4
Adafruit_SSD1306 display(OLED_RESET);
String sensorValue;
String pressureUnit;
String unitBuffer;
String unit;
const byte ledPin = 13;
const byte interruptPin3 = 3;
const byte interruptPin2 = 2;


void setup() {
display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
Serial.begin(9600);
pinMode(ledPin, OUTPUT);
pinMode(interruptPin3, INPUT_PULLUP);
pinMode(interruptPin2, INPUT_PULLUP);
attachInterrupt(digitalPinToInterrupt(interruptPin3), pascalISP, FALLING);
attachInterrupt(digitalPinToInterrupt(interruptPin2), fuspeakISP, FALLING);
}


void loop() {
if (unit == "Pascal") {
pascal();
}

else if (unit == "Fuspeak") {
fuspeak();
}

display.display();
}


void pascalISP() {
unit = "Pascal";
Serial.print ("@253U!PASCAL;FF");
}


void fuspeakISP() {
unit = "Fuspeak";
Serial.print ("@253U!TORR;FF");
}


void pascal () {
Serial.print ("@254PR3?;FF");
sensorValue = Serial.readString();
sensorValue.remove(0, 7);
sensorValue.remove(7);
pressureUnit = "Pascal";
display.clearDisplay();
display.setTextColor(WHITE);
display.setTextSize(1);
display.setCursor(0, 0);
display.print("Foreline Pressure");
display.setTextSize(2);
display.setCursor(0, 9);
display.print(sensorValue);
display.setTextSize(1);
display.setCursor(85, 25);
display.print(pressureUnit);
}


void fuspeak () {
Serial.print ("@254PR3?;FF");
sensorValue = Serial.readString();
sensorValue.remove(0, 7);
sensorValue.remove(7);

unitBuffer = sensorValue;
unitBuffer.remove (0, 5);
if (unitBuffer == "+2") {
pressureUnit = "torr";
}
else if (unitBuffer == "+1") {
pressureUnit = "torr";
}
else if (unitBuffer == "+0") {
pressureUnit = "torr";
}
else if (unitBuffer == "-1") {
pressureUnit = "micron";
sensorValue.remove (1, 1);
sensorValue.remove (3);
}
else if (unitBuffer == "-2") {
pressureUnit = "micron";
sensorValue.remove (1, 1);
sensorValue.remove (2);
}

else if (unitBuffer == "-3") {
pressureUnit = "micron";
sensorValue.remove (1, 1);
sensorValue.remove (1);
}
else if (unitBuffer == "-4") {
pressureUnit = "millitorr";
}
else if (unitBuffer == "-5") {
pressureUnit = "millitorr";
}
else if (unitBuffer == "-6") {
pressureUnit = "millitorr";

}
else pressureUnit = "endelse";


display.clearDisplay();
display.setTextColor(WHITE);
display.setTextSize(1);
display.setCursor(0, 0);
display.print("Foreline Pressure");
display.setTextSize(2);
display.setCursor(0, 9);
display.print(sensorValue);
display.setTextSize(1);
display.setCursor(85, 25);
display.print(pressureUnit);
}

The code runs fine but I'm getting a logic error. How do I get the pressure to be displayed?
Attachments
901P.jpeg
901P-2.jpeg
901P-3.jpeg
JoeBallantyne
Posts: 327
Joined: Tue Jul 20, 2010 4:08 pm
Real name: Joe Ballantyne
Location: Redmond, WA

Re: 901P 42030 Transducer Issues

Post by JoeBallantyne »

The 2 as the second digit in the model number of your device indicates that it is an RS485 bus not an RS232 bus device. Are you sure you have the proper RS485 interface for connecting to that device from your control board? Transmit and receive are shared on the same wire for 485 unlike 232 where you have separate Rx and Tx lines.
JoeBallantyne
Posts: 327
Joined: Tue Jul 20, 2010 4:08 pm
Real name: Joe Ballantyne
Location: Redmond, WA

Re: 901P 42030 Transducer Issues

Post by JoeBallantyne »

The correct way to connect to an RS485 bus is to use a proper tranceiver chip for driving the differential twisted pair electrical signals. I suspect you may not be using one right now. Unless you know for a fact that you can wire the Rx and Tx input and output wires directly together on your control board, don't do that. Get the correct RS485 driver chip and use that.
Post Reply

Return to “New User Chat Area”