Master Decode I²C with Saleae Logic Analyzer and Arduino Uno (2025)

Master Decode I²C with Saleae Logic Analyzer and Arduino Uno (2025)

I²C with Saleae Logic Analyzer : I²C (Inter-Integrated Circuit) is a powerful two-wire communication protocol that allows multiple devices—such as sensors, displays, and memory modules—to communicate with a microcontroller like the Arduino using just SDA (Serial Data Line) and SCL (Serial Clock Line).

In this practical guide, you’ll learn how to decode, monitor, and debug I²C communication using the Saleae Logic Analyzer. Whether you’re dealing with an unresponsive OLED display or trying to understand data flow between your Arduino and I²C peripherals, this tutorial will help you visualize I²C signals, interpret data frames, and detect common issues—all with a user-friendly Saleae interface.

Perfect for beginners and embedded developers, this hands-on guide simplifies I²C debugging and gives you the confidence to troubleshoot any I²C-based project

Plan: Simulate I²C Using Arduino + ESP32 + Saleae

What You’ll Do:

  1. Connect Arduino Uno (Master) and ESP32 (Slave) via I²C.
  2. Upload I²C code to both devices.
  3. Monitor SDA and SCL lines with Saleae.
  4. Decode and analyze I²C protocol in the Saleae software.
+------------------+       +-----------------+       +-------------------------+
|    Arduino Uno   |       |     ESP32       |       |   Saleae Logic Analyzer |
|------------------|       |-----------------|       |-------------------------|
| A4 (SDA) --------+------>+ GPIO 21 (SDA)    |------>+ CH0                    |
| A5 (SCL) --------+------>+ GPIO 22 (SCL)    |------>+ CH1                    |
| GND ------------+-------+ GND              |------>+ GND                     |
+------------------+       +-----------------+       +-------------------------+

Code Part 1: Arduino Uno as I²C Master

#include <Wire.h>

void setup() {
  Wire.begin(); // I2C Master
  Serial.begin(9600);
  delay(1000);
}

void loop() {
  Serial.println("Sending data to ESP32...");
  Wire.beginTransmission(0x08);  // Slave address
  Wire.write("Hi");
  byte status = Wire.endTransmission();

  if (status == 0) {
    Serial.println("✅ ESP32 acknowledged the message!");
  } else {
    Serial.print("❌ Error sending to ESP32. Code: ");
    Serial.println(status);
  }

  delay(1000);
}

Code Part 2: ESP32 as I²C Slave

#include <Wire.h>

void receiveEvent(int bytes) {
  Serial.print("Received: ");
  while (Wire.available()) {
    char c = Wire.read();
    Serial.print(c);  // Show character
  }
  Serial.println();
}

void setup() {
  Serial.begin(115200);
  Wire.begin(0x08);  // ESP32 as Slave at address 0x08
  Wire.onReceive(receiveEvent);  // Set receive handler
}

void loop() {
  delay(100);
}

What You Need | I²C with Saleae Logic

  • Arduino Uno
  • ESP32 Dev Board
  • Saleae Logic Analyzer
  • Jumper Wires
  • Arduino IDE

Wiring Between Arduino and ESP32

Arduino UnoESP32Saleae Logic
A4 (SDA)GPIO 21 (SDA)CH0 (SDA)
A5 (SCL)GPIO 22 (SCL)CH1 (SCL)
GNDGNDGND

Use Saleae Logic Analyzer

  1. Connect Channel 0 to SDA (A4/GPIO21), Channel 1 to SCL (A5/GPIO22), and GND.
  2. In the Saleae Logic software:
    • Set sampling rate: 1MHz or higher
    • Add I²C Analyzer (Channel 0 = SDA, Channel 1 = SCL)
  3. Hit Start, and observe the communication!

What You’ll See in Saleae

You’ll decode messages like:

[0x08] WRITE → 0x48 0x69
Which corresponds to ASCII:

H  i
" That’s the "Hi" sent from Arduino to ESP32 "

Tips & Gotchas

  • If the ESP32 doesn’t show messages: check address match and wiring.
  • Pull-up resistors (4.7kΩ) might be needed if you get unreliable signals.
  • You can use Wire.onReceive() on ESP32 to handle multiple bytes and print them.

You can also Visit other tutorials of Embedded Prep 

Special thanks to @mr-raj for contributing to this article on EmbeddedPrep

Leave a Reply

Your email address will not be published. Required fields are marked *