Skip to content

Ard Wire Slave

DodaTech 1 min read

In this tutorial, you'll learn about Arduino I2C Slave Not Responding to Master. We cover key concepts, practical examples, and best practices to help you understand and apply this topic effectively.

The Problem

An Arduino configured as I2C slave does not respond to master requests.

Quick Fix

Wrong

Wire.begin(0x08);  // No receive/request handlers registered
Master gets no response from the slave.
#include <Wire.h>
int counter = 0;

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

void requestEvent() {
  Wire.write(counter++);  // Send data to master
}

void setup() {
  Serial.begin(9600);
  Wire.begin(0x08);  // Slave address 0x08
  Wire.onReceive(receiveEvent);
  Wire.onRequest(requestEvent);
  Serial.println("I2C Slave at 0x08");
}

void loop() {
  delay(100);
}
Slave at 0x08 responds to master reads/writes.

Prevention

Register Wire.onReceive() and Wire.onRequest() handlers before the I2C bus is used. The slave address must be unique on the bus (7-bit). Avoid address 0x00 (general call) and 0x78-0x7F (reserved). The slave cannot initiate communication — it only responds.

DodaTech engineers apply these same patterns across Doda Browser, DodaZIP, and Durga Antivirus Pro for production IoT reliability.

FAQ

### What address range can I use?

0x01-0x77 (7-bit). Avoid 0x00 (general call) and 0x78-0x7F (reserved for future). Check if other devices on the bus use the same address.

Can I change slave address at runtime?

Yes. Call Wire.begin(newAddress) to re-register with a new address. The old address stops responding.

How do multiple slaves coexist?

Each slave must have a unique address. The master selects which slave to communicate with by sending the address byte.

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro