View unanswered posts | View active topics It is currently Sun Aug 19, 2018 12:23 am

 Page 1 of 1 [ 3 posts ]
 Print view Previous topic | Next topic
Problem with Pressure Sensor
Author Message
Rookie

Joined: Mon Aug 20, 2007 4:01 am
Posts: 28
Problem with Pressure Sensor
Hello,

I'm building a Pneumatic compressor, and have attached a mindsensors PPS35-NX pressure sensor. I want to have it reach 20 PSI, then stop. If the pressure goes below 20 PSI start pumping again until 20PSI is reached.

In the following code, why do I get a minus output from the psi, rather than the expected positive output. I got the formula, PSI = 0.043 * (RawReading) - 38 from the mindsensors documentation.

 Code:int psi;int val;task PSI(){   SensorMode[S1] = modeRaw;  while(true) {    val = SensorRaw[S1];    psi = 0.043 * (val) - 38;  }}task main(){   StartTask(PSI);   while(true) {      if (psi < 20) {         motor[Pump] = 100;        nxtDisplayBigStringAt (0,60,"Bx: %d", psi);        nxtDisplayBigStringAt (0,40,"By: %d", val);      nMotorEncoderTarget[Pump] = 360;    }    else {      motor[Pump] = 0;      nxtDisplayBigStringAt (0,60,"A: %d", psi);    }  }

Thanks
Karl

Mon Jan 26, 2009 2:08 pm
Rookie

Joined: Thu Nov 20, 2008 7:38 pm
Posts: 10
Re: Problem with Pressure Sensor
Obviously the documentation contains an error.

If you do a linear regression on the given graph,
the formula looks like:

p = -(0.043*digits - 48)

And yes, it's "48", not "38".

Somehow the second graph doesn't make sense too.
Whats does 100% mean? Does it represent 1023 digits?
If so, there is at least one more error in the given data...

AS

Mon Jan 26, 2009 4:42 pm
Rookie

Joined: Mon Aug 20, 2007 4:01 am
Posts: 28
Re: Problem with Pressure Sensor
Hello,
Yes, that works in that it gives a positive number, however, I have a LEGO analogue pressure meter attached to the compressor too.

Using: psi = -(0.043 * val - 48);
While the meter shows 15psi, the NXT display shows 20psi.

But with: psi = -(0.043 * val - 38);
The meter shows 22psi, with the NXT showing 20psi. I expect LEGO meter isn't as accurate as the sensor.

I think with the percentage I set:

SensorMode[S1] = modePercentage;

the use: psi = 0.27 * val + 8;
but I couldn't get aything useful out of that.

Thanks
Karl

Mon Jan 26, 2009 5:39 pm
Display posts from previous:  Sort by
 Page 1 of 1 [ 3 posts ]

#### Who is online

Users browsing this forum: No registered users and 2 guests

 You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum

Search for:
 Jump to:  Select a forum ------------------ ROBOTC Applications    ROBOTC for LEGO MINDSTORMS       Third-party sensors    ROBOTC for CORTEX & PIC    ROBOTC for VEX IQ    ROBOTC for Arduino    Robot Virtual Worlds    Multi-Robot Communications    Issues and Bugs Competitions & Partners    Mini Urban Challenge    CS2N Robot Virtual Worlds Competitions       VEX Skyrise Competition 2014-2015       VEX Toss Up 2013-2014       FTC Block Party! 2013-2014    Competitions using VEX - BEST, TSA, VEX, and RoboFest!    FTC Programming    RoboCup Junior and Other ROBOT Competitions Virtual Brick Robotics Discussions    General Discussions    Project Discussions Off-Topic ROBOTC Forum & ROBOTC.net Suggestions/Feedback    ROBOTC Forums Suggestions/Comments    ROBOTC.net Suggestions/Comments       NXT Programming: Tips for Beginning with ROBOTC       VEX Programming: Tips for Beginning with ROBOTC    2013 Robotics Summer Of Learning       VEX Toss Up Programming Challenge       FTC Ring It Up! Programming Challenge    International Forums       Spanish Forums          ROBOTC for MINDSTORMS          ROBOTC for VEX       French Forums          ROBOTC pour Mindstorms          ROBOTC pour IFI VEX       Japanese Forums （日本語のフォーラム）       German Forums    2015 Spring Carnival Event    PLTW (Project Lead The Way)    Robotics Merit Badge    2014 Robotics Academy Summer of Learning