So I am trying to run a simple I2C scan program in Micropython that scans for the I2C device I have connected to my XBee3 and then simply prints out that it saw the I2C device during the scan.
I'm using the MCP23017 DIP device... here is the pdf with the port schematic:
file:///C:/Users/Elliot%20Dunn/Desktop/MCP23017_Hardware_Manual.pdf
Here is the xbee3 hardware pdf, I am using the THT module.. page 27 has the pin outs.
My hardware connections are as follows:
MCP Vss pin 10 to GND
MCP Vdd pin 09 to 3.3V XBee supply pin 1(on xbee THT)
MCP A0,A1,A2 pins 15, 16, 17 to GND
MCP reset pin 18 to 3.3V
MCP SCK pin 12 to XBee pin 19 SCK
MCP SDA pin 13 to XBee pin 7 SDA
XBee connected to computer and connection confirmed to be all good.
the code I am using:
from machine import I2C
print(" +
+")
print(" | XBee MicroPython I2C Scanner Sample |")
print(" +
+\n")
# Instantiate an I2C peripheral.
i2c = I2C(1)
# Scan for I2C slaves connected to the interface and print their address.
for address in i2c.scan():
print("- I2C device found at address: %s" % hex(address))
That's it. I have checked all the GND lines, have checked voltages at connections with my multimeter.
So my question is as follows:
My setup doesn't find anything in the scanning process.. or at least the program only prints out the print statements and that's it. Anything that I am clearly forgetting to implement? Not sure why my program doesn't work to have the xbee scan and "see" the I2C device.
thanks
