Using SDA & SCL pin or A4 & A5 pin?

On the Arduino Uno board there are SDA pins and SCL pins. If I have used the SDA and SCL pins for a 16x2 LCD, can the A4 and A5 pins be used for other sensors?

No. If you look at a schematic, you will see that they are the same two pins on the processor and they're just brought out to two different places on the headers.

Edit: argh, not enough caffeine this morning! Other I2C sensors, yes. I read that as using them as analog pins. :face_with_peeking_eye:

If the other sensors use the I2C bus, then you can connect them at the same time as an I2C LCD, as long as there is no conflict with the I2C addresses. If all the devices have built-in pullup resistors, you may need to take those into consideration if you are using a lot of devices.

Simple solution (I think) use a Nano, it has two additional A/D pins that are not pined out on the UNO.

Your other option is to use software I2C rather than the the uno's hardware I2C peripheral. There are various Soft I2C libraries available, they may run a bit slower than the hardware I2C peripheral (which is hard-wired inside the chip to the same pins of the atmega328p as the A4 and A5 analog channels), but as your uno is the master of the I2C bus, not acting as a slave device upon it, this should be fine. Your slave device, the LCD display, won't mind having a master which runs it a bit slower than expected.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.