NXC: Mindsensors PPS35 - ADC values to bar?

Discussion specific to the intelligent brick, sensors, motors, and more.
mattallen37
Posts: 1818
Joined: 02 Oct 2010, 02:19
Location: Michigan USA
Contact:

Re: NXC: Mindsensors PPS35 - ADC values to bar?

Post by mattallen37 »

Well, I don't know if I trust the graph either, but in order to reach the 35 PSI the sensor is rated for, the range must be about 5.7-about 35 PSI (like the graph shows). Anything less than about 5.7 will read as 5.7. Continue to use my formula with the offset of 5.7, and at least it should be in real world units (although not capable of measuring below the offset).

Once you set up the sensor port for any inactive analog sensor (RCX touch, RCX temp, NXT touch, NXT light, NXT sound), you can safely use SensorRaw to get the true RAW ADC value. The sensor you set the port up for will not modify SensorRaw values, but it will change the SensorValue values. SensorValue is scaled to whatever range determined by the mode (light vs. touch...).
Matt
http://mattallen37.wordpress.com/

I'm all for gun control... that's why I use both hands when shooting ;)
HaWe
Posts: 2500
Joined: 04 Nov 2014, 19:00

Re: NXC: Mindsensors PPS35 - ADC values to bar?

Post by HaWe »

hmmmh,
I don't quite understand what you mean by "real world units", but if you look at this:

Code: Select all

ext. pressure  SensorMSPressureRaw  Matt's PSI
    0                  995               6.7 
I will get 6.7 as a result if I have actually put zero pressure = 0 psi to the system.
In other words:
If I put 0 psi pressure to my system , the calculated result should be 0, not 6.7

So the formula (using offset=5.7) seems to work faulty, what do you think?
mattallen37
Posts: 1818
Joined: 02 Oct 2010, 02:19
Location: Michigan USA
Contact:

Re: NXC: Mindsensors PPS35 - ADC values to bar?

Post by mattallen37 »

Real world units means units of measure that are widely recognized as being true units (like PSI, kPa, or even things like ml, kg, km...).

No, that is right. According to the graph, the sensor range is from about 5 (or 6.7) up through 35 ish. That means that until the pressure gets above the lower limit, it will calculate it to be like 5-6.7.
Matt
http://mattallen37.wordpress.com/

I'm all for gun control... that's why I use both hands when shooting ;)
HaWe
Posts: 2500
Joined: 04 Nov 2014, 19:00

Re: NXC: Mindsensors PPS35 - ADC values to bar?

Post by HaWe »

mattallen37 wrote:No, that is right. According to the graph, the sensor range is from about 5 (or 6.7) up through 35 ish. That means that until the pressure gets above the lower limit, it will calculate it to be like 5-6.7.
So does it mean that you agree that showing sth like 5-6.7 while the true real pressure is 0.0 psi = 0.0 hPa (absolutely nothing pumped in) is faulty?

Or does the sensor show the absolute pressure (including the barometric pressure depending on meteorological data - actually I doubt this), and not the difference between "inside" and "outside" ?
mattallen37
Posts: 1818
Joined: 02 Oct 2010, 02:19
Location: Michigan USA
Contact:

Re: NXC: Mindsensors PPS35 - ADC values to bar?

Post by mattallen37 »

doc-helmut wrote:So does it mean that you agree that showing sth like 5-6.7 while the true real pressure is 0.0 psi = 0.0 hPa (absolutely nothing pumped in) is faulty?
I do not think it is faulty. With no hose connected, it should read something like 5-6.7 PSI. Look at the graph to see what I mean. Once you get above the lower limit of somewhere around 5 PSI, then it should start to read according to the actual pressure (up until about 35 PSI).
Matt
http://mattallen37.wordpress.com/

I'm all for gun control... that's why I use both hands when shooting ;)
HaWe
Posts: 2500
Joined: 04 Nov 2014, 19:00

Re: NXC: Mindsensors PPS35 - ADC values to bar?

Post by HaWe »

well, whatever any graph shows -
if I have 0 pressure (no hose), then I expect to get the result 0, and nothing else -
everything else I would call a false measurement!

A proper calibration formula must take into account these special cases and then display correctly anyway.
(E.g., show Zero until a lower limit, and then show the correctly calculated + calibrated values)

But 5-7 psi is quite a lot, it's nearly 500 hPa, that's nearly 1/2 of the standard barometric pressure!
mattallen37
Posts: 1818
Joined: 02 Oct 2010, 02:19
Location: Michigan USA
Contact:

Re: NXC: Mindsensors PPS35 - ADC values to bar?

Post by mattallen37 »

Yes, I would to, but only if the sensor has the range of 0-35 PSI; and unfortunately it doesn't. It has a range of about 5 to about 35 PSI. This is a HW limitation, and not possible to over-come with any amount of SW calibration or formulas.

For the sake of being able to detect < the lower limit, you could do something like this:

Code: Select all

float PPS35_PSI (byte port){
  if (SensorRaw(port)==1023) return -1;
  float PPS35_PSI_001;
  PPS35_PSI_001 = 1024 - SensorRaw(port);
  PPS35_PSI_001 /= 23.07692307692308;
  return PPS35_PSI_001 + 5.7;
}
so that it returns -1 (or whatever else you want) whenever the pressure has not yet reached the lower limit. There is no way though to be able to sense pressures below that limit (it's a HW issue).

Note, that because I don't have a PPS35, I am drawing my "facts" from the graph.
Matt
http://mattallen37.wordpress.com/

I'm all for gun control... that's why I use both hands when shooting ;)
mattallen37
Posts: 1818
Joined: 02 Oct 2010, 02:19
Location: Michigan USA
Contact:

Re: NXC: Mindsensors PPS35 - ADC values to bar?

Post by mattallen37 »

doc-helmut wrote:...But 5-7 psi is quite a lot, it's nearly 500 hPa, that's nearly 1/2 of the standard barometric pressure!
I know, but you must work around that with the SW. I came up with my formula to match the working pressure range of the PPS35, not taking into account out-of-range pressures.
Matt
http://mattallen37.wordpress.com/

I'm all for gun control... that's why I use both hands when shooting ;)
HaWe
Posts: 2500
Joined: 04 Nov 2014, 19:00

Re: NXC: Mindsensors PPS35 - ADC values to bar?

Post by HaWe »

ok, I think I see what you mean.
But now please have a look at this:

Code: Select all

 SensorMSPressure SensorMSPressureRaw  Matt's PSI
      1              995                6.7  (no hose)
      3              943                9.0        
      6              869               12.4
      9              790               15.5
  ...
In case of "no hose" SensorMSPressure shows 1,
while "Matt's PSI" shows 6.7

also all the other values of "Matt's PSI" are about 6-7 units higher than "SensorMSPressure" .
Can one assume that SensorMSPressure values are approximately correct psi values or not?
mattallen37
Posts: 1818
Joined: 02 Oct 2010, 02:19
Location: Michigan USA
Contact:

Re: NXC: Mindsensors PPS35 - ADC values to bar?

Post by mattallen37 »

SensorMSPressure is almost properly scaled, but lacks necessary offset. In other words, you can use it, but I suggest adding about 5.7 to the value. It's also integer, not floating point (much lower resolution than mine).

I just realized that your sensor also doesn't match up with the graph, so use this instead of what I last posted:

Code: Select all

float PPS35_PSI (byte port){
  if (SensorRaw(port)>=994) return -1;
  float PPS35_PSI_001;
  PPS35_PSI_001 = 1024 - SensorRaw(port);
  PPS35_PSI_001 /= 23.07692307692308;
  return PPS35_PSI_001 + 5.7;
}
Matt
http://mattallen37.wordpress.com/

I'm all for gun control... that's why I use both hands when shooting ;)
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Semrush [Bot] and 1 guest