HOWTO · Arduino
How to Select Pin for I2c on an Arduino Uno
Find the Arduino Uno I2C pins, connect SDA and SCL, and initialize the bus with the Wire library.
On this page
On an Arduino Uno, connect an I2C device’s SDA line to A4 and its SCL line to A5. Join the device and board grounds, supply power according to the device’s requirements, then initialize the bus in an Arduino sketch with the Wire library. The board’s labels and layout can vary, so check the markings on your specific Uno before wiring.
I2C Pins on Arduino Uno
The usual Uno I2C mapping is SDA to A4 and SCL to A5. Some pin references also identify these signals as PC4 (SDA) and PC5 (SCL); the analog labels A4 and A5 are the practical connection points on the Uno. Some Uno boards expose separate SDA and SCL labels as well. Those labels carry the same bus signals; they are not a second I2C bus.
What SDA and SCL Do
I2C uses two signal lines. SDA carries serial data between the controller and connected devices, while SCL carries the clock signal that coordinates transfers. Each device on the bus connects to the same SDA and SCL lines. Use the labels to match each signal; swapping the two lines prevents the devices from communicating as intended.
How to Wire an I2C Device to Arduino Uno
With the board unpowered, connect the Uno’s A4/SDA pin to the device’s SDA pin and A5/SCL to its SCL pin. Connect GND on the Uno to GND on the device so both share a reference. Connect the device’s power input only to a voltage supported by that module. Do not assume every I2C device accepts 5 V; check its markings or documentation, and use an appropriate level shifter if its logic voltage is incompatible with the Uno.
I2C lines generally need pull-up resistors. Many modules already include them, so first check the module documentation or circuit. If the bus has no suitable pull-ups, add them between SDA and the bus’s logic supply and between SCL and that supply. A value around 4.7 kΩ is a common starting point, not a universal requirement; bus speed, wiring, and the devices affect the appropriate value. Avoid adding multiple strong pull-ups without checking the combined circuit.
Initialize I2C with the Wire Library
The Arduino IDE includes the Wire library for I2C. Include it in the sketch with #include <Wire.h>, then call Wire.begin(); inside setup() to initialize the Uno as the bus controller. This is the initialization step; it does not by itself read a sensor or confirm that a device is connected. Device-specific code must use that device’s documented I2C address and register or command sequence.
For example, the relevant line in an Arduino sketch is Wire.begin();. This hardware-specific sketch line is not shown as a host-run example: the supplied packet contains no execution result for an Arduino toolchain or connected Uno. A program that uses Wire.h also requires the Arduino core and board configuration.
Check Board Labels and Troubleshoot Connections
If a device does not respond, check these items in order:
- Confirm SDA goes to SDA (A4 on the Uno) and SCL goes to SCL (A5); correct any crossed wires.
- Verify that Uno and device grounds are connected, and that the device receives its specified supply voltage.
- Check that pull-ups are present and connected to a logic voltage both devices can tolerate. Do not rely on 4.7 kΩ as a fixed rule for every bus.
- Confirm the address and communication sequence from the device documentation.
Wire.begin()starts the bus but does not select a device address. - Read the board’s own pin labels. If it has SDA/SCL header pins, use those labels as the same I2C signals; do not infer a different pin layout from another Uno revision.