MXP 5100AP (Absolute Pressure Sensor) UPDATE/EDIT

Greetings everyone, I would like to invite you to ADD to an existing code I have for a Temperature and Humidity Data Logger. I am using an Uno, Adafruit Data Log Shield with a RTC and DHT 22 Temp/Hum Sensor. The MXP 5100 AP Sensor seems like it fits my needs perfectly. It measures from 0 to 115 kPa. This project is for monitoring of course, a Vacuum Chamber. The Temp/Hum is pretty straight forward. The Vacuum Sensor not so. This is a paying offer. I do not expect anything for free. Please PM if this is something you can handle in a timely manner for a reasonable fee.

This is just phase 1 of my project. After the data is analyzed there will be more parts to the project. Hopefully we can establish a solid business arrangement for the future as well.

Regards, Fred

UPDATED: The amount of vacuum being measured is 29 in Hg. (100 kPa) or relatively close. Though the data sheet from Mouser says 115 kPa. As "does it work for our system" I don't know yet as I am in the research stage. I do not see an icon to upload the code in this "edit mode", so I will post another conversation after this and include the code. There is a lot of tutorials on differential pressure, gauge pressure, altimeters and barometers. However I haven't found much of anything on Absolute Pressure, hence the need to hire someone to add the MXP 5100 AP to the Temp/Humidity code. Again, Thank you for your consideration.

Regards,
Fred

The data sheet I found says 100kPa - does that work for your system?

You do not stat what vacuum range you are in. When getting to very low vacuums the pressure indicated changes with humidity. This is a problem I saw when we were in the 300mTorr range and less. The gauges I am familiar are in the thousand dollar + range. We use two sensors, a pirani and a capacitance manometer. We correlate them against each other in a dry, empty and refrigerated system.

Hi all, not sure if this code is entered correctly in the </>, however it should still give you a good idea of what I am using. In addition to adding the MXP 5100 AP. In the code. I need to be able to set a LED to turn on at a specific level of Humidity. That level is unknown at the moment. So I will need that part commented out (explained) so I can change the LED to turn on at any given % of humidity. Again, thank you for your consideration of adding the MXP 5100 AP and the LED to the attached code. It seems pretty straight forward in regards to what I am looking for, However, if I missed something, feel free to inform.

Regards,
Fred

</>// log DHT sensor readings to SD card
#include "DHT.h"
#include <SD.h>
#include <Wire.h>
#include "RTClib.h"

RTC_DS1307 RTC;

// how many milliseconds between grabbing data and logging it. 1000 ms is once a second
#define LOG_INTERVAL 60000 // mills between entries (reduce to take more/faster data)

#define ECHO_TO_SERIAL 1 // echo data to serial port

#define DHTPIN 3 // what pin we're connected to

// Uncomment whatever type you're using!
//#define DHTTYPE DHT11 // DHT 11
#define DHTTYPE DHT22 // DHT 22 (AM2302)
//#define DHTTYPE DHT21 // DHT 21 (AM2301)

// Connect pin 1 (on the left) of the sensor to +5V
// Connect pin 2 of the sensor to whatever your DHTPIN is
// Connect pin 4 (on the right) of the sensor to GROUND
// Connect a 10K resistor from pin 2 (data) to pin 1 (power) of the sensor

DHT dht(DHTPIN, DHTTYPE);

// select 10 for adafruit shield
const int chipSelect = 10;

// create file to log to
File logfile;

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

Serial.print("Initializing SD card...");
// make sure that the default chip select pin is set to
// output, even if you don't use it:
pinMode(10, OUTPUT);

if (!SD.begin(chipSelect)) {
Serial.println("Card failed, or not present");
// don't do anything more:
return;
}
Serial.println("card initialized.");

// create a new file
char filename[] = "LOGGER00.CSV";
for (uint8_t i = 0; i < 100; i++) {
filename[6] = i/10 + '0';
filename[7] = i%10 + '0';
if (! SD.exists(filename)) {
// only open a new file if it doesn't exist
logfile = SD.open(filename, FILE_WRITE);
break; // leave the loop!
}
}

if (! logfile) {
Serial.println("could not create file");
}

Serial.print("Logging to: ");
Serial.println(filename);

// connect to RTC
Wire.begin();
if (!RTC.begin()) {
logfile.println("RTC failed");
#if ECHO_TO_SERIAL
Serial.println("RTC failed");
#endif //ECHO_TO_SERIAL
}

logfile.println("millis,datetime,rh,temp_c,temp_f,sat_vapor_density,vapor_density");
#if ECHO_TO_SERIAL
Serial.println("millis,datetime,rh,temp_c,temp_f,sat_vapor_density,vapor_density");
#endif //ECHO_TO_SERIAL
dht.begin();
}

void loop() {
DateTime now;

delay((LOG_INTERVAL -1) - (millis() % LOG_INTERVAL));

String dataString = "";

// fetch the time
now = RTC.now();
// log time
logfile.print(now.unixtime()); // seconds since 1/1/1970
logfile.print(",");
if (now.month() < 10) {
logfile.print(0, DEC);
}
logfile.print(now.month(), DEC);
logfile.print("/");
if (now.day() < 10) {
logfile.print(0, DEC);
}
logfile.print(now.day(), DEC);
logfile.print("/");
logfile.print(now.year(), DEC);
logfile.print(" ");
if (now.hour() < 10) {
logfile.print(0, DEC);
}
logfile.print(now.hour(), DEC);
logfile.print(":");
if (now.minute() < 10) {
logfile.print(0, DEC);
}
logfile.print(now.minute(), DEC);
logfile.print(":");
if (now.second() < 10) {
logfile.print(0, DEC);
}
logfile.print(now.second(), DEC);
#if ECHO_TO_SERIAL
Serial.print(now.unixtime()); // seconds since 1/1/1970
Serial.print(",");
if (now.month() < 10) {
Serial.print(0, DEC);
}
Serial.print(now.month(), DEC);
Serial.print("/");
if (now.day() < 10) {
Serial.print(0, DEC);
}
Serial.print(now.day(), DEC);
Serial.print("/");
Serial.print(now.year(), DEC);
Serial.print(" ");
if (now.hour() < 10) {
Serial.print(0, DEC);
}
Serial.print(now.hour(), DEC);
Serial.print(":");
if (now.minute() < 10) {
Serial.print(0, DEC);
}
Serial.print(now.minute(), DEC);
Serial.print(":");
if (now.second() < 10) {
Serial.print(0, DEC);
}
Serial.print(now.second(), DEC);
#endif //ECHO_TO_SERIAL

// Reading temperature or humidity takes about 250 milliseconds!
// Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
float h = dht.readHumidity(); // relative humidity, %
float t_c = dht.readTemperature(); // air temp, degC
float t_f = t_c*9.0/5.0 + 32.0; // air temp, degF
float svd; // saturation vapor density, g/m3
float vd; // vapor density, g/m3

// check if returns are valid, if they are NaN (not a number) then something went wrong!
if (isnan(t_c) || isnan(h)) {
Serial.println("Failed to read from DHT");
} else {
svd = 5.018 + 0.32321t_c + 8.1847e-3pow(t_c,2) + 3.1243e-4pow(t_c,3);
vd = h/100
svd;
logfile.print(",");
logfile.print(h, 2);
logfile.print(",");
logfile.print(t_c, 2);
logfile.print(",");
logfile.print(t_f, 2);
logfile.print(",");
logfile.print(svd, 4);
logfile.print(",");
logfile.print(vd, 4);

#if ECHO_TO_SERIAL
Serial.print(",");
Serial.print(h, 2);
Serial.print(",");
Serial.print(t_c, 2);
Serial.print(",");
Serial.print(t_f, 2);
Serial.print(",");
Serial.print(svd, 4);
Serial.print(",");
Serial.print(vd, 4);
#endif //ECHO_TO_SERIAL
}

logfile.println();
#if ECHO_TO_SERIAL
Serial.println();
#endif // ECHO_TO_SERIAL

// flush to file
logfile.flush();
} </>

The MXP is an analog Sensor, rather than a "smart" sensor with a complicated communications scheme. So it doesn't really need a library.
You'd want code like:

void logPressure() {
  int rawPressure = analogRead(MXPPin);
  float realPressure = ((rawPressure/1024.0) - 0.04) / 0.009;  // Datasheet + algebra
  logfile.print(",");
  logfile.print(rawPressure);
  logfile.print(",");
  logfile.print(realPressure,2);
  Serial.print(",");
  Serial.print(rawPressure);
  Serial.print(",");
  Serial.print(realPressure,2);
}

Presumably, call that just before the println() in your program.

that doesn't include temperature compensation (which shouldn't be needed over the 0-80C range.) And it hasn't been tested (I don't have an MXP 5100AP, or a vacuum chamber.) Note that the "raw" value might be better post-processed on whatever is reading your log file, or it can be plotted directly.

It assumes that the 10bit ADC of the Arduino provides sufficient resolution with the default 5V reference voltage (which would normally cover the full range of the pressure sensor.


That took about a hour of figuring out what you were asking for, reading datasheets, and typing. It seems pretty trivial to pay for, but if you're so inclined, feel free to donate ~$100 to your local zoo, aquarium, https://wikimediafoundation.org/, or Become a Snopes Supporter | Snopes.com

2 Likes

Hi, @Fredric58

To add code please click this link;

It will present your code in your post in a format that is easy to read and free of the odd emoji. :woozy_face:

Tom.... :grinning: :+1: :coffee: :australia:

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.