Pitot Pressure with MPXV5010DP

HI
Building an Airspeed Sensor with the mpxv7002dp for my rc Jet was quite successful. the speed range goes up to about 220km/h. this is a little bit to low and i changed to an MPXV5010DP Sensor which has more differential pressure output (10kpa against 2kpa) at 5V. the 5010dp works also with the old code on a pro mini with 5V/16MHZ but no surprise with values which do not match with 7002dp or the speedometer from my car.So my question is what values to change in the code to get this accurate.
rgds
christian

Pressure.h - Library for pressure sensor.
Created by johnlenfr, May 15, 2014.
http://johnlenfr.1s.fr

SOURCE CODE .CPP

*/

#include “Arduino.h”
#include “SpeedPressure.h”

Pressure::Pressure(int pin){
pinMode(pin,INPUT);
_pin = pin;
}

int Pressure::Init(){
ref_pressure = analogRead(_pin);
for (int i=1;i<=200;i++)
{
ref_pressure = (analogRead(_pin))0.25 + ref_pressure0.75;
delay(20);
}
return ref_pressure;
}

int Pressure::GetAirSpeed(){
int air_pressure = 0;
for (int i = 0; i < 8; i++)
air_pressure += analogRead (_pin);
air_pressure >>= 3;
if (air_pressure < ref_pressure)
air_pressure = ref_pressure;

pitotpressure = 5000.0f * ((air_pressure - ref_pressure) / 1024.0f) + PRESSURE_SEA_LEVEL; // differential pressure in Pa, 1 V/kPa, max 3920 Pa
ambientpressure = PRESSURE_SEA_LEVEL;
temperature = 20.0f + ABSOLUTE_0_KELVIN;
density = (ambientpressure * DRY_AIR_MOLAR_MASS) / (temperature * UNIVERSAL_GAS_CONSTANT);
airspeed_ms = sqrt ((2 * (pitotpressure - ambientpressure)) / density);
airspeed_kmh = airspeed_ms * 3.600; // speed in km/h

return airspeed_kmh;
}

SpeedPressure.cpp (1.17 KB)

But with 10kPa you can still measure a crazy airspeed. Due to FSS, I would buy a DP sensor that goes to 3kPa.

The pressure you receive in a differential pressure sensor is the differential pressure. Which means, you will not record the ambient pressure. However, I'm not sure how this sensor works. I used the Honeywell HSC which works great!

lets make it simple:

V (m/s) = sqrt(2*DP/ rho)

rho = P_amb/RT

R = 287.053 J/kgK

therefore:

V(m/s) = sqrt(2DPR*T/ P_amb)

Also, you don't need a library. Its analog signal right? Just use the transfer function on the datasheet to obtain DP.

i know that this differential sensor is good for about 450km/h
so the sensor should be ok.in aviation you use DP Sensors with Pitot tubes (Prantl Tube)
can you explain this part of the code ?

for (int i=1;i<=200;i++)
{
ref_pressure = (analogRead(_pin))0.25 + ref_pressure0.75;
delay(20);

and this part?
pitotpressure = 5000.0f * ((air_pressure - ref_pressure) / 1024.0f) + PRESSURE_SEA_LEVEL;

Well the thing is, even though the sensors are from the same company, it has a different TF. That means that lets say that the max pressure is 10kPa, that means that at 10kPa you have something like 5V.

Since your last sensor hat 2kPa, you had 2kPa at 5V. Does that make sense?

Thats why I said, it is better to not use a library and do it very simple and use the transfer function from the data sheet.

what do you mean with the transfer function from the Datasheet?
sorry i'm german speeking and not really familiar with codes and programming

da ist eine gleichung auf dem Datenblatt. Das kannst du dir anschauen. Somit kannst du denn spannung ins druck umwandeln.

ahhh check, du sprichst ja auch deutsch.....

Yeah, but I think we are not allowed to since it is an English forum. However, it was just a repetition.
Check page 6 of the data sheet.

I think something like this should work if you are using Arduino (however not to sure, I did this in 5 seconds):

int DPPin = A0;

float vout;
float DP;

void setup() {
  Serial.begin(9600);           //  setup serial
}

void loop() {
  vout = analogRead(DPPin);  // read the input pin

DP = 1000.00*((vout/1023.00) -0.04)/0.09 ; // in Pa

  Serial.println(DP);        
}

Edit: I also did the same test in germany at 230 km/h and the results were horrible. However, I then did the test on a wind tunnel and it was really good.

thanks i will try this

This should just give the differential pressure. The rest is just simple maths. However, incase noise is important for you, you can try a 1-D Kalman filter.

i know that this differential sensor is good for about 450km/h

This is what I meant! Will your RC jet fly this fast? If not then, buy a different sensor. The problem is so: lets say that your sensor has an accuracy of plus/minus 0.25% FSS. This will mean that at 10kPa your error can be 25Pa. Which means at 500Pa you will still have an error of 25Pa.

So lets say that at 2kPa your accuracy is plus/minus 0.25% FSS, then you have an error of plus/minus 5 Pa.

Do you see what I mean?

450 KM/h i will not reach but about 400 is the target....I was talking to a friend which told me that the 5010 is quite right
look at

this is an accurate solution but only with the 7002dp sensor and up to 220kmh

That's fine then. I would also recommend a Teensy 4.0.

https://www.pjrc.com/store/teensy40.html

I realized with the conversion formula it won’t work. You need to put 1023 instead of 5.

I changed the code. However, I decided to make one that you can test for a comparison. Keep me up to date. This kind of project is very interesting for me since I am an aviation student.

I can’t test this myself since I don’t have the sensor. So I don’t know how much noise it produces.

Also, order a static pressure sensor like the BMP280:

https://www.reichelt.com/ch/de/entwicklerboards-temperatur-und-drucksensor-bmp280-debo-bmp280-p266034.html?PROVID=2808&gclid=Cj0KCQiAwf39BRCCARIsALXWETyZ-BiM5RWX3lc5welf-zgx87PsnAuIYIg8gPWpkXcRy5gsrz4x1gsaAkH2EALw_wcB

MPXV5010DP.ino (1.58 KB)

Thank you for your help.I’m busy at the moment, i will try that next week. The bmp280 is not realy usefull for that. You can use this as vario sensor (what i do) look at: Jeti VarioMeter – RC-Thoughts.com)
What i need is a combination from that: GitHub - RC-Thoughts/Jeti_Airspeed_Sensor: Simple Pitot-sensor for Jeti
The airspeed cpp is written for the 7002dp. 5010dp works but has wrong data.
My thoughts are to use this code for a 5004dp and to modify for the 5010dp is this a problem ?
The code for the 5004dp:

// Airspeed test
// V. Sherry 2016
//
// Calculates airspeed using using MPXV5004DP and Eagle Tree Pitot Tube Kit V3
// See Pitot tube - Wikipedia
// Total (or stagnation) pressure = dynamic pressure + static pressure
// Output of MPXV is dynamic pressure
// Airspeed = Square root of (2 * (Total pressure - static pressure) / Air density)
// or
// Airspeed = Square root of (2 * Dynamic pressure / Air density)

// Globals
int asPin = 1; // MPXV5004DP Vout pin - A1
double asOffsetV = 0.0; // variable for V offset (autozero)

void setup() {
Serial.begin(9600);
asOffsetV = analogRead(asPin) * .0047; // Zero speed sensor reading * 4.7 mV per count
}

void loop() {
double asVolts = 0.0;
double compVOut = 0.0;
double dynPress = 0.0;
double airSpeed = 0.0;

asVolts = analogRead(asPin) * .0047;

Serial.print("Raw reading (V): ");
Serial.println(asVolts);

Serial.print("Offset (V): ");
Serial.println(asOffsetV);

compVOut = asVolts - asOffsetV;

Serial.print("Reading - Offset (V): ");
Serial.println(compVOut);

//dynPress = (compVOut / 5.0 - .2) / .2; // Transfer function with no autozero
if(compVOut < .005) { // Set noise to 0, min speed is ~8mph
compVOut = 0.0;
}
dynPress = compVOut * 1000.0; // With autozero, dynamic pressure in kPa = Vout, convert kPa to P

Serial.print("Dynamic pressure ¶: ");
Serial.println(dynPress);

airSpeed = sqrt((2 * dynPress)/1.225); // Converts pressure to m/s, 1.225 k/m3 is standard air density

//Serial.print("Speed (m/S): “);
//Serial.println(airSpeed);
Serial.print(”*********************Speed (mph): ");
Serial.println(airSpeed * 2.236); // m/s to mph
//Serial.print("Speed (knots): ");
//Serial.println(airSpeed * 1.943);

Serial.println();

delay(1000);
}

That looks like it will work. However, your airspeed is still indicated and not true air speed. I don’t know if TAS is important for this case. Let me know how your test works out. I know for general aviation, the true airspeed is not necessarily needed.