what is the I2C address of Arduino UNO board and how to modify i2c address

Respected Sir

we have an implementation on I2C where two way communication is happening. My device i2c address is 0x06 but I don't know the Arduino UNO's I2C address, and if it is 127 then how to modify it. I want to make it in between 0 to 31 number as an I2C address.

Please guide me. I went through Arduino UNO 1.0.1 libraries but could not find a way.

Thanks & Regards.

Wire.begin(address) maybe? Wire - Arduino Reference

Riva:
Wire.begin(address) maybe? Wire - Arduino Reference

Hi...!!!

Thanks for your kind reply. But this Link doesn't say anything about the I2C address of Arduino Board and method to modify the I2C address.

Thanks & Regards...

ranjeetray:
Thanks for your kind reply. But this Link doesn't say anything about the I2C address of Arduino Board and method to modify the I2C address.

From the page link...

Description
Initiate the Wire library and join the I2C bus as a master or slave. This should normally be called only once.
Parameters
address: the 7-bit slave address (optional); if not specified, join the bus as a master.

Riva:

ranjeetray:
Thanks for your kind reply. But this Link doesn't say anything about the I2C address of Arduino Board and method to modify the I2C address.

From the page link...

Description
Initiate the Wire library and join the I2C bus as a master or slave. This should normally be called only once.
Parameters
address: the 7-bit slave address (optional); if not specified, join the bus as a master.

Thanks for your reply. I am running the following code on one Arduino UNO board and trying to reading the I2C address of another Arduino UNO board using SCL and SDA wires on pin A5 and A4 but I am not getting any value. I have used pull up register also 4.7Kohm at 5V.

#include <Wire.h>


void setup()
{
  Wire.begin();

  Serial.begin(9600);
  Serial.println("\nI2C Scanner");
}


void loop()
{
  byte error, address;
  int nDevices;

  Serial.println("Scanning...");

  nDevices = 0;
  for(address = 0; address <= 130; address++ )
  {
    // The i2c_scanner uses the return value of
    // the Write.endTransmisstion to see if
    // a device did acknowledge to the address.
    Wire.beginTransmission(address);
    error = Wire.endTransmission();

    if (error == 0)
    {
      Serial.print("I2C device found at address 0x");
      if (address<16)
        Serial.print("0");
      Serial.print(address,HEX);
      Serial.println(" !");

      nDevices++;
    }
    else if (error==4)
    {
      Serial.print("Unknow error at address 0x");
      if (address<16)
        Serial.print("0");
      Serial.println(address,HEX);
    }    
  }
  if (nDevices == 0)
    Serial.println("No I2C devices found\n");
  else
    Serial.println("done\n");

  delay(8000);           // wait 8 seconds for next scan
}

Kindly suggest me , what is wrong here.

ranjeetray:
Thanks for your kind reply. But this Link doesn't say anything about the I2C address of Arduino Board and method to modify the I2C address.

Yes it does. Which part didn't you understand?

Wire.begin(address);  // <------- the address!!!!

Respected Sir

When I use the following code I get the Address of an Arduino UNO board as 127 but I want to change it to some other value like 23. How to do this. Is there any code which I can run on that board and make its I2C address as 23. I am connecting two Arduino UNO boards using SCL and SDA pin A5 and A4 with 4.7Kohm pull up resistors.

Please help me out.

#include <Wire.h>


void setup()
{
  Wire.begin();

  Serial.begin(9600);
  Serial.println("\nI2C Scanner");
}


void loop()
{
  byte error, address;
  int nDevices;

  Serial.println("Scanning...");

  nDevices = 0;
  for(address = 0; address <= 130; address++ )
  {
    // The i2c_scanner uses the return value of
    // the Write.endTransmisstion to see if
    // a device did acknowledge to the address.
    Wire.beginTransmission(address);
    error = Wire.endTransmission();

    if (error == 0)
    {
      Serial.print("I2C device found at address 0x");
      if (address<16)
        Serial.print("0");
      Serial.print(address,HEX);
      Serial.println(" !");

      nDevices++;
    }
    else if (error==4)
    {
      Serial.print("Unknow error at address 0x");
      if (address<16)
        Serial.print("0");
      Serial.println(address,HEX);
    }    
  }
  if (nDevices == 0)
    Serial.println("No I2C devices found\n");
  else
    Serial.println("done\n");

  delay(8000);           // wait 8 seconds for next scan
}


Thanks & Regards

Respected Sir

I got it, if we specify address in Wire.begin(0x23); then 0x23 will be I2C address or it will take 127 I2C address by default.
I am able to change and communicate with two boards.

Thanks a lot Sir.

Thanks & Regards....

Again:

What part of those examples didn't work? Provide code.

I got it, if we specify address in Wire.begin(0x23); then 0x23 will be I2C address or it will take 127 I2C address by default.

What sort of question is this? The address would be 0x23. What else would it be?

I want to make it in between 0 to 31 number as an I2C address.

0x23 is not the same as 23.

Respected Sir

Thanks a lot Sir.
I got it. It is working for my implementation. You are mind blowing Sir.

Thanks & Regards..