Air Pressure - SM5420C

The whole thing is explained quite well in the evaluation kit Documentation.

Paul

I hadn't seen that document yet, thanks for pointing it out. I'll study on it a bit. :slight_smile:

The easy-to-use HX711 with channel B (32x gain) would give you about 80% of the full range. If you need full range, you could use something like the ADS1115. You'd use +SIG and -SIG with both devices.

thanks again, and I have one more probably-stupid question:

do these sensors have to have a pressure differential from their inlet to the atmosphere surrounding their housing such as by connecting a tube from the sensor's inlet to the pressure chamber, or can they be completely disposed within the pressure chamber with only the wires passing through the pressure chamber wall?

If you only want to detect a (big) change in pressure, then connect the two outputs of the sensor to two analogue inputs.
Subtract the two A/D values you get from each other to find the difference (positive or negative).
Don't expect a lot from these unamplified sensors (~20 A/D values over the whole pressure range).
You should have bought sensors with buildin instrumentation amp.
Leo..

I didn't realize you could read negative analog values. Are there any particular measures to take when doing so?

and yeah, these don't seem to be the optimal sensors to use, but they were what was already in the drawer, so I decided to give them a go. And it may be a good opportunity to learn about op-amps, so silver lining...

On that note, I tried looking around for the hx711 op-amps, and they don't seem to be readily available. All I could find are pricey break-out boards that are on back-order at the major distributors. I'm not shy about making my own breakout boards, but that op-amp doesn't seem to be very available even as a standalone IC. Are there any other recommendations? Or better yet, what sort of specs should I look for to judge the fitness of a given op-amp?

silly_cone:
I didn't realize you could read negative analog values.

You don't.

If you connect Vexc (excitation voltage) and Gnd of the sensor to 5volt and ground of the Arduino,
then you have about 2.5volt on both Sig outputs of the sensor.

Pressure changes that 2.5volt slightly, but one output more positive and the other one more negative.
Both return about 512 without pressure, but if one returns 514 and the other one 510 then the difference is 4.

int pressure = analogRead(A0) - analogRead(A1); // should do something.

Leo..

thanks for that! I'll keep tinkering with it tomorrow and see what results I'm able to get.

silly_cone:
On that note, I tried looking around for the hx711 op-amps, and they don't seem to be readily available.

There are dozens of eBay sellers of inexpensive HX711 breakout boards. You can also get them from Sparkfun, RobotShop, etc.

But if all you need is the "ability to detect a change" (your first post), then using analogRead with +SIG alone may be all you need to do (or +SIG and -SIG as per @Wawa). No one here knows what "a change" means, since you haven't defined it.

Hooking up both outputs to two analog pins the way Wawa described worked well. It doesn't have to have a great-resolution. If I'm able to detect a pressure change of a small number of PSI, that is sufficient. And this setup achieves that: if I connect a tube to the chip's inlet port and the other to a syringe, the analog difference value rises from 21 to over 30, and approaches 0 if I pull a vacuum.

One thing I'm wondering, though, is this is an absolute pressure sensor with a range of up to 15 PSI. But atmospheric pressure itself is ~14.69 PSI. So does that mean the sensors is basically maxed-out in atmospheric conditions?

okay, please excuse one more stupid question....

I'm still not comfortable with my understanding or use of op-amps, but I did find a package of LM358N (datasheet) and MC1458 (datasheet) op-amps in my toolkit. Will these be at all useful with this sensor? I'm looking at the datasheet, but like I said, I'm still not sure what it is I'm looking at exactly (I learn far better through example), so any tidbits anyone can share would be much appreciated to help it all come-together for me.

From what I've read so far of the various ways op-amps can be set up, it sounds like I need to use it as a differential amplifier of the two outputs of the SM5420 to get a single analog value that reflects the difference between the two inputs. Is that correct?

{edit - tried some stuff out}

Okay, I made some progress. Right now I have things connected as shown in the schematic below. I originally started out with R1 and R2 both equal to 51K, then switched one resistor to 100K (tried it in both places) and tried it again, and seem to have improved resolution.

With each resistor placed as shown in the schematic, analogRead() returns a consistent value of 307-308 with a range of approximately +/- 210. If I swap resistor positions, then it analogRead() returns a value of 650-651, but with a range of only about half the other configuration.

schematic.png

So, functionally it seems okay, but I'm sure there are ways to optimize, and I'm still not real clear on how I would go about intentionally dialing-in the gain/range other than "let's see what happens if I...", and then after enough trials I'll pick up on the pattern.

Also, are there places I should place any caps to smooth the output?

schematic.png

Wrong diagram for a Wheatstone bridge sensor.
You need an instrumentation amp (three opamps).
Leo..

okay. could you help me get a little more insight on what is happening in that schematic? clearly something is happening, and the output behaves as I would expect.

Uneven or single-ended amplification of the sensor results in readings depending on pressure as well as supply voltage variations. You really need an instrumentation amplifier that amplifies both outputs of the sensor with two opamps, and sums them with a third one.
Leo..

alright, I read up a bit on in-amps, and came up with the following configuration. Is this looking more appropriate?:

schematic.png

This gives me 294-295 at atmospheric pressure on the analog pin, with a span of a >200 +/- in each direction for increases or decreases in air-pressure, respectively.

I noticed that this configuration does not use a Gain Resistor between the two buffer op-amp outputs. Does that detrimentally affect performance in any meaningful way?

Are there additional ways to improve this circuit?

And FYI, I did go ahead and order a couple hx711 boards, and they will arrive next week. But this seemed like a good opportunity to learn about op-amps, so I wanted to dive in full-bore instead of copping out and buying something off-the-shelf just because its easier.

schematic.png

I think it's more common to use the input amplifiers for gain (with a common gain set resistor), and the third opamp only as adder.
Your circuit is using the input opamps as buffers (with a gain of 1) and the third opamp for gain.
Not sure what''s best.
Restrictions are the limited output swing of an LM358 (~3.5volt on a 5volt supply) and Arduino's 10-bit A/D.
Let us know how you get on with the HX711.
Leo..

alright, HX711 arrived today, and I gave it a quick shot after looking at some examples of how load-cells are connected and read using the HX711 library.

aaaaaannnd, I'm getting some pretty screwy looking outputs.

I have it connected thusly:

HX711 Arduino
GND ---> GND
DT ---> 11
SCK ---> 10
VCC ---> 5V

HX711 SM5420C
E+ ---> Vexc
E- ---> GND
B+ ---> SIG+
B- ---> SIG-

This is the code I'm using to read the values:

#include "HX711.h" 
 
#define DOUT  11
#define CLK  10
 
HX711 scale(DOUT, CLK);
 
void setup() {
  Serial.begin(9600);  
}
 
void loop() {
  Serial.println(scale.read_average(5)); 
  delay(500);
}

And here is the serial output:

-6682
-6511
-6816
-6509
-6711
-6563
-6555
-6540
-6588
-6587
-6713
-6568
-6668
-6379
-6698
-6442
-6659
-6698
-6603
-6572
-6714
-6796

I tried altering the pressure going into the sensor to look for any sort of response, and there didn't seem to be any at all.

Clearly I'm doing something wrong here...

I don't see you select channel B.

Did you calibrate?

Leo..

okay, I found out how to select channel B, and tried running a calibration, but the values are still gibberish. They're not at all stable, and float substantially.

I used the following code to try and calibrate. The best I was able to achieve after fiddling was a sort-of stable reading of 0 +/- 0.2, but the sensor did not give expected responses, and the data was very jittery.

#include "HX711.h"  //You must have this library in your arduino library folder
 
#define DOUT  11
#define CLK  10
 
HX711 scale(DOUT, CLK);
 
//Change this calibration factor as per your load cell once it is found you many need to vary it in thousands
float calibration_factor = -106600; //-96650; //-106600 worked for my 40Kg max scale setup 
 
//=============================================================================================
//                         SETUP
//=============================================================================================
void setup() {
  Serial.begin(9600);
  Serial.println("HX711 Calibration");
  Serial.println("Remove all weight from scale");
  Serial.println("After readings begin, place known weight on scale");
  Serial.println("Press a,s,d,f to increase calibration factor by 10,100,1000,10000 respectively");
  Serial.println("Press z,x,c,v to decrease calibration factor by 10,100,1000,10000 respectively");
  Serial.println("Press t for tare");
  scale.begin(DOUT, CLK, 32);
  scale.set_scale();
  scale.tare(); //Reset the scale to 0
 
  long zero_factor = scale.read_average(); //Get a baseline reading
  Serial.print("Zero factor: "); //This can be used to remove the need to tare the scale. Useful in permanent scale projects.
  Serial.println(zero_factor);
}
 
//=============================================================================================
//                         LOOP
//=============================================================================================
void loop() {
 
  scale.set_scale(calibration_factor); //Adjust to this calibration factor
 
  Serial.print("Reading: ");
  Serial.print(scale.get_units());
  //Serial.print(" kg"); //Change this to kg and re-adjust the calibration factor if you follow SI units like a sane person
  Serial.print(" calibration_factor: ");
  Serial.print(calibration_factor);
  Serial.println();
 
  if(Serial.available())
  {
    char temp = Serial.read();
    if(temp == '+' || temp == 'a')
      calibration_factor += 10;
    else if(temp == '-' || temp == 'z')
      calibration_factor -= 10;
    else if(temp == 's')
      calibration_factor += 100;  
    else if(temp == 'x')
      calibration_factor -= 100;  
    else if(temp == 'd')
      calibration_factor += 1000;  
    else if(temp == 'c')
      calibration_factor -= 1000;
    else if(temp == 'f')
      calibration_factor += 10000;  
    else if(temp == 'v')
      calibration_factor -= 10000;  
    else if(temp == 't')
      scale.tare();  //Reset the scale to zero
  }
}