Analyzing I2C signals

arduino uno I2C logic analyzer saleae Si7021

View the decoded I2C signal from the graph produced by Saleae to read temperature from an Si7021 breakout board.

Capture the signal in Saleae:

All signals

Add asynchronous serial to decode the captured signal:

Decoded I2C signal

MS Byte for temperature is 0x6D and LS Byte for temperature is 0xAC which is 0x6DAC in hexadecimal and 28076 in decimal. Using the equation given in the datasheet, the temperature in Celcius is 28076*175.72 / 65536 - 46.85 = 28, 28 C, which is same as what is shown in the serial monitor.

Code

Download code
#include "Adafruit_Si7021.h"

Adafruit_Si7021 sensor = Adafruit_Si7021();

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

  if (!sensor.begin()) {
    Serial.println("Did not find Si7021 sensor!");
    while (true) {}
  }

  delay(1000);
}

void loop() {
  Serial.println(sensor.readTemperature());
  delay(2000);
}

Schematic

Wire up the hardware accordingly

Analyzing I2C signals schematic

References