I need to make a prototype of a device that can be left in the field (battery operated) that will measure the wind speed intermittently and save the data. The device will be retrieved every 2-4 weeks.
I have the following pressure sensor MPXV5004DP . . .
Any advice regarding connecting this sensor to the Arduino would be much appreciated. I have no idea what I'm doing.
I'd like to do this without a PCB since my soldering skills are cro-magnon.
It is a 5V, temperature compensated, and calibrated. It is a differential pressures sensor for 3kPa (very sensitive). So that is all good.
The offset is 1V and the output is 1V per kPa. That's perfect for the Arduino.
See the datasheet how the pins are numbered.
Arduino 5V to sensor pin 2.
Arduino GND to sensor pin 3.
Arduino analog input (for example A0) to sensor pin 4. You may not connect the unused pins of the sensor !
Read the analog value and write it to the serial monitor.
If that is working, you can start to calculate the actual pressure.
By declaring variables for the offset and sensitivity, it is easier to change them a little.
Perhaps the offset is actually 0.95V instead of 1.0V.
// untested code
// The offset voltage is 1.0V when there is no pressure difference.
const float offset = 1.0;
// The sensitivity is 1.0V per kPa for the sensor.
const float sensitivity = 1.0;
// assume the analog pressure sensor is connected to A0.
const int pinSensor = A0;
...
int rawADC = analogRead (pinSensor);
float voltage = (float) rawADC / 1023.0 * 5.0; // voltage at Arduino pin. Range is 5V, 10 bits.
float pressure = (voltage - offset) / sensitivity; // differential pressure in kPa
// Some magical calcuation for the windspeed (just as an example)
float windspeed = sqrt ( 2.0 * pressure / 1.2 );
Do you have to know the baromic value of the air, to calculate a more accurate air speed ?
Thank you Caltoa, your code helped me to start, I modified it and am having troubles with the wind speed output. The pressure difference seems to be too small to provide an accurate wind speed measurement - perhaps I need an amplifier. Or is something wrong with my code?
float IN = analogRead(A0);
float PP = ((IN/1023 - .2) / .2); //Pressure difference in kPa, via the transfer function from the datasheet
float windspeed = sqrt ( (2.0 * PP) / density );//Equation for wind speed where density is found via BMP180 barometer
The variable 'density' is a float ?
You have "IN/1023", but I would use "IN/1023.0", so it is clear that it is a float calcuation.
You do have some kind of output I hope ?
Can you show the numbers and tell what the wind was ?
There are a few possibilities to increase accuracy:
1 ) Use the internal reference, or a good 5V reference. The best way depends on the sensor and how it is connected.
At least don't use the USB to power the Arduino, use a seperate power supply to the DC jack plug. A power supply of 7 to 12V.
2 ) Use the average of a few samples. You could write a function getVoltage(pin) that returns the voltage of a pin. That makes it easier to add averaging to it. For example the average of 10 samples.
3 ) An OpAmp should not be necessary, since the sensor has already an amplifier inside. Perhaps you could use an OpAmp, but that will also increase the noise an inaccuracy. The INA125 is often used with the Arduino, but I don't know if that is the best OpAmp for this.
With a good 5V and with averaging, the values should be stable (with a 'stable' wind, but the wind is never the stable in the real world).
I finally got into our wind tunnel for testing and got it working! The wind speed equation had to be modified in order to achieve the desired output. Results are in the google doc below.
This is probably not the best way to go about things but it worked. I subtracted 0.14 from the initial pressure because it was reading that at 0 m/s, I then played with the numbers until the speeds lined up. It worked when I multiplied the inside and outside of the square root by 2 (not sure why this is). Our wind tunnel #'s drift a lot, so I was happy with the output.
Hi guys,
I want to work with This air speed sensor with MSP432 (TI) board. I am not Programmer. Can anyone provide me sketch file for the sensor for arduino. As I know, Arduino sketch file is compatible with my board.
I have read your whole conversation. I think it will me a lot