I am currently working on a project for my work where I want XBee3 to interact with several motor drivers GPIOs.
Of course the XBee3 by itself cant do that (15 GPIOs per drivers, up to 6 drivers). So I looked around bought several I2C GPIO Extenders (PCF8574N, MCP23016, MCP23017) and I found that I could only make it work with the MCP23017.
My idea was to make an XBee PCB and a GPIO Extender PCB and then use 1 wireless board and several motor boards together. I made some very simple circuit design and made a few of them. And at first it showed great result.
I had 1 XBee board and 2 Motor GPIO Extender board and I could control both motor and read their output throu Zigbee wireless network.
But then I made another module with 3 GPIO extender board and it all went crazy. I can control, somehow the 3 motors but i get some weird delays sometimes and most importantly the GPIO extender read wrong values and output wrong values, which in turn make the motor move without my consent.
I have been checking around for a week now and tested plenty of stuff, time to ask for help!
I didnt at first but now I have a 0.1uF capacitor at each MCP and XBee supply.
I started with at 10k ohm pull up on SDA and SCL, i added another resistor at the "end" of the bus and now overall the resistance is 2.5k ohm. Should I remove the 10k ohm that is near the start of the bus?
when i test each gpio extender board with the same xbee board it all work well.
In my micropython i2c setup I only set the output pins and leave the rest of the register to default values.
I have a 1A 3.3V regulator, i was worried it might not be enough so I bought a 2A one, still waiting for the delivery.
I am reading the GPIOA and GPIOB once every 100ms for each extender (is that too fast?)
I am only writing to the OLATA and OLATB if I send a message throu zigbee network, and the problems occurs even if I send nothing.
The GPIO of the extenders are all 3.3V supply, same as XBee3 and I use photocouplers to change from 3.3V to 24V of the motor drivers. All extender input pins have a 10k ohm pull down.
I am receiving an oscilloscope soon.
If anyone has any suggestion on how to make it work or what to test please let me know