Skip to content Skip to sidebar Skip to footer

How to Find I2C Address Device Using Arduino

I2C Scanner

How to Find I2C Address Device Using Arduino - Each I2C device has an address. Usually we know the I2C address from the database. But what if we don't get the I2C address of a device?

With arduino, we can easily get the device address with a program called I2C Scanner.

Before we go to the program code, please connect the I2C device to the Arduino with the following simple configuration:

5V Vcc

Scan I2C Address

After you connect the I2C device to the Arduino, it's time to check the address. The following is the I2C Scanner program code, please upload it to your Arduino board.

Program Code:

#include <Wire.h>

void setup() {
Serial.begin (9600);
while (!Serial)
Serial.println ();
Serial.println ("Search I2C Address ...");
byte count = 0;

for (byte i = 8; i <120; i++)
Wire.beginTransmission (i);
if (Wire.endTransmission () == 0)
Serial.println ("get it");
Serial.print ("Address is: ");
Serial.print ("0x");
Serial.println (i, HEX);
delay (1);
Serial.println ("Done.");
Serial.print ("Found ");
Serial.print (count, DEC);
Serial.println (" Device.");
void loop() {}

After the upload is complete, now open the Serial Monitor in your Arduino IDE.

For example I connected a 20x4 I2C LCD and after finishing doing I2C Scanner, I got the result that the address of the LCD I was using was 0x3F.


Post a Comment for "How to Find I2C Address Device Using Arduino"