problem with motor hat

Moderators: adafruit_support_bill, adafruit

Forum rules
Talk about Adafruit Raspberry Pi® accessories! Please do not ask for Linux support, this is for Adafruit products only! For Raspberry Pi help please visit: http://www.raspberrypi.org/phpBB3/
Locked
User avatar
Spinbeam
 
Posts: 19
Joined: Tue Aug 25, 2020 7:49 pm

problem with motor hat

Post by Spinbeam »

Hi
I am trying to use a rpi400 and a motor hatto control a small Nem 8 stepper(from adafruit)

I can get it to go forward but not backwards'

forward it works great

the code is just copy paste and i change FORWARD to BACkWARD
thank you for your help

Dean

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: problem with motor hat

Post by adafruit_support_bill »

What are you using as a power source for the motor?
What happens when you try to run it backwards? Does it move or vibrate in any way?

User avatar
Spinbeam
 
Posts: 19
Joined: Tue Aug 25, 2020 7:49 pm

Re: problem with motor hat

Post by Spinbeam »

Good morning

on backwards the motor does nothing not even vibrate

The power supply I am using is the adjutable power supply (from adafruit) set to 5V

I was wondering is the default Baud rate of the i2c set too fast on the rpi?


thank you again for your help

Dean

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: problem with motor hat

Post by adafruit_support_bill »

If it were a problem with the motor, I'd expect to see at least some vibration.

Can you post the code you are using to test the backward direction?

User avatar
Spinbeam
 
Posts: 19
Joined: Tue Aug 25, 2020 7:49 pm

Re: problem with motor hat

Post by Spinbeam »

Hi
here is my code

I tested the motor using the motor control featherwing. It functions correctly so as you stated it is not the motor
thanks again for all this help

# Stepper motor control
import time
import board
from adafruit_motor import stepper
from adafruit_motorkit import MotorKit

print('setting I2C comm')
K = MotorKit(i2c=board.I2C())

print('setting up motors')
K.stepper1.onestep(direction=stepper.FORWARD,style = stepper.DOUBLE)

for t in range(200):
K.stepper1.onestep()
time.sleep(0.01)
K.stepper1.release()

K.stepper1.onestep(direction=stepper.BACKWARD,style = stepper.DOUBLE)
for t in range(200):
K.stepper1.onestep()
time.sleep(0.01)
K.stepper1.release()

print('done')

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: problem with motor hat

Post by adafruit_support_bill »

I tested the motor using the motor control featherwing. It functions correctly so as you stated it is not the motor
Were you using the exact same code for the featherwing?

No movement or vibration at all from the motor suggests that it is a software isssue.

The only difference between FORWARD and BACKWARD is the sequence of energizing the windings in the motor.

Sometimes a motor will have a bad winding or an alignment problem which can result in asymmetrical performance. But in those cases, it will at least vibrate or show some signs of life.

Another potential fault is a bad leg on one of the H-Bridges on the board. This can also result in asymmetrical performance. But it should also at least vibrate when attempting to move.

The fact that it runs in one direction indicates that the H-bridges are at least 75% functional. Even if only one leg of one H-Bridge were functional, it should produce some signs of life at the motor.

User avatar
Spinbeam
 
Posts: 19
Joined: Tue Aug 25, 2020 7:49 pm

Re: problem with motor hat

Post by Spinbeam »

Sorry for the slow response Im at work..

I didnt email myself a copy of that code
if it helps, the motor works correctly off a DRV8833

i upated blinka and the adafruit_motorkit and adafruit_motor
last evening and the motor did the same

Dean

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: problem with motor hat

Post by adafruit_support_bill »

We can try replacing the HAT. The driver circuitry on the FeatherWing is identical to the driver circuitry on the HAT. So they should behave the same way when using the same code.

Please contact [email protected] with a link to this thread and request a replacement.

User avatar
Spinbeam
 
Posts: 19
Joined: Tue Aug 25, 2020 7:49 pm

Re: problem with motor hat

Post by Spinbeam »

Good morning
I found the problem
was in the code

writing in the loop kit.stepper1.onestep() resets to default values

intsead i must use kite.stepper1.onestep(direction=stepper.BACKWARD,style=stepper.DOUBLE)

thanks you again for all the great help

Dean

Locked
Forum rules
Talk about Adafruit Raspberry Pi® accessories! Please do not ask for Linux support, this is for Adafruit products only! For Raspberry Pi help please visit: http://www.raspberrypi.org/phpBB3/

Return to “Adafruit Raspberry Pi® accessories”