Trouble with Honeywell ASDX Series Pressure Sensor

I’m working on a project using a Honeywell ASDXAVX015PG7A5 Pressure Sensor hooked onto the I2C bus. The bus address in hex that the datasheet says to use is 0x78, but I do not get any data from this address, so I did a quick scan to find that the device was on 0x4E.

When I read the first two bytes of the data from the sensor, I get the value 10000000 for byte 1 and 0 for byte 2. According to the data sheet, the two first bytes determine the status, and in my case it reveals that the data is ‘stale’ which means that they haven’t been updated since the last time I called for it. Also, if I let the program run for a while, it gets random fluctuations where the first and second byte both take on the value 11111111, which according to the datasheet means that there is a diagnostic condition. So clearly the data that I am receiving is not the actual pressure reading. If anyone can shed some insight as to how I can get the actual reading out of the sensor it would be very helpful.

I am connected as follows:

  • pin 1(SDA) to A4 on Arduino Uno
  • pin 2(SCL) to A5 on Arduino Uno
  • pin 3(Ground) to GND on Arduino Uno
  • pin 6(Vcc) to 5V on Arduino Uno

Here are the technical notes that I am referring to:

And here is the code that I have been using:

#include<Wire.h>
#define sensor 0x4E //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,3);//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,BIN);
Serial.print("byte 2 ");Serial.println(bb,BIN);
delay(1000);
}

void loop()
{
showdata();
}

Any help that you guys can provide me with would be greatly appreciated.

  • Dave

Hi, I have also just started playing with these sensors (and ardunio for that matter) and am finding exactly the same issue. I am wondering if it is due to the way the wire library handles addressing? When you refer to the Honeywell data sheet it shows that the sensors do indeed use a 7 bit address as per the library however the sensor also reqiures the LSB to be set to enable read mode (From data sheet for 2 byte read);

[Start][A6|A5|A4|A3|A2|A1|A0|1][ACK][S1|S0|B13|...|B8][ACK][B7|...|B0][NACK][STOP]

ie. the address is 0x78 (or decimal 120) however to enable read mode the address should be 0x79 where the LSB is removed by the library as it ignores any 8 bit addresses.

I have found this library http://code.google.com/p/arduino-ssc/ but have yet to see how relevant it is to this series of transducers. Will keep you posted if I find anything else. :)

Thanks for the help, I will look into the SSC library and see if I find anything relevant to these sensors. I will keep you posted if I find any other solutions as well.

Wire.requestFrom(sensor,3);//Sends content of first two registers
*a = Wire.read(); //first byte recieved stored here
*b = Wire.read(); //second byte recieved stored here//Sends content of first two registers

Looks like you request three bytes and then you read two bytes leaving one in the buffer for the next read.

I modified my code in the following manner and I am still getting the status bits as 10, meaning that the data is 'stale':

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

Thanks, any other suggestions would be greatly appreciated.

Wire.beginTransmission(sensor); Wire.write(1); Wire.endTransmission();

I don't think that this is needed (perhaps even bad). According to the data sheet, to read the sensor you just send the address and request 2,3 or 4 bytes. I don't see where you need to select a register to read or set anything to 1 to specify a read.

Thank you! I excluded this part of my code and my output seems to be fluctuating less. I also combined the two bytes into one and then used the equation in the technical notes, labeled “I2C Communication with Honeywell Digital Output Pressure Sensors” on page 3, to get the pressure from the count number. The output that I am getting shows that the status bytes are still “11”, which means that there is a diagnostic condition. But I seem to be getting the correct pressure reading, 0psi, since I am using a Gage sensor and it is only influenced by atmospheric pressure at the moment. So it seems to be working, but I don’t want to bank on a whim, is there any test I can do to make sure that it is functioning properly?

Here is my code:

#include<Wire.h>
#define sensor 0x4E //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,BIN);
Serial.print("byte 2 ");Serial.println(bb,BIN);
unsigned int c = aa*256+bb;//combines byte 1 and byte 2
Serial.print("Combined byte: ");Serial.println(c,BIN);
Serial.print("Count #: ");Serial.println(c,DEC);
pressure= ((c-1638)*15)/(14746-1638);// Conversion found from technical notes.
Serial.print(“Pressure: “);Serial.print(pressure);Serial.println(” psi”);
delay(1000);

}

void loop()
{
showdata();
}

Hook up a piece of tubing and blow into it. You can generate a couple psi from that. Maybe read three bytes and see if the temperature byte makes sense. I don't see anything in the docs to say how to get it in or out of diagnostic or command mode.

EDIT If the sensor is in diagnostic mode the fourth byte is largely don't care so not valid. I wonder if writing to it caused it to flag diagnostic mode?

In the event that any EEPROM contents change after calibration, a diagnostic condition will be flagged

So I hooked up a syringe to a piece of tubing and increased the pressure to a max of 4 psi. Here is my output:

byte 1: 110 byte 2 1110101 Combined byte: 11001110101 Count #: 1653 Pressure: 0.00 psi byte 1: 110 byte 2 1110101 Combined byte: 11001110101 Count #: 1653 Pressure: 0.00 psi byte 1: 110 byte 2 1111000 Combined byte: 11001111000 Count #: 1656 Pressure: 0.00 psi byte 1: 110 byte 2 1111100 Combined byte: 11001111100 Count #: 1660 Pressure: 0.00 psi byte 1: 110 byte 2 1110101 Combined byte: 11001110101 Count #: 1653 Pressure: 0.00 psi byte 1: 110 byte 2 1110101 Combined byte: 11001110101 Count #: 1653 Pressure: 0.00 psi byte 1: 110 byte 2 1111100 Combined byte: 11001111100 Count #: 1660 Pressure: 0.00 psi byte 1: 110 byte 2 1111000 Combined byte: 11001111000 Count #: 1656 Pressure: 0.00 psi byte 1: 110 byte 2 1111000 Combined byte: 11001111000 Count #: 1656 Pressure: 0.00 psi byte 1: 110 byte 2 1111100 Combined byte: 11001111100 Count #: 1660 Pressure: 0.00 psi byte 1: 110 byte 2 1111100 Combined byte: 11001111100 Count #: 1660 Pressure: 0.00 psi byte 1: 110 byte 2 1111100 Combined byte: 11001111100 Count #: 1660 Pressure: 0.00 psi byte 1: 11001 byte 2 1100010 Combined byte: 1100101100010 Count #: 6498 Pressure: 0.00 psi byte 1: 100000 byte 2 11001100 Combined byte: 10000011001100 Count #: 8396 Pressure: 2.00 psi byte 1: 11110 byte 2 110001 Combined byte: 1111000110001 Count #: 7729 Pressure: 1.00 psi byte 1: 11101 byte 2 1000 Combined byte: 1110100001000 Count #: 7432 Pressure: 1.00 psi byte 1: 11101 byte 2 1010000 Combined byte: 1110101010000 Count #: 7504 Pressure: 1.00 psi byte 1: 100000 byte 2 1100100 Combined byte: 10000001100100 Count #: 8292 Pressure: 2.00 psi byte 1: 110110 byte 2 10001001 Combined byte: 11011010001001 Count #: 13961 Pressure: 4.00 psi byte 1: 101000 byte 2 11101010 Combined byte: 10100011101010 Count #: 10474 Pressure: 0.00 psi byte 1: 100101 byte 2 10100011 Combined byte: 10010110100011 Count #: 9635 Pressure: 4.00 psi byte 1: 100101 byte 2 11000010 Combined byte: 10010111000010 Count #: 9666 Pressure: 4.00 psi byte 1: 100011 byte 2 11011010 Combined byte: 10001111011010 Count #: 9178 Pressure: 3.00 psi byte 1: 100011 byte 2 10011010 Combined byte: 10001110011010 Count #: 9114 Pressure: 3.00 psi byte 1: 11111 byte 2 111001 Combined byte: 1111100111001 Count #: 7993 Pressure: 2.00 psi byte 1: 10011 byte 2 11000110 Combined byte: 1001111000110 Count #: 5062 Pressure: 3.00 psi byte 1: 1000 byte 2 11011100 Combined byte: 100011011100 Count #: 2268 Pressure: 0.00 psi byte 1: 10 byte 2 11010 Combined byte: 1000011010 Count #: 538 Pressure: 3.00 psi byte 1: 0 byte 2 0 Combined byte: 0 Count #: 0 Pressure: 3.00 psi byte 1: 0 byte 2 0 Combined byte: 0 Count #: 0 Pressure: 3.00 psi byte 1: 0 byte 2 0 Combined byte: 0 Count #: 0 Pressure: 3.00 psi byte 1: 1 byte 2 1010100 Combined byte: 101010100 Count #: 340 Pressure: 3.00 psi byte 1: 11111 byte 2 11 Combined byte: 1111100000011 Count #: 7939 Pressure: 2.00 psi byte 1: 100101 byte 2 1100000 Combined byte: 10010101100000 Count #: 9568 Pressure: 4.00 psi byte 1: 100110 byte 2 11001 Combined byte: 10011000011001 Count #: 9753 Pressure: 4.00 psi byte 1: 100101 byte 2 1000011 Combined byte: 10010101000011 Count #: 9539 Pressure: 4.00 psi byte 1: 100101 byte 2 10100 Combined byte: 10010100010100 Count #: 9492 Pressure: 3.00 psi byte 1: 100100 byte 2 11100010 Combined byte: 10010011100010 Count #: 9442 Pressure: 3.00 psi byte 1: 110101 byte 2 10000 Combined byte: 11010100010000 Count #: 13584 Pressure: 3.00 psi byte 1: 111101 byte 2 10110 Combined byte: 11110100010110 Count #: 15638 Pressure: 1.00 psi byte 1: 11110 byte 2 10000111 Combined byte: 1111010000111 Count #: 7815 Pressure: 2.00 psi byte 1: 1001 byte 2 11011110 Combined byte: 100111011110 Count #: 2526 Pressure: 1.00 psi byte 1: 110 byte 2 1111000 Combined byte: 11001111000 Count #: 1656 Pressure: 0.00 psi byte 1: 110 byte 2 1111100 Combined byte: 11001111100 Count #: 1660 Pressure: 0.00 psi byte 1: 110 byte 2 1111000 Combined byte: 11001111000 Count #: 1656 Pressure: 0.00 psi byte 1: 110 byte 2 1110101 Combined byte: 11001110101 Count #: 1653 Pressure: 0.00 psi

Where it is 0 psi for a good amount of time is when I disconnect the syringe and have it acted upon by only atmospheric pressure. When I increase the pressure using the syringe, it seems to be almost constant but has a bit of fluctuation. According to the status bits, I am still reading 'stale data'. I think the code itself should work, but according to the technical notes the status bits becomes "10" when "the master polls data quicker than the sensor can update its output buffer". So, maybe we could slow down the rate that the master polls the data? But this still would not fix that diagnostic condition problem since I am still getting "11" for my status bits every now and then.

And how could the EEPROM contents have changed after calibration? That seems strange to me. And is there anyway that I can reset them to their original calibration?

The data sheet has

Calibrated output values for pressure are updated at approximately 1 kHz.

The time to do the serial prints should be long enough to allow for that but you can try a longer time between sampling. What sample rate do you require? I was guessing as to the cause of diagnostic mode. It seems to go in and out of diagnostic on its own.

Have you tried to read the temperature (third byte)?

I ended up getting the sensor working with pretty good accuracy, I just modified the code slightly, so it reads decimal pressures as well, instead of just integer values. I never did really find out how to get it out of diagnostic mode since the first two bits are still “11”, but the reading is accurate when I used a pump to push pressurized air through the sensor, so that was all I needed in the first place.

Here is the code for anyone with this sensor who has had the same problem:

#include<Wire.h>
#define sensor 0x4E //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,BIN);
Serial.print("byte 2 ");Serial.println(bb,BIN);
float c = aa*256+bb;//combines byte 1 and byte 2
Serial.print("Combined byte: ");Serial.println(c,BIN);
Serial.print("Count #: ");Serial.println(c);
pressure= ((c-1638)*15)/(14745-1638);// Conversion found from technical notes.
Serial.print(“Pressure: “);Serial.print(pressure,DEC);Serial.println(” psi”);
delay(1000);

}

void loop()
{
showdata();
}

Thanks for all of your help groundfungus! It was greatly appreciated.

I am glad to be of help.