Arduino Mega Mega2560 I2C on pins A4 and A5 for Arduino UNO shield compatibility

hello,
is it possible to make the Arduino Mega2560 I2C work on pins A4 and A5 for Arduino UNO shield compatibility?

on Uno and Mega the I2C pins are on the same spot near AREF. (they are connected to right pins on atmega)

no, you probably missed my point:
My Uno shields are using just A4+A5 for i2c, but the shields fail if I plug them to my Mega, because the Mega does not use A4+A5 for i2c.
So I want to adjust the Mega in order to use A4+A5 for i2c just ike the Uno does.

your shields? can't you adjust them?

no, I can't adjust the shields - if I could, I wouldn't have asked :wink:

that's why I asked:
"is it possible to make the Arduino Mega2560 I2C work on pins A4 and A5 for Arduino UNO shield compatibility?"

PS, edit:
the following 2 functions assigning SDA and SCL pins work with the nodeMCU in general (not A4+A5 though), but not at all with the Mega:

Wire.pins(A4, A5); // compile error
Wire.begin(A4,A5); // compile error

no way to make the Mega I2C work for UNO shields A$+A5 ??

No, the I2C is fixed to the specific pins for a ATmega2560 microcontroller.

I can think of two things, perhaps someone else can think of a third one.

You could try a software I2C library on pin A4 and A5. Here is a list of those libraries: Arduino I2C libraries · Testato/SoftwareWire Wiki · GitHub

You could connect the A4 and A5 to the real I2C pins. Perhaps even with a prototype shield in between your shield and the Arduino 2560 board. If you don't use A4 and A5, they will stay high impedance.

Can you give a link to that shield ? Perhaps there is a XY-problem.

About missing a point: since your shield does not use the SDA and SCL near the AREF pin, your shield is the problem because it is not compatible with other Arduino boards :grin:

It's to be used for this pozyx Arduino Tag:

I haven't bought it yet but the company can't guarantee that it it works with the Mega.

They do have the full 10 pins header that includes SDA and SCL near the AREF pin.
But they say: "Arduino Uno compatible", only the "Uno" is mentioned.
But then the Pinout page shows that they use the SDA and SCL near the AREF pin: https://www.pozyx.io/Documentation/Datasheet/pinOut.

That is a little confusing.
Is there a Pozyx board and a Pozyx shield ? On the website I can find at least three different boards. In the photo of the most recent shield I can cleary see some pcb traces connected to the SDA and SCL near the AREF pin. I can also find a photo of an older shield which is different.

Is there a schematic of the latest version ?

I think it will work. Go ahead and buy it.
They use interrupt at pin 2 and 3, and also the Arduino Mega 2560 can do that.
The worst case is that you have to stick some wires from SDA and SCL (near AREF) to A4 and A5.

Are you sure that they use A4 and A5 for I2C ? Perhaps they did it right and used the pins near the AREF pin.

no I am not sure yet but I wanted to be sure to have a workaround in advance, in case there is a A4/A5 compatiblity required.
600 EURO + VAT are a lot of money in case it wouldn't work then.
But anyway, if the Mega can't be adjusted to A4+A5 there would be no way then eventually, and I have no further information yet.

Go ahead and buy it.

The Arduino Mega 2560 has also interrupts at pin 2 and 3.
The worst case is that you have to stick two wires from SDA and SCL (near AREF) to A4 and A5.

If something does not work (for example in the library), then you can fallback to an Arduino Uno. Is that a problem ?

I think that they should test it with an Arduino Mega 2560. That is their job, not yours.

ah, so sticking extra wires from SDA and SCL (near AREF) to A4 and A5 additionally wouldn't damage the ADC or mess up I2C?

ps,
an UNO would be a problem indeed because I need all the extra ADC, UART, and D pins of the Mega.

No, it will not damage something.
Did you know that when the I2C is turned on for an Arduino Uno, the analogRead() and digitalRead() can still be used on pin A4 and A5 ? It is useless to read the I2C bus, but it is possible. Because the different hardware in the chip operate on the same pin. That is normal and nothing can go wrong.
As long as A4 and A5 are not set as OUTPUT with pinMode(), then nothing can go wrong.

The Poxyz board runs at 3.3V. The Arduino Mega 2560 is the only board with pullup resistors of 10k from SDA to 5V and from SCL to 5V. That is the only problem I can see. Without the schematic, I don't know if the Poxyz can handle the higher voltage of SDA and SCL.

It runs at 3.3V? I know that the pozyx shield is not 3.3V Due compliant, that's what the company stated.
That is really confusing, and they also still don't confirm that it's Mega compliant instead - perhaps because of the pullups then, I didn't think of that point so far.
tbh, all that is too vague, ambiguous, and uncertain then, I think I should raelly better wait until the company confirms an guarantees either compatibility before I'll buy it in vain.

Hmmm, yes, I think so. At this point it is up to them to give more information.