Field notes

reference ·

Two sensors, one address

Read I²C addresses, pull-ups, and rise-time constraints before turning a bus problem into a firmware rewrite.

On this page

I²C lets multiple devices share a bus. It does not promise that any arbitrary collection of breakout boards will become a well-behaved committee when connected together.

Address conflicts and pull-up arrangements are two useful things to investigate before rewriting the driver. The wiring diagram deserves a turn at the keyboard.

Start with the address actually selected

The BME280 chip supports address selection through SDO. Its documented addresses are 0x76 and 0x77. Adafruit documents 0x77 as the default for its breakout and explains how to select the alternative. An unidentified breakout may use a different default arrangement. Bosch Sensortec Adafruit

Record addresses as seven-bit addresses when that is what the device documentation specifies. Do not mix an address with a shifted address byte that includes a read/write bit.

If two devices share an address, first check whether one supports an alternate setting. Otherwise consider separate buses or an appropriate bus multiplexer. Which solution is suitable depends on the actual devices and controller. A scanner is useful evidence of responses, not proof of identity or complete compatibility.

Count the pull-ups

Several breakout boards may each contribute pull-up resistors. Parallel resistors reduce the effective resistance. Two equal 4.7 kΩ resistors in parallel yield 2.35 kΩ; three yield about 1.57 kΩ. Those are arithmetic examples, not recommended values for your bus.

A stronger pull-up can improve rising edges but demands more current when a device pulls the line low. A weaker pull-up can leave a slow rising edge. TI’s application report gives minimum and maximum resistance calculations using the relevant voltage, sink-current, rise-time, and capacitance constraints. Texas Instruments

Work one explicit calculation

Using hypothetical design inputs of 3.3 V, maximum low-level voltage 0.4 V, and allowed sink current 3 mA:

Rmin = (3.3 − 0.4) / 0.003 ≈ 967 ohms

For an allowed rise time of 300 ns and assumed bus capacitance of 200 pF:

Rmax = 300e-9 / (0.8473 × 200e-12)
     ≈ 1,770 ohms

These inputs illustrate the equations and correspond to the kind of calculation in TI’s report. They do not establish your bus capacitance or your devices’ allowed sink current. If your calculated minimum exceeds the maximum, there is no resistor satisfying those assumptions; change the design or revisit the evidence rather than averaging the two limits.

Check the voltage at the resistor

Pull-ups connect signals to a rail. Verify that rail against every participating device’s input limits. A controller supply label alone does not establish what voltage appears on a bus assembled from several modules.

Inspect documentation and the unpowered circuit first. Then, with a suitable setup, observe actual signal behavior when necessary. A logic analyzer can decode transactions; understanding edge shape may require an appropriate oscilloscope measurement. Do not infer electrical margin from a decoder occasionally recognizing the right bytes.

Preserve the diagnosis

Record the board revisions, selected addresses, controller pins, bus speed, pull-up arrangement, rail, and cable arrangement. Save a trace with the test that produced it. If you change one board or cable, note the change rather than assuming the old observation still describes the assembly.

The useful end state is not “I²C is cursed.” It is a specific explanation of which constraint the previous circuit failed to satisfy. Curses are notoriously difficult to put in a regression test.

Next: Your battery estimate forgot the board includes the power budget that the bus also participates in.

Sources

Put this to work

More field notes