6
\$\begingroup\$

I have a Honeywell ASDXRRX100PD2A5 I2C Pressure Sensor that I want to read using an Arduino.

Looking at the datasheet, I know that the I2C address is 0x28, and I have had a play with bits of code I've found on the internet, but none of them make any sense. Numbers do increase as I increase the pressure, but not on the scale shown on the datasheet.

Here is a link to said datasheet: http://www.farnell.com/datasheets/1676926.pdf

Here is a datasheet that has information about communicating with Honeywell sensors using I2C: http://sensing.honeywell.com/index.php/ci_id/45841/la_id/1/document/1/re_id/0

Without having much experience with I2C in the past it's hard for my to get my head around it.

Also, here is a picture of my setup:

My setup

The code I am using to test it out at the moment is as follows:

#include<Wire.h>
#define sensor 0x28 //Unique bus address 

void setup()
{ 
  Wire.begin();//Wakes up I2C bus 
  Serial.begin(9600);
}

void getdata(byte *a, byte *b)
{
  //Move register pointer back to first register
  //Wire.beginTransmission(sensor);
  //Wire.write(1);
  //Wire.endTransmission();
  Wire.requestFrom(sensor,2);//Sends content of first two registers
  *a = Wire.read(); //first byte recieved stored here
  *b = Wire.read(); //second byte recieved stored here
}

void showdata()
{
  byte aa,bb;
  float pressure =0;
  getdata(&aa,&bb);
  Serial.print("byte 1: ");Serial.println(aa,DEC);
  Serial.print("byte 2 ");Serial.println(bb,DEC);
 delay(1000);

}

void loop()
{
  showdata();
}

I am getting the following results at the following pressures:

0psi    byte1: 31
        byte2: 246

10psi   byte1: 34
        byte2: 102

20psi   byte1: 32
        byte2: 30

30psi   byte1: 39
        byte2: 167

Any help pointing me in the right direction would be much appreciated.

\$\endgroup\$
  • \$\begingroup\$ 100PD pressure type is not present in given datasheet. It might be different. can you check again \$\endgroup\$ – Umar Jul 22 '15 at 13:39
  • \$\begingroup\$ I have also noticed that, but I'm guessing it just an example, as the model I have is 100psi. Here is the exact sensor I purchased from Element14: uk.farnell.com/honeywell-s-c/asdxrrx100pd2a5/… \$\endgroup\$ – JosephFTaylor Jul 22 '15 at 13:41
  • \$\begingroup\$ How is the I2c software protocol? Is it just a single read of that particular address (0x28)? Do you have mapping table for i2c values and actual pressure? \$\endgroup\$ – Umar Jul 22 '15 at 13:50
  • \$\begingroup\$ On page 4 of the datasheet, Table 6 shows the sensor output at significant percentages. I'm looking to be able to read something along the lines of this. \$\endgroup\$ – JosephFTaylor Jul 22 '15 at 13:53
  • \$\begingroup\$ What scale do the numbers follow, and is it linear? Perhaps you could post some examples of what you get at varying pressures. \$\endgroup\$ – CharlieHanson Jul 22 '15 at 14:09
4
\$\begingroup\$

What's wrong?

Sensor is differential, up to 100psi.
so \$P_{min}\$ is -100psi, \$P_{max}\$ is +100psi.
Total 14 bit (from 0 to 214-1),
\$P_{min}\$ is at 10%, so \$OUTPUT_{min}\$ is 1638
\$P_{max}\$ is at 90%, so \$OUTPUT_{max}\$ is 14745

from datasheet: $$ P=\dfrac{(OUTPUT - OUTPUT_{min}) \cdot (P_{max} - P_{min})} {OUTPUT_{max} - OUTPUT_{min}} + OUTPUT_{min}$$

  • your first \$OUTPUT\$ value is \$(31 \cdot 256) + 246 = 8182\$
    according to datasheet pressure is:
    $$\dfrac{(8182 - 1638) \cdot (100 - (-100))}{14745 - 1638} - 100 \approx -0.14496071$$
  • your second value is \$(34 \cdot 256) + 102 = 8806\$
    $$ \dfrac{(8806 - 1638) \cdot (100 - (-100))} {14745 - 1638} - 100 \approx 9.376669$$
    precision is not so good, but it is still acceptable
  • third value: \$(32 \cdot 256) + 30 = 8222\$
    $$\dfrac{(8222 - 1638) \cdot (100 - (-100))} {14745 - 1638} - 100 \approx 0.46540017$$
    something goes wrong, it isn't like 20psi, it is like 0psi.
  • fourth value: \$(39 \cdot 256) + 167 = 10151\$
    $$ \dfrac{(10151 - 1638) \cdot (100 - (-100))} {14745 - 1638} - 100 \approx 29.900053$$
\$\endgroup\$
  • \$\begingroup\$ I did a pretty extensive edit in your post to format the expressions using LaTeX (MathJaX) style. Would you please check for errors? Thanks! Also, is the 2nd reference really to \$OUTPUT_{min}\$ or to \$OUTPUT_{max}\$? \$\endgroup\$ – Ricardo Nov 5 '15 at 10:40
  • 1
    \$\begingroup\$ Thanks a lot. It was my first reply, I'll use formatting next time. \$\endgroup\$ – edo1 Nov 6 '15 at 13:46
2
\$\begingroup\$

You probably need to add pull-up resistors to the I2C clock and data lines. The datasheet says that \$1\ \mathrm{k\Omega}\$ is the minimum, so maybe try \$2.2\ \mathrm {k\Omega}\$. The resistors should go from the pins to the +5V supply.

\$\endgroup\$
  • \$\begingroup\$ I have since added these resistors and I am still having trouble understanding the data. \$\endgroup\$ – JosephFTaylor Jul 23 '15 at 8:50
1
\$\begingroup\$

i have the ASDXRRX010ND2A5 differential sensor with I2C interface. It gives you 2 bytes of data which you need to combine to get the output.

This is my test code it gives an output around 8190 when no pressure is applied. According to the datasheet the output value is the difference between the 2 ports.

    //Sensor ASDXRRX010ND2A5

#include <Wire.h>

float a, b, Output, Pressure;
const long OutMax = 14745, OutMin = 1638;
const long PressureMax = 10, PressureMin = -10; //Inches of H20

void setup() {
  Wire.begin(0x28);

  Serial.begin(9600);
}

void loop() {
  Wire.requestFrom(0x28, 2);
   a = Wire.read();
   b = Wire.read();
  Output = BitShiftCombine(a , b);

  Pressure = (((Output - OutMin) * (PressureMax - PressureMin)) / (OutMax - OutMin)) + PressureMin;

  Serial.println(Pressure); //Inches of H20
  delay(100);

}

long BitShiftCombine( unsigned char x_high, unsigned char x_low)
{
  long combined;
  combined = x_high;              //send x_high to rightmost 8 bits
  combined = combined << 8;       //shift x_high over to leftmost 8 bits
  combined |= x_low;              //logical OR keeps x_high intact in combined and fills in rightmost 8 bits
  return combined;
}
\$\endgroup\$
0
\$\begingroup\$

I can't really get head or tail on this. Particularly the 20 PSI value looks suspicious, as it is lower than the value at 10 PSI. Sure it isn't 37?

Any, this is a differential measurement, so I suspect that 32, 0 is the half of the scale, 63, 255 being to top (the max scale is 63*256+255 = 16383 (or 3FFFh)).

So, each value you measure, you should subtract 32*256 = 8192.

The 0 PSI value is 32, 246, the complete value is 8438, so the pressure (still decimal) would be 8438 - 8192 = 246. With the max scale (each side of 8192) corresponding 8192, this would be 246/8192 = 3.0066 PSI. Residual pressure? Or should it be 31, 246?

The 30 PSI value 39, 167, is really 10151, then 10151-8192=1959. This is 1959/8182 of 100PSI, so 23.9 PSI.

The 10 PSI value 34, 102, is really 8806, then 8806-8192=614. This results in 614/8192 of 100PSI = 7.5 PSI

Hypothetically, if the first number for 20PSI were 37, the number would be 9502, or 9502-8192= 1320 positive, or 1320/8192 of 100PSI = 16PSI

Could this be a good explanation?

Here's a screenshot of a spreadsheet:

enter image description here

Mmmm. 0PSI is way off. Maybe the value was 31, 246? That gives:

enter image description here

Which makes me suspect that maybe you should read several times till two consecutive values coincide? Note that it is unlikely that you mistake 31 and 32 because of a pull-up resistor or so. 31 are 5 consecutive ones, while 32 is just one one [;-)]. Also, the 0PSI value is really outside of the calibration range of the manufacturer, which ranges from 10 to 90%.

Edit: I doubt you are having read errors (though, of course, I can't exclude the possibility). To evaluate that, I suggest you try doing, say 100 measurements in the same conditions - i.e. same pressure. Easiest would be just at 0 PSI. Try doing the test without pause, then with 100ms intervals or so. Look for jumps larger than 1 in the combined b1 and b2 (i.e. in the number b1*256 + b2.

\$\endgroup\$
  • \$\begingroup\$ I have tried other bits of code with different results, so could it be that the code I am using is reading incorrectly from the sensor? \$\endgroup\$ – JosephFTaylor Jul 23 '15 at 8:03
  • \$\begingroup\$ I have found this datasheet that refers to I2C communication with Honeywell sensors. I will add it to the main question: sensing.honeywell.com/index.php/ci_id/45841/la_id/1/document/1/… \$\endgroup\$ – JosephFTaylor Jul 23 '15 at 8:27
  • \$\begingroup\$ I added a suggestion for a reliability test to the answer. \$\endgroup\$ – jcoppens Jul 23 '15 at 13:35
  • \$\begingroup\$ Also, the calculations from the application confirm my calculations, with the difference that I subtracted the offset at readout, while the datasheet proposes to do it at pressure value. \$\endgroup\$ – jcoppens Jul 23 '15 at 13:40
  • \$\begingroup\$ I have since increased the amount of bytes that are read. It seems that byte 15 is 4 per psi, so 10 psi would show as 40, 20 psi would show as 80. It seems to be the only byte that I've recognised as a consistent reading. But it only goes up to 255, which is 63.75 psi. Thanks for your help so far by the way \$\endgroup\$ – JosephFTaylor Jul 23 '15 at 13:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.