Arduino Due I2C honeywell pressure sensors

Hey everyone I got some Honeywell sensors one HSC differential and another SSC absolute type. I found some code here Commits · rodan/honeywell_hsc_ssc_i2c · GitHub

I was able to get it working but had to change a few things.
I changed min/max values and at the bottom I removed
//dtostrf(p, 2, 2, p_str);
// dtostrf(t, 2, 2, t_str);
And changed " p_str and t_str " to p and t

It is triggering a diagnostic fault 11 with the absolute sensor. (in the pdf it suggests either "Loss of sense element connection" or "Short circuit of sense element" ?? But seems to be outputting correct. or at least close to correct values.

But reading status 0 with the differential sensor meaning everything is working.

Here is the link to the i2c communications pdf for these sensors. http://sensing.honeywell.com/i2c%20comms%20digital%20output%20pressure%20sensors_tn_008201-3-en_final_30may12.pdf

I dont really know what im doing and would like to clean up the code if possible. Would appreciate any advice. Hope this is helpful to anyone else who needs it.

#include <Wire.h>
#include "hsc_ssc_i2c.h"

// see hsc_ssc_i2c.h for a description of these values
// these defaults are valid for the HSCMRNN030PA2A3 chip
#define SLAVE_ADDR 0x78
#define OUTPUT_MIN 1638        // 1638 counts (10% of 2^14 counts or 0x0666)
#define OUTPUT_MAX 14745       // 14745 counts (90% of 2^14 counts or 0x3999)
#define PRESSURE_MIN 0.0        // min is 0 for sensors that give absolute values
#define PRESSURE_MAX 1.6   // 1.6bar (I want results in bar for now)

uint32_t prev = 0; 
const uint32_t interval = 5000;

void setup()
{
    Serial.begin(9600);
    Wire.begin();
}

void loop()
{
    unsigned long now = millis();
    struct cs_raw ps;
    char p_str[10], t_str[10];
    uint8_t el;
    float p, t;
    if ((now - prev > interval) && (Serial.available() <= 0)) {
        prev = now;
        el = ps_get_raw(SLAVE_ADDR, &ps);
        // for some reason my chip triggers a diagnostic fault
        // on 50% of powerups without a notable impact 
        // to the output values.
        if ( el == 4 ) {
            Serial.println("err sensor missing");
        } else {
            if ( el == 3 ) {
                Serial.print("err diagnostic fault "); //When the two status bits are “11”, one of the above mentioned diagnostic faults is indicated.
                Serial.println(ps.status, BIN);
            }
            if ( el == 2 ) {
                // if data has already been feched since the last
                // measurement cycle
                Serial.print("warn stale data ");
                Serial.println(ps.status, BIN);
            }
            if ( el == 1 ) {
                // chip in command mode
                // *Command mode is used for programming the sensor. This mode should not be seen during normal operation.
                Serial.print("warn command mode ");
                Serial.println(ps.status, BIN);
            }
            Serial.print("status      ");
            Serial.println(ps.status, BIN);
            Serial.print("bridge_data ");
            Serial.println(ps.bridge_data, DEC);
            Serial.print("temp_data   ");
            Serial.println(ps.temperature_data, DEC);
            Serial.println("");
            ps_convert(ps, &p, &t, OUTPUT_MIN, OUTPUT_MAX, PRESSURE_MIN,
                   PRESSURE_MAX);
            // floats cannot be easily printed out
            //dtostrf(p, 2, 2, p_str);
           // dtostrf(t, 2, 2, t_str);
            Serial.print("pressure    (BAR) ");
            Serial.println(p);
            Serial.print("temperature (C) ");
            Serial.println(t);
            Serial.println("");
        }
    }
}

Hi,
I am having similar issues with a HSC pressure transducer. Did you ever get your code to work? where did you find the hsc_ssc_i2c.h file? Thanks

Hello, yes I got both of my sensors working together and got rid of the confusing includes and removed a bunch of code.

I still receive a diagnostic error code on one of my sensors that suggests, "In the event that any EEPROM contents change after calibration, a diagnostic condition will be flagged." And I have no idea how to recalibrate the sensor.

But they seem to work pretty good! Although I'm wondering if the internal temperature readings of all the sensors should match?

Here's the new code im using.

#include "Wire.h"
#include <Arduino.h>

#define HSCDRRN400MD2A3_I2C 0x28 // each I2C object has a unique bus address, the DS1307 is 0x68
#define OUTPUT_MIN 1638.4        // 1638 counts (10% of 2^14 counts or 0x0666)
#define OUTPUT_MAX 14745.6       // 14745 counts (90% of 2^14 counts or 0x3999)
#define PRESSURE_MIN -400        // min is 0 for sensors that give absolute values
#define PRESSURE_MAX 400   // 1.6bar (I want results in bar)




void setup()
{
  Wire.begin(); // wake up I2C bus
  delay (500);
  Serial.begin(9600);
}
 
 
 
void loop()
{
  float pressure, temperature;
  //send a request
Wire.beginTransmission(HSCDRRN400MD2A3_I2C); // "Hey, CN75 @ 0x48! Message for you"
Wire.write(1);  // send a bit asking for register one, the data register (as specified by the pdf)
Wire.endTransmission(); // "Thanks, goodbye..."
// now get the data from the sensor
delay (20);

Wire.requestFrom(HSCDRRN400MD2A3_I2C, 4);
while(Wire.available() == 0);
byte a     = Wire.read(); // first received byte stored here ....Example bytes one: 00011001 10000000
byte b     = Wire.read(); // second received byte stored here ....Example bytes two: 11100111 00000000
byte c     = Wire.read(); // third received byte stored here
byte d     = Wire.read(); // fourth received byte stored here

// Serial.println(a, BIN);
  //Serial.println(b, BIN);
   // Serial.println(c, BIN);
    // Serial.println(d, BIN);

  byte status1 = (a & 0xc0) >> 6;  // first 2 bits from first byte
 //Serial.println(status1, BIN);

 int bridge_data = ((a & 0x3f) << 8) + b;
    int temperature_data = ((c << 8) + (d & 0xe0)) >> 5;

            if ( temperature_data == 65535 ) {
                Serial.println("err HSCDRRN400MD2A3 sensor missing");
            }
            
            if ( status1 == 1 ) {
                Serial.println("warn command mode ");// *Command mode is used for programming the sensor. This mode should not be seen during normal operation.
               // Serial.println(status, BIN);   
            }
            
            if ( status1 == 2 ) {    
                Serial.println("warn stale data ");  // if data has already been feched since the last measurement cycle
               // Serial.println(status, BIN);
            }   
            
            if ( status1 == 3) {
                Serial.println("err diagnostic fault "); //When the two status bits are “11”, one of the above mentioned diagnostic faults is indicated.
               // Serial.println(status, BIN);
            }


    pressure = 1.0 * (bridge_data - OUTPUT_MIN) * (PRESSURE_MAX - PRESSURE_MIN) / (OUTPUT_MAX - OUTPUT_MIN) + PRESSURE_MIN;
    temperature = (temperature_data * 0.0977) - 50;

     
    
            Serial.print("status      ");
            Serial.println(status1, BIN);
            Serial.print("bridge_data ");
            Serial.println(bridge_data, DEC);
            Serial.print("temp_data   ");
            Serial.println(temperature_data, DEC);
            Serial.println("");

            Serial.print("pressure    (BAR) ");
            Serial.println(pressure);
            Serial.print("temperature (C) ");
            Serial.println(temperature);
            Serial.println("");
            
            delay (500);
}

Hi All,

I took the code from above post and modified it slightly, it appears to work apart from the reading appears unstable, below is the modified code. The parts I have modified have "//<<<<<<<<<<<<<<< Modified" as comments, Also I am using the HSDRRN005PD3 with a voltage at VCC pin of 4.67

#include "Wire.h"
#include <Arduino.h>
#include <EEPROM.h>


#define HSCDRRN400MD2A3_I2C 0x28 // each I2C object has a unique bus address, the DS1307 is 0x68
#define OUTPUT_MIN 1638.4        // 1638 counts (10% of 2^14 counts or 0x0666)
#define OUTPUT_MAX 14745.6       // 14745 counts (90% of 2^14 counts or 0x3999)
#define PRESSURE_MIN -344.738        // min is 0 for sensors that give absolute values  //<<<<<<<<<<<<<<<<<<<<<<  Modified
#define PRESSURE_MAX 344.738   // 1.6bar (I want results in bar)  //<<<<<<<<<<<<<<<<<<<<<<  Modified


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


void loop()
{
 float pressure, temperature;
 //send a request

    Wire.beginTransmission(HSCDRRN400MD2A3_I2C); // "Hey, CN75 @ 0x48! Message for you"
    Wire.write(1);  // send a bit asking for register one, the data register (as specified by the pdf)
    Wire.endTransmission(); // "Thanks, goodbye..."
    // now get the data from the sensor
  
    delay (20);

    Wire.requestFrom(HSCDRRN400MD2A3_I2C, 4);
    while(Wire.available() == 0);
    byte a     = Wire.read(); // first received byte stored here ....Example bytes one: 00011001 10000000
    byte b     = Wire.read(); // second received byte stored here ....Example bytes two: 11100111 00000000
    byte c     = Wire.read(); // third received byte stored here
    byte d     = Wire.read(); // fourth received byte stored here
    byte status1 = (a & 0xc0) >> 6;  // first 2 bits from first byte
    int bridge_data = ((a & 0x3f) << 8) + b;
  

   int temperature_data = ((c << 8) + (d & 0xe0)) >> 5;

           if ( temperature_data == 65535 ) {
               Serial.println("err HSCDRRN400MD2A3 sensor missing");
           }
           
           if ( status1 == 1 ) {
               Serial.println("warn command mode ");// *Command mode is used for programming the sensor. This mode should not be seen during normal operation.
              // Serial.println(status, BIN);   
           }
           
           if ( status1 == 2 ) {    
               Serial.println("warn stale data ");  // if data has already been feched since the last measurement cycle
              // Serial.println(status, BIN);
           }   
           
           if ( status1 == 3) {
               Serial.println("err diagnostic fault "); //When the two status bits are "11", one of the above mentioned diagnostic faults is indicated.
              // Serial.println(status, BIN);
           }


          pressure = 1.0 * (bridge_data - OUTPUT_MIN) * (PRESSURE_MAX - PRESSURE_MIN) / (OUTPUT_MAX - OUTPUT_MIN) + PRESSURE_MIN;
          pressure = pressure - 0.4;   //<<<<<<<<<<<<<<<<<<<<<<  Modified
          temperature = (temperature_data * 0.0977) - 50; 

    
   
           Serial.print("status      ");
           Serial.println(status1, BIN);
           Serial.print("bridge_data ");
           Serial.println(bridge_data, DEC);
           Serial.print("temp_data   ");
           Serial.println(temperature_data, DEC);
           Serial.println("");

           Serial.print("pressure    (BAR) ");
           Serial.println(pressure);
           Serial.print("temperature (C) ");
           Serial.println(temperature);
           Serial.println("");
           
           delay (500);
}

Now here is a typical output

pressure    (BAR) -0.03
temperature (C) 23.28

status      0
bridge_data 8196
temp_data   750

pressure    (BAR) -0.19
temperature (C) 23.28

status      0
bridge_data 8196
temp_data   750

pressure    (BAR) -0.19
temperature (C) 23.28

status      0
bridge_data 8199
temp_data   750

pressure    (BAR) -0.03
temperature (C) 23.28

status      0
bridge_data 8199
temp_data   750

pressure    (BAR) -0.03
temperature (C) 23.28

status      0
bridge_data 8199
temp_data   750

pressure    (BAR) -0.03
temperature (C) 23.28

As you can see it wonders between -0.19 and -0.03 sometimes a lot more than this, is the correct or is the code somehow wrong? Also I would expect it to be zero when no pressure is applied :frowning:

Steve