Honeywell HIH6131 How to enter command mode?

I'm trying to enter command mode on a HIH6131 humidity sensor, because I want to change the I2C address and the alarm trip points. But no matter what I try, it doesn't seem to work. Does anybody have an idea about what I'm doing wrong?

A test sketch:

#include <Wire.h>



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



void loop()
{
  Serial.print("enter command mode at ");
  Serial.print(millis());
  Serial.println(" ms");
  
  Wire.beginTransmission(0x27);
  Wire.write(uint8_t(0xA0));
  Wire.write(uint8_t(0));
  Wire.write(uint8_t(0));
  Wire.endTransmission();
  
  delay(100);
  
  Serial.print("read 0x18: ");
  
  Wire.beginTransmission(0x27);
  Wire.write(uint8_t(0x18));
  Wire.write(uint8_t(0));
  Wire.write(uint8_t(0));
  Wire.endTransmission();
  
  delay(100);
  
  Wire.requestFrom(uint8_t(0x27), uint8_t(3));
  if(Wire.available()) {
    uint8_t status = Wire.read();
    uint8_t data1 = Wire.read();
    uint8_t data2 = Wire.read();
    Serial.print(status, BIN);
    Serial.print(' ');
    Serial.print(data1, BIN);
    Serial.print(' ');
    Serial.print(data2, BIN);
    Serial.println();
  }
  else Serial.println("no data available");
  
  delay(500000);
}

and it's output:

startup
enter command mode at 0 ms
read 0x18: 00011010 01110100 01100100

Bits 6 and 7 of the first response byte are the status, they are always B00 (normal operation), but they should be B10 (command mode).

See attached data sheet.

Command Mode HumidIcon TN_009062-3-EN_Final_07Jun12.pdf (208 KB)

anyone?

Ok. Finally! I figured it out. I'll describe what I did wrong, and how I resolved this issue. Maybe this can help other people with similar issues...

Apparently when you plug in the arduino the 5V and 3.3V pins will always have 5V (or 3.3V) on them, even if you (or the arduino IDE) reset the arduino. So my "enter command mode" command was sent way too late (it needs to be sent within 3ms of powerup).

I've written a small library to handle this sensor, which is attached to this post. (There's some functions for the SSC pressure sensor I'm using in there too...)

humidity_command.ino (3.3 KB)

honeywell_i2c.h (7.39 KB)

have you seen this thread - http://arduino.cc/forum/index.php/topic,78667.0.html -

it has a lib for the hih sensor

I have now. But the lib I wrote this morning works, so...

I'm planning on adding a few features (when/if I have the time), like member functions to get/set all EEPROM data 'in pieces' (don't know how top say this), like so:

uint16_t HIHxxxx::highAlarmTrigger() const;
bool HIHxxxx::highAlarmPolarity() const;
void HIHxxxx::setHighAlarmTrigger(uint16_t) const;
void HIHxxxx::setHighAlarmPolarity(bool) const;

Maybe I should contact the author, see if we can merge both libraries...

I prefer my approach (using a class) but it might result in a slightly bigger code size, don't really know.

This thread is starting to get a bit chopped up. Anything else, I will post in: http://arduino.cc/forum/index.php/topic,150584.0.html