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)