Reference

Last revision 2026/01/06

This article serves as a guide for Arduino enthusiasts, detailing library installation processes and advanced communication protocol descriptions, including I2C address calculation and resistor soldering techniques, to enhance the functionality of the DFRobot I2C address shifter.

Library

  • Library files applicable to Arduino: DFRobot BMI160 Github
  • Arduino IDE V1.8.19 (or below) installation library files:How to install library
  • Arduino IDE V2.0.0 (or above) can be installed by searching for the ‘DFRobot_BMI160’ library in the library manager.

Communication Protocol Description

I2C Address Calculate

The I2C address has 7bit, we define A6 as the highest bit and A0 as the lowest bit.
The address shifter always inverts A6 bit by default (from 0 to 1 and from 1 to 0). You can also control whether bits A5 or A4 are inverted or not by using the on-board dip switches.

Assuming that the default address of the sensor is 0x69, which is 0b1101001 in binary, after the sensor is connect to the address shifter:

Original Address(bin) A5 dip switch A4 dip switch New Address(bin) New Address(hex)
1101001 0 0 0101001 0x29
1101001 1 0 0001001 0x09
1101001 0 1 0111001 0x39
1101001 1 1 0011001 0x19

In the meantime, you need to be aware of the following.

  1. Gravity: The I2C address shifter needs to be powered up again after adjusting the on-board dip switch to set the new address.
  2. If you are using a Windows computer, you can use the programmer function of the calculator that came with your computer to do hexadecimal (HEX) to binary (BIN) conversions
  3. In the above address description: 0b is the prefix of a binary number, which means the data that follows is in binary; 0x is the prefix of a hexadecimal number, which means the data that follows is in hexadecimal.

Advance Tutorial for Resistor Solder

Gravity: The I2C address shifter can be switched via on-board dip switch to set the sensor to four different addresses.

If this is not enough for your needs. We have reserved a 0805 resistor pad (R2) on the module, you can refer to the schematic and Page 9 of the datasheet at the bottom of this wiki,solder the resistor to control whether the remaining I2C address bits are inverted.

This pad is connected to the XORL pin, which controls whether the lower four bits of the I2C address are inverted or not. We fixed RLB (R1 in our schematic) to 100kΩ, and you can calculate the resistance value of RLT (R2 in our schematic) and solder it yourself.
Here is how we determine an R2:

  1. Firstly, from the datasheet, the module determines whether a bit of the I2C address is inverted or not by the voltage of the XORH or XORL pin, i.e. the ratio of VXORH or VORL relative to VCC. In table 2 and table 3 of the datasheet, a 1 under bit means inverted and a 0 means no inverted.

  2. Assuming that the module supply VCC is now 5V, we want to set A3-A0 to a 1 0 0 0 mode, i.e. A3 inverts and A2~A0 do not. That means the VOXRL/VCC ratio should be 0.53125 ±0.015

  3. To help you quickly calculate the resistance, the DFRobot R&D team has summarised a general formula:

    [VCC/(R1+R2)]R1=VXORL

    Where VCC has been specified as 5V in the previous assumptions and R1 is known to be 100kΩ, the target VXORL should be 0.53125*5V = 2.65625V
    After substituting all the known parameters into the general formula above, it is possible to arrive at R2 ≈ 88.23529kΩ

  4. Given that the calculated R2 is not a common resistance value, we need to match it to the closest common resistance value and verify this common resistance value by substituting it back into the common formula.
    In this case, the closest common resistance value to 88.23529kΩ is 86.6kΩ, which when substituted into the calculation gives VXORL ≈ 2.67953V, or VXORL/VCC ≈ 0.53906. This ratio falls in the range of 0.53125 ± 0.015, so we can use 86.6kΩ as the resistance value for R2.

To help save you the tedious calculations, we've helped you list a few R2 resistance values that we've verified:

R2 A3 A2 A1 A0
91kΩ/86.6kΩ 1 0 0 0
68kΩ 1 0 0 1
51kΩ 1 0 1 0
39kΩ 1 0 1 1
27kΩ 1 1 0 0

If you are unsure of the new address after soldering the resistor, we recommend using an Arduino or ESP32 and uploading the I2C scanner to find our the new address.

Principle

The DFRobot I2C address shifter provides a hardware solution, where the address conversion is done entirely inside the shifter, and the I2C physical address can be changed directly with a simple wire connection, without the need for complex port switching in the code, and without triggering any I2C timing bugs.

The address shifter always inverts A6 bit by default (from 0 to 1 and from 1 to 0). You can also control whether bits A5 or A4 are inverted or not by using the on-board dip switches. For the lower four bits (A3-A0), you can solder a resistor to the R2 pad to control their inversion based on the voltage ratio of VXORL to VCC.

Other Supplementary Information

More Resources

WIKI Modification History

Doc version Modification Time Editor Comment
V1.0 2025.2.25 Roger Ye First Release
V1.1 2025.3.14 Roger Ye Update PCB Dimensional drawing

Product Version

Product version Modification Time Editor Comment
V1.0 2025.2.25 Roger Ye First Release

Was this article helpful?

TOP