XBee3 I2C Issues on Custom Board


I have been using the XBee3 to read a simple temperature, pressure, humidity sensor via I2C on the development board and everything works great. However, when I dock the XBee3 into our custom board, I cannot access the device. I don’t believe the XBee3 is even detecting it via .scan(). I have noticed that while Vcc = SDA, the SCL voltage is much lower. If my Vcc is around 3.4V, the SCL line is barely 2.0V.

I did take a look at the schematic for the XBIB-U-Dev Rev B development board to see what else the SCL and SDA pins are connected to on the board. My thoughts were to mimic this condition on our board to get it to work, but I am still stuck. The SCL line (DIO1) is connected to one of the buttons. The SDA (DIO 11) is connected to a 10kOhm resistor and then connected to the base of a PNP transistor which is used for lighting and LED. The emitter side is connected to Vcc and the collector to the LED, then ground.

On our custom board, the SDA and SCL pins are connected directly to headers, then to the I2C device. The particular I2C device is actually an Adafruit BME280 sensor and has level shifting, a 3-5V input regulator and pull-up resistors already on board. Our board runs off of a battery pack with very simple solar recharging. The battery voltage ranges from 3.5-4.0V depending on charge level.

A few things I tried already…

  1. Tinkering with the internal pull-up/pull-downs on the XBee3 (tried Up, Down, and disabled)
  2. I changed power supply for our board from the battery, to a regulated power supply
  3. Tried a 2.2kOhm and 1.0kOhm resistor across the SCL line and Vcc in an effort to further pull-up the SCL. It got the voltage up, but did not work. Unfortunately, I don’t have a scope.
  4. Tried different I2C units - had several laying around in addition to other similar knock-offs.
  5. Changed length of wire between XBee3 and the I2C device. At one point, had it about 4 inches from the XBee.
  6. Checked, double checked, and then tripled checked until I was going crazy, my pinouts, my connections, and all my wiring.
  7. One strange thing to note, I had two of these working great for about 3 days, patted myself on the back, and then they just quit working and I can’t figure out why. I was thinking there was some sort of “event” that blew something up, but I swapped boards, I checked the I2C devices on a separate board (Arduino), I inspected traces. I figured if I had blown something on the XBee3 (say too much voltage due to a bright sunny day when the battery was fully charged and the solar panel was pumping full) it would no longer work on the XBIB-U-Dev board. The I2C devices that were on there work fine too - on the XBIB dev board and on an arduino.

Bottom line, it seems that things are functioning as it should with one small issue. I cannot located what is causing me so much grief and my sanity. Any input will help salvage the last of sanity.



I figured out that I had two problems.

  1. Headers were trashed - The headers we used to dock the XBee3 where not making good contact withe the XBee device. This has been identified to happen on several boards. High reliability parts will be used in future prototype runs.

  2. Cable - It turned out that the cable we were using was causing crosstalk. We switched out to a ribbon style cable and the issues have been eliminated. We were using a good quality 4 conductor, shielded and grounded cable. It must be the twists in the cable causing the issue. We didn’t think it was the cable at first since another unit was working well…the cable on the other unit was very short which must not have led to issues.

1 Like

Hi Larry,

Did you use internal register in your project? I wanto to read acceleration from an IMU module which includes Gyro, Magnetometer and accelerometer using XBee3, but I have to use internal register to access the specifc sensor after I assigned the I2C device address to the master. If yes, please show me how to do that. Thanks a lot!

Yes, all I2C communications rely on reading the registers from the device. Unfortunately, devices are all very different and you must read the documentation for the device in order to read each register and assemble the bits in the proper order. This can be quite tedious, however for many devices on the market, someone has already written the “drivers” to read them. I would look for them for your particular product.

As an example on how to read registers, search for libraries related to the Bosch BME280 device. It is a common temperature, pressure, and humidity device. You should be able to find any number of them for Python. I have found a few for uPython which is what the XBee3 uses. Within these libraries, you should be able to see how to access the registers of the device. You will need to mimic this for your device.

Hi Larry,

Did you write your own BME280 library? I found a couple for micropython but wondering if there is anything that needs to be added to make it work on an XBee3. I’m asking as I’m working through a book that uses a BMP280 sensor and the author had to tweak an existing micropython libray.