Problems with air pressure sensor and hx711 module (help required)

hey everyone. so I have been trying to make a breath controller with the MPS20N0040D pressure sensor. at first I tried to use LM358 op amp and had no success and everyone pointed out in another topic that I made that the gain on the LM358 is no where near enough for my application so I have now acquired an HX711 module but I still have a problem and that is the fact that the output is 167772.15 which I believe is the maximum output for the module and it does not change whether pressure is applied on the sensor or not. I also have tried connecting the module the the digital pins 2 and 3.

there is also this topic in which they have the pressure sensor working (at least to the points of pressure that I care about in my project) with a very similar setup: Problem with air pressure sensor and HX711 ***

I will try to upload the relevant pictures down bellow.

thank you in advance




mps20n0040d-s_datasheet.pdf (276.2 KB)
hx711_english.pdf (160.4 KB)

Some HX711 have a production fault, where the E- pin is not connected to ground. Measure the resistance between E- and GND of the module. It should be close to zero ohm. If it's not, then solder a wire between E- and GND, and see if it fixes the problem.
Leo..

Edit: The faulty boards are semi-transparent with a strong light (they have no ground plane).

1 Like

It looks like your wiring is correct, but the constant output (167772.15) suggests an issue with calibration or gain settings. First, ensure the sensor is properly connected, especially the A+ and A- pins to the sensor's output. Try adjusting the HX711 gain in your code to 64 or 32, as the default 128 may not be suitable. Zero the sensor in your code before applying pressure, and check for electrical noise, which can be mitigated with decoupling capacitors (e.g., 100nF). You might also want to try different digital pins for the HX711 and ensure a stable power supply. Let me know how it goes!

1 Like

Tis is same subject?

so a little update on this. I put everything aside yesterday and worked on troubleshooting this setup and I tried out a few different things and I managed to get it working once right after I switched the MPS20N0040D with a GZP160-040s which is another 40 kpa sensor and although I didn't get the max output on that sensor it was completely unresponsive so I connected the previous sensor once again and this time it started working perfectly although at the time I had a different example library loaded so I assumed the other library was somehow at fault so I remounted everything and once I plugged them back in the first sensor was also like the second sensor and was nonresponsive instead of full output all the time. so I assumed the issue must be some improper connection or wiring or soldering somewhere and I redid everything and tried doing the exact same thing and different codes and libraries but to no avail.

yes this is the continuation of that same project. and my wiring was the main problem there but of course the output was way too small and unworkable for my purpose hence the purchase of the hx711 and this topic.

#include "HX711.h"

// HX711 circuit wiring
const int LOADCELL_DOUT_PIN = A4;
const int LOADCELL_SCK_PIN = A5;

HX711 scale;

void setup() {
  Serial.begin(9600);
  Serial.println("Pressure Sensor Test with HX711");

  scale.begin(LOADCELL_DOUT_PIN, LOADCELL_SCK_PIN);
  
  // Set gain to 128 (default) for channel A
  scale.set_gain(128);

  // Allow sensor to stabilize
  Serial.println("Stabilizing sensor...");
  delay(2000);

  if (!scale.is_ready()) {
    Serial.println("HX711 not found. Check wiring.");
    while (1);
  }

  Serial.println("Sensor ready. Begin applying pressure.");
}

void loop() {
  if (scale.is_ready()) {
    // Get raw data from HX711
    long raw_value = scale.get_units(); // Returns calibrated weight-like readings
    Serial.print("Raw Pressure Value: ");
    Serial.println(raw_value);

    // Adjust sensitivity or scaling factor based on your needs
    float pressure = raw_value * 0.1; // Example: Scale the value for pressure in desired units
    Serial.print("Scaled Pressure: ");
    Serial.print(pressure);
    Serial.println(" units");

    delay(500); // Adjust reading frequency
  } else {
    Serial.println("HX711 not ready.");
  }
}

the above is the code that worked. and bellow is the current output that doesn't change when pressure is applied on the sensor.

my board is also semi transparent so I tried this but it didn't help with the new problem. I didn't do any measurements with a physical device because this is a one time little project and it doesn't seem reasonable to purchase tools like a multimeter for such projects.

I think I'm going to give up on these parts and just purchase a sensor module with an hx710b on-board. I didn't do it until now because the only online store that sold them in my country seemed a bit sketchy but I think I'll just bite the bullet and order it.

thank you again for helping out a newbie :heart:

so last update on this. the actual problem for the sensors being unresponsive was the fact that the provided schematic in the data sheet PDF provided to me by the online seller was wrong and I figured that out after I visited this website and saw a different pin layout for the sensor.


src: Interfacing HX710 Differential ADC with Arduino

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