Go Down

Topic: Help with pressure sensor MD-PS002 (Read 39570 times) previous topic - next topic


I use HX711 with my PS002 vacuum sensor and have no problem. When You use HX711 You should connect HX711 E+ pin to  PS002 +IN pin; E- to both -IN; A+ to +OUT; A- to -OUT. You will have 4 wires from PS002 because both -IN to connected together.

You should install HX711 library and then You can use standard HX711 sketch from examples. If You will set 64 scale in the sketch You will take vacuum pressure in pascals. Full vacuum will show You -100 000 pascals.


I was able to operate the sensor using HX711 module but I´m getting incremental values, I mean, read_average(byte n) function is returning higher and higher values after system restarts so tare(byte n)  is impractical this way.


May 31, 2017, 06:10 am Last Edit: May 31, 2017, 06:13 am by Wawa
HX711 breakout board.
Onboard regulated 4.2volt excitation voltage for the bridge, instrumentation amp, and 24-bit A/D.
Well supported with code here.

Pressure sensors with buildin instrumentation amp are also temp compensated.
The HX711 setup is not.



Read about the HX711 data sheet, one of which is "Selectable 10SPS or 80SPS output data rate"
How to choose the rate?
What is the default value?


Default is 10SPS.
With 80SPS you trade accuracy for speed.
Most boards have a link you can cut, and/or solder bridge.


Jun 27, 2020, 03:12 am Last Edit: Jun 27, 2020, 03:15 am by addennis
Does anybody have a code snippet or proof of concept of how to get the MD-PS002 and HX711 to work? Ive tried everything I can dig up and have not yet been able to get any data from this sensor. Ive triple checked the wiring, tried multiple libraries, multiple sensors, etc.


Ive triple checked the wiring, tried multiple libraries, multiple sensors, etc.
So why don't you show us what you have done, and what did/didn't work.
Only then you might have a chance of getting help.
Read the "how to post" guidelines first.


Hi everybody,

I am making a vacuum meter. It works pretty well, but I don't understand how I can calculate it.

maybe someone knows how to handle that.
I have an arduino Nano with an HX711 with dar to an MD-PS002 sensor.
I want to read the Psi data on an Oled display 128X32.
I am now guessing what the Psi should be. I do that with an auto vacuum analog meter.
But that is not the right way.

I have the code for the Arduino here:

#include "HX711.h"
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

float analog_pot=0;
#define DOUT 2
#define CLK 3

HX711 scale;

//float calibration_factor =5.1714924102396; // 1 Psi is 5.1714924102396 cm Hg
float calibration_factor =51714; // maby
Adafruit_SSD1306 display(OLED_RESET);
  #if (SSD1306_LCDHEIGHT != 32)
  #error("Height incorrect, please fix Adafruit_SSD1306.h!");
void setup() {
scale.begin(2, 3);
scale.tare(); //Reset the scale to 0
long zero_factor = scale.read_average(); //Get a baseline reading

display.begin(SSD1306_SWITCHCAPVCC, 0x3C);  // initialize with the I2C addr 0x3D (for the 128x64)
  // init done
  // Clear the buffer.

void loop() {
scale.set_scale(calibration_factor); //Adjust to this calibration factor


//display.print(scale.get_units()*0.0000, 2);
display.print(scale.get_units()*0.135, 2);
display.println(" Psi");
display.print(scale.get_units(), 2);
display.println(" £");
  display.setTextColor(BLACK, WHITE); // 'inverted' text



if anyone can help me with that i will appreciate it very much.



If you want to read real psi from the sensor, you need to do some sort of calibration in Your code. I'm not familiar with HX711, so I can't point you exact functions. I would suggest You using a function to take "raw" readings from MD-PS002, and Serial.print those values. Then put the sensor in Your ?tank?.
Here are two alternatives (first is easier, second more accurate):

1) Take two readings at min and max pressure that could be in your ?tank? At both pressure levels you should measure it with Your trusty analog meter and print arduino reading.
You would end up with two points:
 (arduino reading, psi)
Then implement map() function to map arduino reading extremes to psi value extremes. This function should calculate everything in Your pressure range. Example:

real_psi = map(reading, min_reading, max_reading, min_psi, max_psi)

2) Take a few readings at different pressure levels in the ?tank?. At each pressure level you should measure it with Your trusty analog meter and print arduino reading. You would end up with table of points (example):
psi    |     arduino reading
5      |     1321
10    |     2652

Then enter those points (x = arduino reading, y = psi) into some maths graphing software (I used geogebra) which can draw a "straight line that mostly matches all of those points". Then get a equation and embed it in Your code (if using integers do it carefully to balance precision and to avoid roll over).

BTW: Those sensors don't like attaching silicon hoses to them (I damaged seal in mine while doing so). I've also used MD-PS002, but rated for 700kPa. I was using ina333 instrumentation amp and analogReading sensor.

Go Up