I'm looking to use a MPXV5004DP sensor connected through a PIC to do certain things based on airspeed, in terms of the PIC and the ADC etc internally I kinda know what I'm doing, however, what I'm stumped on is the math used to get the airspeed from a ratiometric voltage, :-(
Obviously I have got it to work on my Ardupilot, however this was through the ArduPilot board, and to be honest I belive the credit goes to Jordi and Chris for this side as there was not much for me to do, :-)
Issue I have now is that I am able to stabilise the AN reading on the PIC (+-220 as a stationary reading from a 10 bit ADC on 3.00V), I have been able to translate this 0.6V which is what the datasheet shows as the stationary voltage. My question is, is anyone able to share the math on how to take this voltage output and translate it into a speed?
If it helps, the calcuation I have gotten to, although not giving the correct reading is:
[code]
'VelocityKPH = (AN_In-220)*36666 '220 used as a fixed offset for now)
'VelocityKPH = (AN_In)*36667
'velocitykph = div32 10
'VelocityKPH = SQR VelocityKPH
'VelocityKPH = VelocityKPH / 18
[/code]
I dont mind the syntax as I should be able to translate it back to the PIC's language, :-)
Many thanks to everyone for a great forum.
Kind Regards
Robert
You need to be a member of diydrones to add comments!
Replies
Unfornunatelly it's kind of hard to preciselly correlate the mesurement of the pitot tube with the real airspeed due to two factors:
1) The relation between the sensor tube diameter and the pitot tube diameter changes the reading value;
2) The air density changes with the altitude;
So... if u wanna approximation u can use the matlab code bellow:
rho = 1.225; %Kg/m³ - Air density at sea level 20C (aprox.)
zero_offset = 1.15; %Zero offset for the sensor
Vs = 5; %Sink voltage 5V
Vout = 1.2;
DP = 5*(Vout/Vs) - zero_offset %KPa - Differential Pressure
V = ((2*DP*1000)/rho)^(1/2) % m/s - Airspeed
V = V*3.6 %km/h
ADC = 2^10;
sensivity = ADC/Vs %bit/volt
pitotValue = ((Vout-zero_offset)/Vs)*sensivity