#I2C Error in Adafruit DC and Stepper Motor HAT for Raspberry Pi

1 messages · Page 1 of 1 (latest)

fresh grotto
fresh grotto
#

The motor is connected to M1

#

Power supply is 4 AA 1.2 volt cells in series

fresh grotto
#

I have also been advised to use alternate code.

Define kit = MotorKit(i2c=board.I2C(), address = 96)

fresh grotto
#

Soldering.

fresh grotto
#

Tried using address as parameter

#

Code:

# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
# SPDX-License-Identifier: MIT

"""Simple test for using adafruit_motorkit with a DC motor"""
import time
import board
from adafruit_motorkit import MotorKit

kit = MotorKit(i2c=board.I2C(), address = 0x70)

kit.motor1.throttle = 1.0
time.sleep(0.5)
kit.motor1.throttle = 0

#

————

#

Here is me running the blinka test code

#

This is the code:

import board
import digitalio
import busio

print("Hello blinka!")

# Try to great a Digital input
pin = digitalio.DigitalInOut(board.D4)
print("Digital IO ok!")

# Try to create an I2C device
i2c = busio.I2C(board.SCL, board.SDA)
print("I2C ok!")

# Try to create an SPI device
spi = busio.SPI(board.SCLK, board.MOSI, board.MISO)
print("SPI ok!")

print("done!")

vagrant wave
#

you need to use backticks, not smartquotes to get the code blocks to format correctly

#

i looked at your screenshots, and for some reason the Python code isn't detecting the I2C devices that your i2cdetect commands are, which is kind of odd. i haven't touched Raspberry Pi in quite a while, so maybe someone who's more familiar with it can help

fresh grotto
vagrant wave
#

you can link the thread to make it easier to find when you do post there

fresh grotto
#

Attempted reflow. Same issue

fresh grotto
#

@novel sedge , may I have help?

novel sedge
#

do you know how to run python interactively? to type commands in REPL?

fresh grotto
novel sedge
#

yep

#

that's it

#

REPL is just the >>> prompt

#

run python3 and the try the command interactively

#
import board
from adafruit_motorkit import MotorKit
kit = MotorKit(i2c=board.I2C())
novel sedge
#

yep

fresh grotto
novel sedge
#

unfortunately it's likely still a connection issue

#

that Remote I/O error is pretty much always connection related

#

is it still showing up reliably in a scan?

fresh grotto
novel sedge
#

these two

#

try scanning also via REPL

#

exit and relaunch python3

#

then:

import board
i2c = board.I2C()
i2c.try_lock()
i2c.scan() 
novel sedge
#

not sure where that came from

#

but the scan is not returning any addresses

fresh grotto
#

Is that supposed to detect i2c addresses?

novel sedge
#

yep. addresses would be in the []

fresh grotto
#

How come that is empty but the other command returns 60 and 70 address?

novel sedge
#

not sure. but potentially another indication of marginal connections.

fresh grotto
#

Could I test I2C with another device or does it have to designed for it?

novel sedge
#

do you have some other I2C device?

fresh grotto
#

I'm not sure what that may be. The only HAT I have is this Motor HAT. I've got an assortment of components like Ultrasound sensors and small LCD screens

#

I also have a Pi Pico and an RPi 4

novel sedge
#

those may or may not be i2c

#

can you link to product pages?

fresh grotto
#

It's getting late so I'll respond fully tomorrow but they are these

novel sedge
#

not i2c

fresh grotto
#

hahaahha I realised I had plugged in the HAT with only one row of GPIO pins when doing those tests

fresh grotto
fresh grotto
#

Cater

novel sedge
#

looks like addresses are showing up in REPL scan now. are things working now?