Arduino Mega 2560 R3 SDA/SCL pins

If I understand correctly the R3 version of the Mega 2560 has 2 sets of SDA/SCL pins.

SDA(20)/SCL(21) and the new SDA/SCL pins near the AREF pin.

I would like to attach a MLX90614 IR Temperature sensor to each set using the I2C communication. does anyone know if this is possible?

Hi and welcome.

The schematics (click !) do not show separate pins, but also that the controller doesn't have 2 sets of I2C buses. So the 2 I2C or 2wire connections are mirrors, connected to the same pins of the controller.

I2Cis a bus system. It allows to have many (127) devices connected to it. You need to address each device you'll be communicating with. Lots of devices allow to set their address, within limits of course. I see this Melexis device you'd like to use is factory set to 5A, but reading the datasheet there is some paragraph about how to set the address (im not sure i really understood it correctly).

If this proves to be impossible or too difficult to you, you could look into switching the I2C wires (using some kind of multiplexer).

thanks for the advice! i found some code that will allow me to change my device addresses accordingly. the fact that both sets of SDA/SCL pins are on the same bus system is exactly the information i needed. thx

Yes, because the SDA and SCL are on different pin for the Arduino Uno, or the Leonardo or the Mega board. To allow a shield to connect with the I2C bus, those 2 pins near AREF are added. But the SDA and SCL are still on the other pins as well, because there is only one I2C bus.

Problem with I2C bus and interrupts in ARDUINO MEGA 2560.

The pins 20 and 21 which are input hardware interrupts to Int2 and Int3 pins, also is used for the I2C interface (SDA and SCL signals respectively). When using the Wire library and have ISR attached to interruptions 3 or 2 (Pin 20 or 21) a call to ISR will occur every time the ISR signals SDA and SCL signals are activated This will cause a behavior not desired in software and hardware. If the ISR routine consumes time raised the Arduino Mega 2560 may crash and will require a restart. Is incompatible use the I2C bus and Int2 Int3 or interruptions at same time.

thx everyone for the input

alfelipe: When using the Wire library and have ISR attached to interruptions 3 or 2 (Pin 20 or 21) a call to ISR will occur every time the ISR signals SDA and SCL signals are activated

Since such ISRs are very rarely required, should never be a problem.

using the Wire library and have ISR attached to interruptions 3 or 2 (Pin 20 or 21) a call to ISR will occur every time the ISR signals SDA and SCL signals are activated

In any case, this is a limitation of the chip, and there is nothing that Arduino HW design or SW can do about it.

Paul__B: Since such ISRs are very rarely required, should never be a problem.

Never?! How can you be so sure about it?

I need Interrupts 2 and 3 for Hall Effect sensors, and SDA/SCLK for eCompass; which are not unusual sensors to have, or a combination.

And in fact that is why I moved to Mega, to have more number of interrupts. So, what is your suggestion?