I2C 배선 기초: 풀업 저항 값과 주소, 안 될 때 점검I2C Wiring Basics: Pull-Up Values, Addresses, and What to Check When It Fails
I2C 버스의 SDA·SCL 구조, 풀업 저항 값을 정하는 방법, 장치 주소 충돌 해결, 배선 길이와 전원 문제로 통신이 안 될 때 점검 순서를 정리했습니다.The SDA and SCL structure of an I2C bus, how to choose pull-up resistor values, resolving address conflicts, and the order to check when communication fails because of wire length or power.
I2C는 선 두 개(SDA, SCL)로 여러 개의 센서와 표시기를 연결하는 통신 방식입니다. 배선이 간단해서 온도 센서, OLED 화면, 시계 모듈처럼 만능기판 작품에 매우 자주 쓰입니다. 그런데 "분명히 연결했는데 장치가 안 보인다"는 문제가 가장 흔하고, 대부분 풀업 저항, 주소, 배선, 전원 중 하나가 원인입니다. 이 글에서는 I2C 버스의 구조, 풀업 저항 값을 정하는 법, 장치 주소 문제, 안 될 때의 점검 순서를 정리합니다.
I2C의 구조
SDA: 데이터 선
SCL: 클럭 선
마스터: 통신을 시작하고 클럭을 만드는 장치(마이크로컨트롤러)
슬레이브: 센서·표시기 등 장치. 각 장치는 고유한 7비트 주소를 가집니다.
SDA와 SCL은 오픈 드레인 방식입니다. 장치는 선을 Low로만 당길 수 있고, High는 풀업 저항이 전원 쪽으로 끌어올려서 만듭니다. 그래서 풀업 저항이 없으면 선이 올라가지 못해 통신이 되지 않습니다.
모드
속도
비고
표준 모드
100kHz
가장 안정적, 입문 기본
빠른 모드
400kHz
많은 센서·OLED가 지원
풀업 저항 값 정하기
값이 너무 크면 선이 느리게 올라가 신호가 둔해지고, 너무 작으면 장치가 선을 Low로 당길 때 전류가 커져서 문제가 됩니다.
일반적인 값: 3.3V·5V 버스에서 4.7kΩ(100kHz), 빠른 모드나 선이 긴 경우 2.2kΩ ~ 3.3kΩ
최솟값: 장치가 당길 수 있는 전류(보통 3mA)로 결정됩니다. R_min ≈ (전원 − 0.4V) ÷ 3mA이므로 3.3V에서 약 1kΩ, 5V에서 약 1.5kΩ입니다.
최댓값: 선의 용량(C)과 요구되는 상승 시간으로 결정됩니다. R_max ≈ 상승 시간 ÷ (0.85 × C). 표준 모드의 상승 시간 한도는 1000ns이므로 C = 100pF이면 약 11.8kΩ까지 가능합니다.
SDA와 SCL 각각에 풀업 저항 한 개씩(두 개)을 둡니다. 저항 값 읽는 법은 저항 읽는 법을 참고하세요.
전압 맞추기
I2C의 High는 풀업이 연결된 전원 전압입니다. 3.3V 장치와 5V 장치를 한 버스에 섞으면 안 됩니다.
SDA나 SCL이 평소에도 Low라면 어떤 장치가 선을 잡고 있거나 쇼트입니다. 평소에도 High가 아닌 중간 전압이라면 풀업이 없거나 너무 큰 것입니다. 대부분의 문제는 점검표 1~4단계에서 찾을 수 있습니다(완성했는데 동작하지 않을 때: 단계별 점검표).
정리
I2C는 SDA·SCL 두 선과 각각 풀업 저항(보통 4.7kΩ), 공통 접지, 같은 논리 전압, 겹치지 않는 주소로 이루어집니다. 모듈에 풀업이 이미 달려 있는지 확인하고, 선을 짧게 하며, 안 되면 전원과 주소부터 점검하세요. 보드를 만능기판에 올리는 방법은 개발 보드를 만능기판에 올리는 법에서 이어서 볼 수 있습니다.
I2C is a communication method that connects several sensors and displays with two wires (SDA and SCL). The wiring is simple, so it is used very often in perfboard projects, for things like temperature sensors, OLED screens, and clock modules. But "I connected it clearly, yet the device does not show up" is the most common problem, and it is mostly caused by one of the pull-up resistors, the address, the wiring, or the power. This article covers the structure of an I2C bus, how to decide pull-up resistor values, device address problems, and the order to check when it does not work.
The structure of I2C
SDA: the data line
SCL: the clock line
Master: the device that starts communication and makes the clock (the microcontroller)
Slave: devices such as sensors and displays. Each device has a unique 7-bit address.
SDA and SCL are open drain. A device can only pull the line Low, and High is made by a pull-up resistor lifting it toward the supply. So without pull-up resistors, the line cannot rise and communication does not work.
Mode
Speed
Notes
Standard mode
100 kHz
Most stable, the beginner default
Fast mode
400 kHz
Supported by many sensors and OLEDs
Deciding the pull-up resistor value
If the value is too large, the line rises slowly and the signal dulls; if too small, the current becomes large when a device pulls the line Low, which causes problems.
Typical value: 4.7 kΩ on a 3.3 V or 5 V bus (100 kHz), and 2.2 kΩ to 3.3 kΩ for fast mode or long lines
Minimum: decided by the current a device can sink (usually 3 mA). R_min ≈ (supply − 0.4 V) ÷ 3 mA, so about 1 kΩ at 3.3 V and about 1.5 kΩ at 5 V.
Maximum: decided by the line capacitance (C) and the required rise time. R_max ≈ rise time ÷ (0.85 × C). The standard mode rise-time limit is 1000 ns, so with C = 100 pF you can go up to about 11.8 kΩ.
Put one pull-up resistor each on SDA and SCL (two in total). For how to read resistor values, see Reading Resistors.
Matching voltages
The High of I2C is the supply voltage the pull-ups are connected to. Do not mix 3.3 V and 5 V devices on one bus.
On perfboard, connect SDA and SCL lightly with jumper wires, and keeping the pull-up resistors together in one place on the microcontroller side makes them easy to manage.
The order to check when it does not work
Step
Check
Method
1
Power
Measure that the device's VCC voltage (3.3 V/5 V) is right
2
Ground
Continuity-test that all GNDs are connected
3
SDA and SCL positions
Check they are not swapped and the pin numbers are right
4
Pull-ups
Measure that the lines are normally High (0 V means no pull-up or a short)
5
Voltage
Check the device and microcontroller logic voltages are the same
6
Address
Check addresses with a scanner program, look for conflicts
7
Speed
If there is a problem, lower the speed to 100 kHz and test
8
Waveform
Check the signal with an oscilloscope or logic analyzer (Oscilloscope Basics)
If SDA or SCL is Low even at rest, a device is holding the line or there is a short. If it sits at an in-between voltage, not High, at rest, there is no pull-up or it is too large. Most problems can be found in steps 1 to 4 of the checklist (It Is Finished but It Does Not Work: A Step-by-Step Checklist).
Summary
I2C consists of the two lines SDA and SCL, a pull-up resistor on each (usually 4.7 kΩ), a common ground, the same logic voltage, and non-overlapping addresses. Check whether the modules already have pull-ups, keep the wires short, and when it fails, check power and addresses first. How to mount a board on perfboard continues in Mounting a Development Board on Perfboard.
에디터에서 직접 해 보기Try it in the editor
읽은 내용을 패턴도 에디터에서 바로 확인해 보세요. 회원가입 없이 열리고, 납땜 전에 배치와 배선을 몇 번이고 고쳐 볼 수 있습니다.Try what you just read right in the Patterndo editor. It opens without sign-up, and you can rework the layout and wiring as many times as you like before you solder.
이 글은 학습 목적의 일반적인 안내입니다. 부품마다 규격과 핀 배열이 다를 수 있으니 실제 작업 전에는 사용하는 부품의 데이터시트를 확인하세요. 안전과 관련된 작업은 항목별 주의 사항을 먼저 읽고 진행하세요.This article is general guidance for learning purposes. Specifications and pinouts differ between parts, so check the datasheet of the part you use before real work. For safety-related work, read the cautions for each item first.