Hello,
I'm connecting the sensor through I2C - I can read correct data frame if it's awake all the time.
What sequence is required in this case? This code, for example, does not work - received frame has invalid data (even if I keep reading them for some time):
#define RRH62000_I2C_SDA D1 #define RRH62000_I2C_SCL D2 #define RRH62000_I2C_ADDR 0x69 #define RRH62000_I2C_FRAME_BYTES 37 void setup() { ... Wire.begin(RRH62000_I2C_SDA, RRH62000_I2C_SCL, RRH62000_I2C_ADDR); ... } void loop() { Wire.beginTransmission(RRH62000_I2C_ADDR); Wire.write(0x50); Wire.write(0x80); // WAKE-UP Wire.endTransmission(); delay(1000); // wait some time unsigned char index = 0; Wire.requestFrom(RRH62000_I2C_ADDR, RRH62000_I2C_FRAME_BYTES); while(Wire.available()) { RRH62000_Frame[index] = Wire.read(); index++; } RRH62000_Frame_Temperature = ((RRH62000_Frame[24] << 8) | RRH62000_Frame[25]) * 0.01; ... Wire.beginTransmission(RRH62000_I2C_ADDR); Wire.write(0x50); Wire.write(0); // SLEEP Wire.endTransmission(); delay(1000); // wait some time }
The result:
RRH62000 Frame: 0:FF 1:FF 2:A 3:3 4:E8 5:3 6:E8 7:FF 8:FF 9:4E 10:C0 11:A 12:19 13:17 14:A6 15:A6 16:A6 17:A6 18:A6 19:A6 20:A6 21:A6 22:A6 23:A6 24:A6 25:A6 26:A6 27:A6 28:A6 29:A6 30:A6 31:A6 32:A6 33:A6 34:A6 35:A6 36:A6
Without sleep/wake-up I get the following:
RRH62000 Frame: 0:0 1:0 2:0 3:A6 4:0 5:39 6:0 7:E 8:0 9:1 10:0 11:0 12:0 13:1C 14:0 15:75 16:0 17:BA 18:0 19:3C 20:0 21:3F 22:0 23:3F 24:9 25:F1 26:19 27:A1 28:0 29:2 30:1 31:90 32:0 33:64 34:0 35:0 36:45 Temperature:25.5C Humidity:65.6% PM1:2.8ug/m3 PM2.5:11.7ug/m3 PM10:18.6ug/m3 TVOC:20ug/m3 eCO2:400ppm
Next question, do you have a C code for generating the CRC checksum?
Thank you very much!