Can I make two redboards communicate with sparkfun explorers and xbees with qwiic?

I have:

  • two redboard esp32s,
  • xbee two explorers usbc,
  • and two xbees.
    There is a qwiic connecter on each explorer that Im using to connect to the respective redboard esp32s. These explorers don’t have a qwiic library in arduinoIDE, im assuming they are a master and not a slave or something like that.

Is it possible to communicate between two boards with this setup? I have found zero code to do this online. I know the alternative is using serial, but I dont want to solder the pins on the explorer if I can use the qwiic connecter instead. PLZ HELP :frowning:

Yes, you can do it either way:

reboard → explorer → xbee : xbee ← explorer ← redboard
xbee → explorer → redboard : redboard ← explorer ← xbee

The main thing is to program either the redboard or the xbees to pass their info over i2c to the other…it just depends on whether you want the xbee to interface with one another or the redboards to (over bt/wifi)

THANK YOU, do you know what library it is to talk over the qwiic with i2c? Are the pins on the qwiic connecters just digital pins i can access with wire.h? I plan on putting some example code in here in case someone after me wants.
EDIT: How would I know the explorers i2c address to connect to it also?

Don’t know if this works on esp32 but it’s worth a try.

https://docs.arduino.cc/learn/communication/wire/

https://www.arduino.cc/en/Tutorial/LibraryExamples/MasterWriter

Yes - the qwiic connector is the 4-wire i2c bus, which are 3.3v, GND, SDA and SCL

Yes, you call the SDA and SCL via the standard wire.h :slight_smile:

For point-to-point ‘wireless cable,’ I’ve had superb results with the Xbees with 802.15.4 FW. I make coord/node pairs in XCTU and, if they’re in range, they just work. I’ve used SFE serial explorers for interface and power supply and they’re completely transparent to the RS232 devices, just like they’re wired to each other.

1 Like

I never forgot about this and im still trying to finish it. For anyone out there please never do this its almost impossible never use micropython on an xbee and ive wasted a good portion of my life on it at this point.
Im using Xbee as an I2C passthrough like this:
reboard(qwiic) → explorer → xbee : xbee ← explorer ← redboard (qwiic)

Redboard is just set up to echo back everything that its sent through i2c and that parts not failing.

The xbee receives data just fine and half the time it works to send data from i2c to the other xbee (which is connected to my computer so i can test and send fake data). But the other half it gets caught in an infinite loop saying it cant connect. Here is the relevant code:

while True:
    time.sleep(0.2)  # Small delay to prevent overload
    try:
        # 1️⃣ Read from I2C (ESP32 sending data)
        ...

        # 2️⃣ Write back to I2C if we have received data from XBee
        ...

        # 3️⃣ Send data received from I2C over XBee
        if i2c_received_queue:
            try:
                data_to_send = i2c_received_queue.pop(0) #remove the first item.
                xbee.transmit(DEST_XBEE_ADDR, data_to_send)
                print("Sent Wirelessly (local_xbee --> remote xbee)", data_to_send)
            except Exception as e:
                print("Error sending from I2C overXbee:", e)
                i2c_received_queue.insert(0, data_to_send) #put it back at the front.
                print("Data re-queued.") # tell the user.
                time.sleep(1)

The output (on the local xbees serial console):

Data Length Read: 8
I2C Read (i2c --> local_xbee): b'testasdf'
Error sending from I2C overXbee: [Errno 7107] ENOTCONN
Data re-queued.
Error sending from I2C overXbee: [Errno 7107] ENOTCONN
Data re-queued.
Error sending from I2C overXbee: [Errno 7107] ENOTCONN

I can’t tell what’s working and not working but I’ll stick up for the XBees again. Please post the particular XBee variants and firmware you’re using.

Since you have a pair of Explorers & XBees, you can exhaustively test the wireless aspects of the link.
To do so, connect them both to a PC and run terminal sessions to each other.

I’m not set up to fully test but, from memory:
Load the 802.5.4 FW if not already: Xbee2 this was default, Xbee3 has to be ‘degraded’ from Digi’s Zigbee.
Make one a coordinator, the other a node and note addresses.
Copy/paste each other’s address to pair them. You can run duplicate instances of XCTU so it’s pretty easy.

At one point, I had 12-15 pairs of 802.15.4 dongles (not Xbee but similar & compatible) in the same environment in various fringes of range and interference and they honestly worked beyond expectation. Our end user had problems with water getting into the cabling and dongles (the whole reason for the wireless project to begin with) but the comm links were solid.

1 Like

Hey! With your current setup, the Qwiic connector is really just I²C, and you’re right XBee explorers aren’t I²C devices, so there’s no way for them to communicate over Qwiic like sensors would. Unfortunately, the explorers are designed for serial communication, so you’d need to use the TX/RX pins. If you’re trying to avoid soldering, maybe consider jumper wires or a breadboard-friendly adapter. I²C just won’t work for XBee communication in this case.

Ive narrowed the problem down, the i2c part is working fine, I’ve tried every firmware and lots different settings, comms starts failing any time micro-python is being run. I’m running an echo server example from GitHub. Any code, and it tweaks out.

The 802.15.4 FW and Zigbee firmware both didnt work. They didnt even start the micropython. Im using the black 2.4HZ xbee RF variants. Im just having them send to broadcast addresses.

It may likely be my unit is defective, but my advice for anyone in the future is to just use Xbees in transparent mode over serial at all costs. Life is too precious to spend it on something for all your effort to go to waste Ill just have to find a way to solder or something.