Switching from MPX5100 to MPX5050

I need to change my MPX5100 pressure sensor that has gone bad for a MPX5050. The MPX5100 are almost impossible to get right now.

What changes in code would I need to make to switch from the MPX5100 to MPX5050? My reading are in MMHG.

Thanks,
Kevin

did you use a library such as GitHub - DouglasUrner/Arduino-MPX: Arduino driver for Freescale MPX5xxx family of pressure sensors. ?

I've seen this mention:

** Transfer functions (from datasheets):
**
** MPX5010: Vout = Vs * (0.0900000 * P + 0.04) +/- Error (5.0% Vfss)
** MPX5100: Vout = Vs * (0.0090000 * P + 0.04) +/- Error (Perror * Temp Factor * 0.009 * Vs)

I am using this couple lines of code.

int offset = 46; // zero flow pressure adjust (~30-72)
int fullScale = 819; // max pressure adjust (~798-840)
float flowpressure; // final pressure in mmHg
flowpressure = (filteredValue - offset) * 650.0 / (fullScale - offset);

we don't know how you read the sensor...

I just need to know if this line needs changed for the new sensor. Specifically the 650.

Don't you think that the sensor may not has "gone bad", you just use it incorrectly?

Then tell me how to use it correctly, since you know!

Do you open library source at the link in post #1 ? It contains the correct method of reading pressure from the sensor.

The "650" in your formula seems to be a distorted value of normal pressure in mmHg. But since this value should be 760 at sea level, this means that the formula refers to an area about 1300m above. Does this look like your case?

No library! Where I am 1550 feet above sea level. This is not a critical measurement, just a reference number. This is just like a Sphygmometer used in a hospital for checking blood pressure. They don't require adjusting for sea level.

You need to change your approach to first posting in a thread.

Side note: The MPX5050 is not even listed in the Library!

The formula is quite simple.
If you prefer do not use library - you can get the formula from source and use it in your code.
But it will definitely be better than using operations with magic numbers, it is not clear who deduced for another area.
Returning to the first question - I don't know what you should change 650 to in the code, because it's not clear what this number means.

The pot is calling the kettle black! Please read the forum guide in the sticky post, then review your posts.

Then why did you post at all?

It looks like to me now if the number is to be 760 then for the MPX5050 that reads half of the pressure then the constant should be 380. Logical deduction my dear Watson.

Why do people have to be an AH about everything? What happen to respect for each other no matter what their level is. We have all been at the beginning of our journey. No matter where you go and post on forums or facebook pages people have to be rude.

I should have just searched and looked at code for the MPX5050 instead of coming here.

Nobody was talking to you!

agree
The function for MPX5050:

** MPX5050: Vout = Vs * (0.0180000 * P + 0.04) +/- Error (5.0% Vfss)

datasheet:

I think the issue is over

You posted on a public forum. Anyone is free to answer.

I didn't see an answer to the issue. Go find some newbie to pick on like you do!

Because you didn't read the forum guide.

I do sometimes point out to newbies that they have not read the forum guide. Some newbies, unfortunately, don't believe the forum guide should apply to them.

While your itching and scratching, say something productive

Don't be bereding people

Read the forum guide.

The devil is usually in the detail. That's why we ask posters to adhere to the posting guidelines. They are there so you don't forget the details, because even a small detail could change the results.
Like you said 650.0 (float) in post#3, but are using 650 (integer) in post#5.

If you read the datasheet of the MPX5050, then you find a typical output voltage range of 0.2volt (no pressure) to 4.7volt (full pressure). That should actually be converted to a percentage for the ratiometric A/D of an Arduino, so typical sensor output range is 4% to 94% of VCC.

That translates to an offset of 4% of 1024 = 41 (not 102 as with other sensors),
and a fullScale of 96% of 1024 = 983 (not 922 as with other sensors).

It seems you want to display in mmHg.
The MPX5050 is a 50 kPa sensor. That's 375.031 mmHg.
If you use that (instead of 50.0) in your formula, then you have a direct display in mmHg.

declare

int offset = 41; // adjust for zero mmHg
int fullScale = 983; // adjust for accurate top scale readout if... you have a calibration instrument
float pressure;

and in loop
pressure = (analogRead(A0) - offset) * 375.031 / (fullScale - offset); // in mmHg

Next time try to stick to the forum guidelines.
You could be surprised by the more positive responses.
Life is like a mirror...
Leo..