I have just shared content in Guides > Raspberry Pi: “How to use Stepper Motors and DC Motors with a Raspberry Pi - Adafruit DC & Stepper Motor HAT”
Read more
Hey all,
Just learned some more information on this Adafruit HAT. If you want to use GPIO Pins (say for limit switches) the below image shows exactly what Pads are broken out and unused by the HAT. These pads are directly connected to the corresponding pins on the GPIO header and labeled correctly.
Hi, I’m sorry to bother you, I bought a stepper motor hat but can’t seem to get the code to run. I’ve soldered on the contacts correctly, and downloaded the libraries as per the tutorial but I’m getting the following error:
Traceback (most recent call last):
File “/usr/local/lib/python3.9/dist-packages/adafruit_bus_device/i2c_device.py”, line 175, in __probe_for_device
self.i2c.writeto(self.device_address, b"")
File “/usr/local/lib/python3.9/dist-packages/busio.py”, line 207, in writeto
return self._i2c.writeto(address, buffer, stop=True)
File “/usr/local/lib/python3.9/dist-packages/adafruit_blinka/microcontroller/generic_linux/i2c.py”, line 60, in writeto
self._i2c_bus.write_bytes(address, buffer[start:end])
File “/usr/local/lib/python3.9/dist-packages/Adafruit_PureIO/smbus.py”, line 303, in write_bytes
self._device.write(buf)
OSError: [Errno 121] Remote I/O error
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “/usr/local/lib/python3.9/dist-packages/adafruit_bus_device/i2c_device.py”, line 181, in __probe_for_device
self.i2c.readfrom_into(self.device_address, result)
File “/usr/local/lib/python3.9/dist-packages/busio.py”, line 197, in readfrom_into
return self._i2c.readfrom_into(address, buffer, stop=True)
File “/usr/local/lib/python3.9/dist-packages/adafruit_blinka/microcontroller/generic_linux/i2c.py”, line 67, in readfrom_into
readin = self._i2c_bus.read_bytes(address, end - start)
File “/usr/local/lib/python3.9/dist-packages/Adafruit_PureIO/smbus.py”, line 170, in read_bytes
return self._device.read(number)
OSError: [Errno 121] Remote I/O error
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “/home/acdwi/Steppe-Motor-Control.py”, line 8, in
kit = MotorKit(i2c=board.I2C())
File “/usr/local/lib/python3.9/dist-packages/adafruit_motorkit.py”, line 82, in init
self._pca = PCA9685(i2c, address=address)
File “/usr/local/lib/python3.9/dist-packages/adafruit_pca9685.py”, line 150, in init
self.i2c_device = i2c_device.I2CDevice(i2c_bus, address)
File “/usr/local/lib/python3.9/dist-packages/adafruit_bus_device/i2c_device.py”, line 62, in init
self.__probe_for_device()
File “/usr/local/lib/python3.9/dist-packages/adafruit_bus_device/i2c_device.py”, line 184, in __probe_for_device
raise ValueError(“No I2C device at address: 0x%x” % self.device_address)
ValueError: No I2C device at address: 0x60
If anyone has any suggestions I’d be incredibly grateful! You seem very knowledgeable
Many thanks,
- Richard Johnson
This means that the I2C code couldn’t find any device on the I2C bus with an address of 0x60. This is the default address for the PCA9685 PWM controller, so it should be found if the hat is properly connected. Have you changed the address by soldering across any of the jumpers A0 through A4?
You can check what I2C devices are visible to your code using the procedure described here:
Raspberry Pi | How to Scan and Detect I2C Addresses | Adafruit Learning System
Have you previously run any other I2C devices?
You should post photos of the hat and the setup so that other eyes have a chance to spot what you might have missed.
Hi
Thank you so much for you insight! I’ll look into it right away and see how it goes
Your brilliance and intellect are highly commendable!
I’m chuffed to bits that I actually heard back from someone
Many thanks!
- Richard Johnson
I’d like to add some sanity checks:
- Is I2C enabled? eg. through
sudo raspi-config
then under theinterfaces
- can you share some pictures of your setup - we often find this really helpful