Connect BMP180 Barometric to different Pins

Hi.

I have a BMP180 barometric sensor to connect to an arduino mega with a LCD Touch Screen

the problem is the BPM180 uses A4 and A5 to work and that pines are used by Touch Screen too.

So, can i change the BMP180 pins?

Thanks.

The BMP180 is using A4/A5 as this is where the SDA/SCL signal connect to. The only way to use other pins for SCL/SDA is to use a software I2C library like this.

Hi Riva, thanks for your answer, that’s i need.

So, i want to use the pin A9 for SCL and pin A10 for SDA, so i defined this:

#define SCL_PIN 9
#define SCL_PORT PORTC
#define SDA_PIN 10
#define SDA_PORT PORTC
#include <SoftI2C.h>
...
BMP180 barometer;

Thanks

... the problem is the BPM180 uses A4 and A5 to work and that pines are used by Touch Screen too.

The BPM180 (which is really a BMP180) uses A$ and A5 because it is an I2C device.

If your unspecified Touch Screen is also an I2C device then it can most likely coexist on the I2C bus with the BMP180 since it probably has a different address. That's the whole idea of using I2C.

Don

I2C is a bus.
You can connect up to 128 devices to those two pins.
As long as they all have a different address.
Leo..

But you can't connect non-I2C devices to those pins and expect the I2C devices to keep working. That's why we have to know more about his unspecified Touch Screen.

Don

Just saw "Arduino Mega" in the first post.

A Mega has I2C on pins 20 and 21, so the BPM180 should NOT be connected to A4 and A5.

If the touch screen is also I2C, then it should also be moved to pin 20, 21.
Leo..

You are right Wawa, i am using pins 20 and 21 and it works for me now.

Also, I am using this LCD Touch Screen: 2.4 inch TFT LCD Module Touch LCD Screen for Arduino Mega 2560 R3 Board Support Mega 2560|screen for arduino|touch lcd screenlcd screen - AliExpress

It doesn't use pins 20 and 21.

Thanks for help

Wawa:
Just saw "Arduino Mega" in the first post.

Missed that little nugget. :blush: