I'm working with a port expander for the pi to run four stepper motors from python. It was working great until I tried to also use a GPIO pin on the pi (not on the port expander) as an output. I was using the RPi library to control pin 22 on the pi, and this seems to have caused the smbus library, which I was using to control the port expander, to throw an input/output error (Error number 5). The program sometimes works fine even with the GPIO pin enabled, but it will randomly throw the error and the stepper motors will not move. I'm still not entirely sure as to the cause of the problem, but it seems like the RPi library is fighting with the smbus library for control over the pins. Is it possible that this is the problem? I'm going to need to control all GPIO pins on the pi plus the port expander. Is there a recommended way to do this without provoking this issue?

  • What port expander are you using? – CoderMike Jul 4 at 19:42
  • Here it is: adafruit.com/product/732 – Jasper Voss Jul 4 at 19:46
  • You can safely use all other GPIO but those in use for I2C (SDA/SCL). You have done something else wrong. Without clear photos of your wiring and software listings it is pointless speculating. – joan Jul 4 at 19:53
  • Possible mix up between BCM and board pin numbers? – Andyroo Jul 4 at 20:02
  • Nope, GPIO pin is working as expected – Jasper Voss Jul 4 at 20:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.