I bought that Amphenol ELVH-L04D-HRRD-I-N2A5 differential pressure sensor, and got it connected via I2C. It's working for the most part. I think I was able to get the correct data out of the 4 bytes that can be read out of it.
Here's my sketch programming code for reading the 4 bytes and creating the values for pressure and temperature. I know there's lots of examples on here with "bit shift" left and right, but I just did something that was easier for me to understand.
if (Wire.requestFrom(0x28, 4) == 4)
{
data[0] = Wire.read();
data[1] = Wire.read();
data[2] = Wire.read();
data[3] = Wire.read();
for (indx = 0; indx < 16; indx++)
{
int_array[indx] = 0;
}
int_array[0] = bitRead(data[1], 0);
int_array[1] = bitRead(data[1], 1);
int_array[2] = bitRead(data[1], 2);
int_array[3] = bitRead(data[1], 3);
int_array[4] = bitRead(data[1], 4);
int_array[5] = bitRead(data[1], 5);
int_array[6] = bitRead(data[1], 6);
int_array[7] = bitRead(data[1], 7);
int_array[8] = bitRead(data[0], 0);
int_array[9] = bitRead(data[0], 1);
int_array[10] = bitRead(data[0], 2);
int_array[11] = bitRead(data[0], 3);
int_array[12] = bitRead(data[0], 4);
int_array[13] = bitRead(data[0], 5);
press = 0.0;
factor = 1.0;
indx = 0;
while (indx < 16)
{
if (int_array[indx] == 1)
{
press += factor;
}
factor = (factor * 2.0);
indx++;
}
// factor = (high - low) / (io_high - io_low)
press_factor = (4.0 - (-4.0))/(16383.0 - 0.0);
// reading = low + (factor * io)
pressin_reading = -4.0 + (press_factor * press);
client.print("<br>DiffPress: ");
client.print(pressin_reading);
pressmm_reading = (pressin_reading * 25.4);
client.print("\" of H2O (");
client.print(pressmm_reading);
client.println("mm of H2O)<br>");
for (indx = 0; indx < 16; indx++)
{
int_array[indx] = 0;
}
int_array[0] = bitRead(data[3], 5);
int_array[1] = bitRead(data[3], 6);
int_array[2] = bitRead(data[3], 7);
int_array[3] = bitRead(data[2], 0);
int_array[4] = bitRead(data[2], 1);
int_array[5] = bitRead(data[2], 2);
int_array[6] = bitRead(data[2], 3);
int_array[7] = bitRead(data[2], 4);
int_array[8] = bitRead(data[2], 5);
int_array[9] = bitRead(data[2], 6);
int_array[10] = bitRead(data[2], 7);
temp = 0.0;
factor = 1.0;
indx = 0;
while (indx < 16)
{
if (int_array[indx] == 1)
{
temp += factor;
}
factor = (factor * 2.0);
indx++;
}
// tempc_reading is calculated with formula from reference manual
tempc_reading = ((temp*(200.0/2047.0))-50.0);
// convert from Celsius to Farenheit ((tempc * 9/5) + 32)
tempf_reading = (tempc_reading * 1.8) + 32.0;
client.print("<br>Temp: ");
client.print(tempf_reading);
client.print(" F (");
client.print(tempc_reading);
client.println(" C)");
}
else
{
client.println("4 bytes were not received");
}
My question is in regards to the temperature. The temperature reading is about 4-5 degrees higher than the AM2302 temperature sensor I just bought, the HVAC thermostat on the wall near my office, and the infrared temperature device I got from the maintenance shop.

Am I scaling the output from the sensor wrong? Is the sensor reading the temperature wrong, and needs to be calibrated with some sort of offset?