I2C Scan Test
A lot of sensors, displays, and devices can connect over I2C. I2C is a 2-wire 'bus' that
allows multiple devices to all connect on one set of pins so it's very convenient for
wiring!
When using your board, you'll probably want to connect up I2C devices, and it can be
a little tricky the first time. The best way to debug I2C is go through a checklist and
then perform an I2C scan
Common I2C Connectivity Issues
•
Have you connected four wires (at a minimum) for each I2C device? Power the
device with whatever is the logic level of your microcontroller board (probably
3.3V), then a ground wire, and a SCL clock wire, and and a SDA data wire.
•
If you're using a STEMMA QT board - check if the power LED is lit. It's usually a
green LED to the left side of the board.
•
Does the STEMMA QT/I2C port have switchable power or pullups? To reduce
power, some boards have the ability to cut power to I2C devices or the pullup
resistors. Check the documentation if you have to do something special to turn
on the power or pullups.
•
If you are using a DIY I2C device, do you have pullup resistors? Many boards do
not have pullup resistors built in and they are required! We suggest any common
2.2K to 10K resistors. You'll need two: one each connects from SDA to positive
power, and SCL to positive power. Again, positive power (a.k.a VCC, VDD or V+)
is often 3.3V
•
Do you have an address collision? You can only have one board per address. So
you cannot, say, connect two AHT20's to one I2C port because they have the
same address and will interfere. Check the sensor or documentation for the
address. Sometimes there are ways to adjust the address.
•
Does your board have multiple I2C ports? Historically, boards only came with
one. But nowadays you can have two or even three! This can help solve the
"hey, but what if I want two devices with the same address" problem: just put
one on each bus.
•
Are you hot-plugging devices? I2C does not support dynamic re-connection, you
cannot connect and disconnect sensors as you please. They should all be
connected on boot and not change.
assistant but that'll cost
•
Are you keeping the total bus length reasonable? I2C was designed for maybe
6" max length. We like to push that with plug-n-play cables, but really please
©Adafruit Industries
(Only exception is if you're using a hot-plug
you ()).
Page 204 of 263
Need help?
Do you have a question about the ESP32-S3 and is the answer not in the manual?