Reading and Displaying a Sensor over a Two-Wire Bus — An I2C pressure sensor and a display share the same data line; the board reads the sensor value and shows it on the display.

Circuit Projects

Reading and Displaying a Sensor over a Two-Wire Bus

An I2C pressure sensor and a display share the same data line; the board reads the sensor value and shows it on the display.

November 22, 20265 min read

In this circuit two devices share the same two-wire bus. The sensor measures ambient pressure and temperature, and the display shows those values. The data and clock lines are shared; because each device has its own address, there is no clash. Pull-up resistors hold the lines HIGH and devices send data by pulling a line LOW. The board writes to and reads from the sensor by address, then passes the value to the display. This project shows how multiple devices coexist on one bus and teaches address-based access.

Circuit diagram for reading data from an I2C sensor: control board, components and coloured jumper wires on a breadboard
Reading data from an I2C sensor and displaying it — original circuit diagram; the components and connections match the circuit in the simulator.

Interactive circuit guide

Run the simulation, follow the build steps one by one and try it in our real app.

Real screenshot of our circuit simulator Stopped
Open in our app →

Step-by-step build

You can open this circuit in the browser simulator, trace the connections and change values to see what happens.

Open in simulator

Parts you need

Build the circuit with the components below. Each component’s role is listed in the parts list.

  • Control board × 1 — Manages the bus and reads the sensor.
  • Pressure and temperature sensor × 1 — Converts the measurement into a digital value.
  • I2C display × 1 — Displays the readings.
  • 4.7kΩ resistor × 2 — Pulls the data and clock lines up.
  • +5V power rail × 1 — Supplies a common voltage to the devices.
  • 220Ω resistor × 1 — Limits the LED current.
  • Green LED × 1 — Indicates a successful read.

Build steps

Placement on the breadboard: the control board is on the left; the sensor and display sit side by side in the upper half (rows 5-12). The data line leaves pin 2 and the clock line pin 3; two 4.7kΩ pull-up resistors go to the power rail. The LED and 220Ω resistor are at the lower left and the common ground is on the bottom rail.

  1. Place the control board and connect its GND pin to the bottom rail. Tip: Without a ground connection the bus will not work.
  2. Add the sensor and display to the upper half and connect their power pins to the +5V rail. Tip: The ground pins of both devices must be common.
  3. Connect the data pins to board pin 2 and the clock pins to pin 3. Tip: Two devices on the same line use different addresses.
  4. Place two 4.7kΩ resistors between power and the data and clock lines. Tip: Without pull-up resistors the lines float.
  5. Connect the LED with a 220Ω resistor to board pin 4. Tip: Connect the cathode to ground.
  6. In the simulation, change the sensor value and watch the display update. Tip: The LED lights once on every read.

How it works

A two-wire bus uses a single clock line and a single data line. Clock pulses synchronise the bits while the data line carries one bit at a time. When the bus is idle, pull-up resistors hold the line HIGH; the talking device pulls it LOW. Every device has an address set by the manufacturer; the board sends the address first and then issues a read or write command. This lets several devices communicate over the same two wires. The sensor turns its measurement into a digital number; the board takes that number and passes it to the display. The display keeps the incoming characters in its own memory line and shows them continuously. This setup is the clearest example of addressing and a shared bus.

Expected result

The display shows the sensor’s current pressure and temperature values; the green LED lights briefly on each read.

Tips and common mistakes

  • If the display shows nothing, try swapping the data and clock lines.
  • If two devices use the same address, the bus conflicts.
  • Do not skip the pull-up resistors; the lines will float.
  • Long wires corrupt data integrity, so keep the wires short.

Try it yourself

  • Show the sensor value on the display.
  • Light the LED once on every successful read.
  • Add a second measurement line to the display.

What you learn in this circuit

  • Explains the logic of a shared two-wire bus.
  • Understands address-based device selection.
  • Justifies the need for pull-up resistors.
  • Sets up the data flow from sensor to display.

Finding the parts

If you want to build this project in real life, you can get the parts from hobidevre.com.

Looking for more project ideas? Browse the guides on the hobidevre.com blog.

You may also like

Try the simulators

You need an account to use the simulators. Create one to save your work.

Keep learning

Reinforce what you read on this page with our own resources.

Deepen this topic

You can also see the same topic in short definitions and full explanation pages.