Just two wires — that’s all it takes to talk to dozens of sensors, displays, and peripherals at once. I2C is one of those fundamentals that shows up in almost every robot project worth building.
What is I2C?
I2C (Inter-Integrated Circuit, often spoken as “I-squared-C”) is a serial communication protocol invented by Philips in 1982. It uses just two lines: SDA (data) and SCL (clock). Every device on the bus gets a unique 7-bit address, so a single pair of wires can serve up to 112 devices simultaneously.
Speeds are modest — 100 kHz in standard mode, 400 kHz in fast mode — but that’s plenty for sensors, OLED displays, real-time clocks, and motor controllers. Most microcontrollers used in robotics (Raspberry Pi Pico, ESP32, Arduino) have dedicated I2C hardware built in, so it costs you nothing extra in silicon.
A key feature: I2C is a bus. Chain a temperature sensor, a compass, an OLED, and a distance sensor all on the same two pins. Each responds only to its own address. Short projects rarely need more than a handful, but it’s reassuring to know the headroom is there.
Two wires, many devices
Every device shares the same two lines — SDA (data) and SCL (clock). What keeps them from talking over each other is the address: the controller calls out an address, and only the device with that address answers. Two pull-up resistors hold the lines high when idle:
3.3V ─┬───[4.7kΩ]──┬──── SDA (data) ────┬──────┬──────┐
│ │ │ │ │
└─[4.7kΩ]─┐ │ SCL (clock) ──┬──│───┬──│───┬──│
│ │ │ │ │ │ │ │
┌────┴──┴───┐ ┌────┴──┴┐ ┌┴──┴─┐ ┌┴──┴─┐
│ Pico / │ │ OLED │ │ IMU │ │ TOF │
│ controller│ │ 0x3C │ │0x68 │ │0x29 │
└───────────┘ └────────┘ └─────┘ └─────┘
each device = a unique address
Run a quick bus scan in code and the controller reports back every address that answers — instant proof your wiring is right before you write a line of driver code.
Why robot builders care
Robots need to sense their environment, and sensors speak I2C. The BME280 (temperature, humidity, pressure), the MPU-6050 IMU, SSD1306 OLED displays, VL53L0X time-of-flight sensors — they all use I2C. Without it, you’d run out of GPIO pins before you ran out of ideas.
There’s a practical bonus, too: bus scanning. Before writing a single line of driver code you can scan the bus and get back a list of addresses — instant confirmation that your hardware is wired correctly. That scan loop has saved more debugging sessions than any oscilloscope.
Pull-up resistors matter here. SDA and SCL need to be pulled high (typically 4.7 kΩ) for the bus to work. Many breakout boards include them, but if you’re building raw circuits you’ll need to add them yourself.
Get started
The fastest path to your first I2C project is an OLED display and a Pico. Wire SDA to GP4, SCL to GP5, load MicroPython, and within five minutes you can be printing text to a tiny screen. That same wiring approach scales directly to any I2C sensor you pick up later.
Kevin’s Talking to the World — Working with I2C and SPI course walks you through everything from bus scanning and reading datasheets to building a real sensor dashboard with a BME280. It’s the most thorough treatment on the site and a great companion whether you’re just starting or want to fill in gaps.
For a fun visual target, the Adding OLED Displays with MicroPython post shows how to drive an SSD1306 over I2C — text, graphics, and live sensor readouts all on a display roughly the size of a postage stamp.
Once I2C clicks, SPI (its faster, four-wire sibling) will feel familiar. And when you start chaining sensors into a real robot brain, you’ll be glad this particular reaction only needs two wires.
Reacts well with
More Signals & Comms
Learn more on KevsRobots
Courses
Projects to build
Articles to read
Share this element
This page is awesome? Show some love!Did you find this content useful?
If you found this high quality content useful please consider supporting my work, so I can continue to create more content for you.
I give away all my content for free: Weekly video content on YouTube, 3d Printable designs, Programs and Code, Reviews and Project write-ups, but 98% of visitors don't give back, they simply read/watch, download and go. If everyone who reads or watches my content, who likes it, helps fund it just a little, my future would be more secure for years to come. A price of a cup of coffee is all I ask.
There are a couple of ways you can support my work financially:
If you can't afford to provide any financial support, you can also help me grow my influence by doing the following:
Thank you again for your support and helping me grow my hobby into a business I can sustain.
- Kevin McAleer
Comments