1. Summary
  2. Files
  3. Support
  4. Report Spam
  5. Create account
  6. Log in

NXC: Mindsensors PPS35 - ADC values to bar?

Discussion specific to the intelligent brick, sensors, motors, and more.

NXC: Mindsensors PPS35 - ADC values to bar?

Postby doc-helmut » 13 Nov 2011, 19:28

hi,
are the Mindsensors PPS35 - ADC values already mbar?
or does anybody know how to convert them to bar / mbar?

Code: Select all
/************************************************************************/
/*                                                                      */
/* Program Name: PPS35-demo.nxc  */
/* ===========================                                          */
/*                                                                      */
/* Copyright (c) 2008 by mindsensors.com                                */
/* Email: info (<at>) mindsensors (<dot>) com                           */
/*                                                                      */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; version 3 of the License.              */
/* Read the license at: http://www.gnu.org/licenses/gpl.txt             */
/*                                                                      */
/************************************************************************/

task main()
{
   string msg;

  int v;
  SetSensorType(S1, SENSOR_TYPE_LIGHT);


   while (true) {
      msg = "Attach PPS35-Nx ";
      TextOut(0, LCD_LINE1, msg, false);
      msg = "Sensor to Port 1";
      TextOut(0, LCD_LINE2, msg, false);
      msg = "and change";
      TextOut(0, LCD_LINE3, msg, false);
      msg = "pressure.";
      TextOut(0, LCD_LINE4, msg, false);
      msg = "Pressure";
      TextOut(0, LCD_LINE6, msg, false);

    //***************************************************************
      v = SensorValue(S1);
      if (v<800) OnFwd(OUT_A,100); // air pressure pump: 800 mbar?
      else Off(OUT_A);
    //***************************************************************
   
      msg = "value: ";
      msg += NumToStr(v);
      msg += "  ";
      TextOut(0, LCD_LINE7, msg, false);
      Wait (200);

  }
}


or what exactly is
Code: Select all
ex_SensorMSPressure.nxc
This is an example of how to use the SensorMSPressure function.

int val = SensorMSPressure(S1);


doing?
regards,
HaWe
±≠≈αγδεωΔΦΣ∫√∅∞
NXC CHESS for NXT: http://www.mindstormsforum.de/viewtopic.php?f=70&t=6790
indispensable for NXC + EV3-C: easy + trouble-free network & sensor+motor remote control for rs485, BT, USB!
User avatar
doc-helmut
 
Posts: 2425
Joined: 29 Sep 2010, 14:25

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

Postby mattallen37 » 13 Nov 2011, 19:37

Using SetSensorType(S1, SENSOR_TYPE_LIGHT); probably sets the SensorValue range to % (0-100). I don't think that you would ever see a value above 100, unless you use RAW mode.

In RAW mode, you would get values in the range of 0-1023. The values from the sensor are analog, and due to tolerance and non-linearity of most all sensors, the reading will not be in any specific, common measurement unit. Long story short, you will most likely have to calibrate for it to be in a common unit of measure.
Matt
http://mattallen37.wordpress.com/

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

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

Postby mattallen37 » 13 Nov 2011, 19:40

doc-helmut wrote:...or what exactly is
Code: Select all
ex_SensorMSPressure.nxc
This is an example of how to use the SensorMSPressure function.

int val = SensorMSPressure(S1);


doing?

SensorMSPressure(S1); probably reads the ADC value in % (scaled) mode. I doubt it is doing any calibration, or offsets.

Edited for accuracy.
Matt
http://mattallen37.wordpress.com/

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

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

Postby doc-helmut » 13 Nov 2011, 19:55

mattallen37 wrote:Using SetSensorType(S1, SENSOR_TYPE_LIGHT); probably sets the SensorValue range to % (0-100). I don't think that you would ever see a value above 100, unless you use RAW mode.

In RAW mode, you would get values in the range of 0-1023. The values from the sensor are analog, and due to tolerance and non-linearity of most all sensors, the reading will not be in any specific, common measurement unit. Long story short, you will most likely have to calibrate for it to be in a common unit of measure.


the ranges in this MS program go from 0...1020 (manually tested)
with a 3rd party electrical pump they go from 0...330
regards,
HaWe
±≠≈αγδεωΔΦΣ∫√∅∞
NXC CHESS for NXT: http://www.mindstormsforum.de/viewtopic.php?f=70&t=6790
indispensable for NXC + EV3-C: easy + trouble-free network & sensor+motor remote control for rs485, BT, USB!
User avatar
doc-helmut
 
Posts: 2425
Joined: 29 Sep 2010, 14:25

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

Postby mattallen37 » 13 Nov 2011, 20:02

Okay, so it's in RAW ADC mode. That means that you need to calibrate it to get common measurement units (or just use RAW ADC values).
Matt
http://mattallen37.wordpress.com/

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

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

Postby doc-helmut » 13 Nov 2011, 20:06

I was afraid of that.
But I guess that probably someone did the calibration before because the sensor is already a couple of years on sale... :?
(in future I need values like 0.5...0.8...1,0...1.5 bar for several different applications)
regards,
HaWe
±≠≈αγδεωΔΦΣ∫√∅∞
NXC CHESS for NXT: http://www.mindstormsforum.de/viewtopic.php?f=70&t=6790
indispensable for NXC + EV3-C: easy + trouble-free network & sensor+motor remote control for rs485, BT, USB!
User avatar
doc-helmut
 
Posts: 2425
Joined: 29 Sep 2010, 14:25

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

Postby mattallen37 » 13 Nov 2011, 20:23

I went to the PPS35 product page, and immediately found a conversion formula. It is as follows:

PSI = 0.043 * RAW ADC - 38

or

float PSI = 0.043 * SensorMSPressureRaw(S1) - 38;

From PSI you can convert into whatever units you want.
Matt
http://mattallen37.wordpress.com/

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

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

Postby doc-helmut » 13 Nov 2011, 21:01

thx matt!
(I think I'll never find my way through this website!)

BTW:
I'm curious why they never use standard physic's SI units... :roll:
regards,
HaWe
±≠≈αγδεωΔΦΣ∫√∅∞
NXC CHESS for NXT: http://www.mindstormsforum.de/viewtopic.php?f=70&t=6790
indispensable for NXC + EV3-C: easy + trouble-free network & sensor+motor remote control for rs485, BT, USB!
User avatar
doc-helmut
 
Posts: 2425
Joined: 29 Sep 2010, 14:25

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

Postby mattallen37 » 13 Nov 2011, 21:05

I can see why a US based company would give preference to imperial over metric, but I have no idea why they don't give metric conversion formulas on their site as well.
Matt
http://mattallen37.wordpress.com/

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

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

Postby doc-helmut » 13 Nov 2011, 21:08

:D
do you know the story why a Mars orbiter exploded before landing?
:D
regards,
HaWe
±≠≈αγδεωΔΦΣ∫√∅∞
NXC CHESS for NXT: http://www.mindstormsforum.de/viewtopic.php?f=70&t=6790
indispensable for NXC + EV3-C: easy + trouble-free network & sensor+motor remote control for rs485, BT, USB!
User avatar
doc-helmut
 
Posts: 2425
Joined: 29 Sep 2010, 14:25

Next

Return to Mindstorms Hardware

Who is online

Users browsing this forum: No registered users and 1 guest