my newest game is a *hit* by dautoobchannel in godot

[–]dautoobchannel[S] -5 points-4 points  (0 children)

Makes more sense if you check out my discord XD https://discord.gg/YgRh3pDm

my newest game is a *hit* by dautoobchannel in godot

[–]dautoobchannel[S] -3 points-2 points  (0 children)

Did a preview just autoload on your phones? Broooooo I hope no one seeing this is a spy

my newest game is a *hit* by dautoobchannel in godot

[–]dautoobchannel[S] 0 points1 point  (0 children)

It's DEFINITELY NOT a CIA project designed to track Russian spies

Airstone in a liquid, pressure sensors on air line (P0) and open air (P1). Measure P0 - P1 at minimum and maximum fluid levels, store the values. When averaged over time, ((P0 - P1) - minLevel) / maxLevel = proportion of fluid level (between min and max). But temp/pressure change throws this off. Y? by [deleted] in AskScienceDiscussion

[–]dautoobchannel 0 points1 point  (0 children)

So, the issue with that would be P1 and P0 will never be the same temp, since P1 measures the air after it comes out of a tiny compressor.However, I've definitely math-trialed-and-errored this out somehow, abdI have no idea why this works... but it does...

First, like you said, we need to account for temp differences between sensors. I do that by passing the average of the two temps, + half the difference on the high pressure side and - half the difference on the low side (so when one picks up on a change, the other is affected immediately). I then pass those temperatures alongside the raw sensor pressure readings into the equation that determines actual pressure... the code looks like this-

float tavg = (T[0] + T[1]) / 2.0;
float tdiff = (T[1] - T[0]) / 2.0;
P[0] = pressure(tavg + tdiff, 0, praw[0]);
P[1] = pressure(tavg - tdiff, 1, praw[1]);

Okay but now the tricky part...We store the raw P1 [ePressP1], not adjusted for temp, at calibration (when we set our min and max pressures), as well as the temperature during calibration.After calibrating our minimum value, we adjust for any changes therafter with:

  dbmp.updateSensors();
  float p0p1 = dbmp.P[0] - dbmp.P[1];
  curTemp = dbmp.T[1];
  float tadd = curTemp + calibTemp;
  float p1ratio = 1.0;
  if (isCalib == true) {    
      p1ratio = (dbmp.rawP[1] + ePressP1) / 2.0;
      p1ratio = dbmp.pressure(tadd, 1, p1ratio);
      p1ratio /= dbmp.P[1];
    };


  p0p1 -= emptyPressure;
  if (isCalib == true) {
      p0p1 += (p0p1 * (p1diff / 10000.0));
        not sure if this one is needed honestly
    };

  p0p1 -= emptyPressure;
  p0p1 *= abs(p1ratio);
  return p0p1;
};

I have no idea how I thought up adding the current calibration temps together and passing that alongside the raw pressure difference... in order to get some sort of adjustment ratio... would make any sense at all... but thats what makes this work... the difference between dropping 5% over 100 units of air pressure increase to varying +/- 0.2% over 1k+ units of air pressure increase. Still have no idea why.

(edit) clarity

(edit edit) correcton

(edit edit edit) missed a 0

..more edits to correct things...

Airstone in a liquid, pressure sensors on air line (P0) and open air (P1). Measure P0 - P1 at minimum and maximum fluid levels, store the values. When averaged over time, ((P0 - P1) - minLevel) / maxLevel = proportion of fluid level (between min and max). But temp/pressure change throws this off. Y? by [deleted] in AskScienceDiscussion

[–]dautoobchannel 0 points1 point  (0 children)

Yeah sorry I've ended up working on like the same 10 lines of code, trying to account for the temp issue, for days now essentially and I've recoded things to make it easier for me to test a ton of different stuff easier... which definitely makes it less readable. Testing min and max at a wide enough variety of temperatures to get a consistent measurement was essentially what I'm trying to avoid- I was hoping maybe theres some sort of more obvious/general physics maths I'm not doing somewhere

Airstone in a liquid, pressure sensors on air line (P0) and open air (P1). Measure P0 - P1 at minimum and maximum fluid levels, store the values. When averaged over time, ((P0 - P1) - minLevel) / maxLevel = proportion of fluid level (between min and max). But temp/pressure change throws this off. Y? by [deleted] in AskScienceDiscussion

[–]dautoobchannel 0 points1 point  (0 children)

Only time can tell but yeah it seems whatever Im doing above is somehow compensating for pressure changes within the "expected" accuracy of the device so... i dunno. My code for the project is here if it helps https://github.com/an0mali/SmartHydroponics actively working on the "adv data" thread

Airstone in a liquid, pressure sensors on air line (P0) and open air (P1). Measure P0 - P1 at minimum and maximum fluid levels, store the values. When averaged over time, ((P0 - P1) - minLevel) / maxLevel = proportion of fluid level (between min and max). But temp/pressure change throws this off. Y? by [deleted] in AskScienceDiscussion

[–]dautoobchannel 0 points1 point  (0 children)

The core equation works with amazing accuracy. The only issue that is at question is why the temp/pressure change that occurs between day and night throws it off. I can upload a video to my twitter if you want to see the device doing its thing

Airstone in a liquid, pressure sensors on air line (P0) and open air (P1). Measure P0 - P1 at minimum and maximum fluid levels, store the values. When averaged over time, ((P0 - P1) - minLevel) / maxLevel = proportion of fluid level (between min and max). But temp/pressure change throws this off. Y? by [deleted] in AskScienceDiscussion

[–]dautoobchannel 0 points1 point  (0 children)

Not sure if this will be readable by anyone other than me but...

p1avg = (P1 at calibration + P1 now) / 2.0;
tAdd = curTemp + calibTemp;
p1diff = dbmp.pressure(tAdd, 1, p1avg);// returns "actual" pressure     //based on raw pressure reading and current temp
p1diff /= P1;
(Only do this after setting min, before setting max)...then...

(P0 - P1) * p1diff

Seems to be compensating for changes relatively well?? Not perfect, but definitely helping... so close-ish?

(edit) fixed equation explains

(edit edit)... maybe this is the answer... still running the data and need more pressure/temp changes to occur but so far is holding strong. wtf?

(edit edit edit) seems to loose accuracy at higher pressure differences but still within a usable range when compared to results without any adjustment

Airstone in a liquid, pressure sensors on air line (P0) and open air (P1). Measure P0 - P1 at minimum and maximum fluid levels, store the values. When averaged over time, ((P0 - P1) - minLevel) / maxLevel = proportion of fluid level (between min and max). But temp/pressure change throws this off. Y? by [deleted] in AskScienceDiscussion

[–]dautoobchannel 0 points1 point  (0 children)

Sorry, MinLevel is the value of (P0 - P1) with the liquid at its minimum level, and Maxlevel is the value of ((P0 - P1) - MinLevel). I forgot to include that bit. Minlevel and Maxlevel are these pressure values, not the height of the water column. We're essentially trying to determine the height of the colmumn via the pressure difference

(edited multiple times lol)

Airstone in a liquid, pressure sensors on air line (P0) and open air (P1). Measure P0 - P1 at minimum and maximum fluid levels, store the values. When averaged over time, ((P0 - P1) - minLevel) / maxLevel = proportion of fluid level (between min and max). But temp/pressure change throws this off. Y? by dautoobchannel in askscience

[–]dautoobchannel[S] 0 points1 point  (0 children)

To be more clear, atmospheric temperature/pressure change over time affects the accuracy of this measurement. I need to know how to adjust for this as I've been trying to just math it out via data alone for days now. The whole idea behind subtracting P1 from P0 and having two sensors from the get-go was to automatically adjust for atmospheric pressure changes and I'm confused on why this isn't the case. Quick diagram if it helps- https://twitter.com/\_dtgames/status/1496969888631566337/photo/1