Adafruit Motor Hat Motor Jumps if Speed Is Set Again

DC Motor & Stepper Motor HAT: stepper not running smoothly

Please be positive and effective with your questions and comments.

DC Motor & Stepper Motor Lid: stepper not running smoothly

How-do-you-do,

I recently bought a DC Motor & Stepper Motor HAT from yous and installed (following https://learn.adafruit.com/adafruit-dc-and-stepper-motor-hat-for-raspberry-pi?view=all#overview) everything to work with the same model of nema17 stepper motor you have on the website.

Later installing the software and finding the right pairs of wires, I tried the stepperTest.py file. The motor turns in one directection and so the other as expected but the rotation is very slow and hasty as if the motor was going forrad 2 steps and one back constantly. When the program uses Single steps the motor going back is near visible. The movement when using Microsteps is seem smoother merely I tin can still feel the motor blocking from fourth dimension to time. I also tried sapping the cable pairs around to no avail.

I inverse the number of steps in each direction, tried with the function oneStep(direction, step-mode) in a loop and tried with an other motor but the result is always the aforementioned. Moreover, increasing the RMP with setSpeed has no visible effect. Whatever the value, the motor turns at a speed of a few rotations per minute in singlestep mode.

Does anyone accept any experience with this issue? Exercise you think it is a code issue? Or is the Chapeau simply besides limited to use a stepper motor efficiently?

Pitiful if this has been asked before. I searched the web but could not find a solution to my trouble.

EDIT: If i set the speed to 255 and practice a simple while loop with the one step function:

Code: Select all | TOGGLE Total SIZE
while(True)
    myStepper.oneStep(Adafruit_MotorHAT.FORWARD, Adafruit_MotorHAT.Single)

The motor moves randomly back and forth with no apparent logic as when and why information technology reverses direction


EvilGarfield
Posts: 8
Joined: Mon Dec xix, 2016 9:35 am

Re: DC Motor & Stepper Motor HAT: stepper not running smooth

by adafruit_support_bill on Mon Dec 19, 2016 10:twoscore am

The SINGLE step mode is the weakest and roughest of the stepping modes and more than decumbent to skipping steps.

What are you using to power the motor?


adafruit_support_bill
Posts: 83716
Joined: Sat Feb 07, 2009 x:11 am

Re: DC Motor & Stepper Motor Lid: stepper not running smooth

by EvilGarfield on Mon Dec 19, 2016 x:49 am

How-do-you-do Beak,

Thanks for your respond. I am using a 12V 2,24A power supply.
I know that single is non the most precise. I can utilise microstep and then information technology runs a chip smoother (still non perfect) but the fastest rotation I get is i-2 RPMs.
I noticed that when I start the script the motor changes direction several times during four-5s and then chooses one direction and keeps it but it is notwithstanding vibrating a lot and not turning very polish. Could this be linked to the baudrate settings of my pi?


EvilGarfield
Posts: viii
Joined: Mon Dec 19, 2016 9:35 am

Re: DC Motor & Stepper Motor Chapeau: stepper not running smooth

by adafruit_support_bill on Monday Dec 19, 2016 11:00 am

Do you have a link to the specifications for the motor yous are using? The NEMA 17 designation merely specifies the location of the commodities-holes on the faceplate. In that location can exist major differences in electrical characteristics betwixt different NEMA 17 motors.

Besides, please post the code y'all are using.


adafruit_support_bill
Posts: 83716
Joined: Saturday Feb 07, 2009 10:11 am

Re: DC Motor & Stepper Motor Lid: stepper not running smooth

by EvilGarfield on Monday December nineteen, 2016 11:23 am

The motor I am using is this one
I read on the forums that the HAT was designed for motors with a loftier phase resistance. And the specs on this one is the same as the i you lot take here

The first lawmaking I used was

Code: Select all | TOGGLE Full SIZE
#!/usr/bin/python
#import Adafruit_MotorHAT, Adafruit_DCMotor, Adafruit_Stepper
from Adafruit_MotorHAT import Adafruit_MotorHAT, Adafruit_DCMotor, Adafruit_StepperMotor

import time
import atexit

# create a default object, no changes to I2C address or frequency
mh = Adafruit_MotorHAT()

# recommended for auto-disabling motors on shutdown!
def turnOffMotors():
    mh.getMotor(1).run(Adafruit_MotorHAT.RELEASE)
    mh.getMotor(2).run(Adafruit_MotorHAT.RELEASE)
    mh.getMotor(three).run(Adafruit_MotorHAT.RELEASE)
    mh.getMotor(four).run(Adafruit_MotorHAT.RELEASE)

atexit.register(turnOffMotors)

myStepper = mh.getStepper(200, ane)      # 200 steps/rev, motor port #1
myStepper.setSpeed(255)          # thirty RPM

while (True):
    print("Single curlicue steps")
    myStepper.pace(100, Adafruit_MotorHAT.Astern,  Adafruit_MotorHAT.SINGLE)
    myStepper.step(100, Adafruit_MotorHAT.BACKWARD, Adafruit_MotorHAT.Unmarried)

    print("Double coil steps")
    myStepper.step(100, Adafruit_MotorHAT.FORWARD,  Adafruit_MotorHAT.DOUBLE)
    myStepper.footstep(100, Adafruit_MotorHAT.BACKWARD, Adafruit_MotorHAT.DOUBLE)

    print("Interleaved coil steps")
    myStepper.step(100, Adafruit_MotorHAT.Forrard,  Adafruit_MotorHAT.INTERLEAVE)
    myStepper.step(100, Adafruit_MotorHAT.BACKWARD, Adafruit_MotorHAT.INTERLEAVE)

    impress("Microsteps")
    myStepper.step(100, Adafruit_MotorHAT.FORWARD,  Adafruit_MotorHAT.MICROSTEP)
    myStepper.step(100, Adafruit_MotorHAT.Astern, Adafruit_MotorHAT.MICROSTEP)

And and then I changed it to

Code: Select all | TOGGLE Total SIZE
#!/usr/bin/python
#import Adafruit_MotorHAT, Adafruit_DCMotor, Adafruit_Stepper
from Adafruit_MotorHAT import Adafruit_MotorHAT, Adafruit_DCMotor, Adafruit_StepperMotor

import fourth dimension
import atexit

# create a default object, no changes to I2C address or frequency
mh = Adafruit_MotorHAT()

# recommended for auto-disabling motors on shutdown!
def turnOffMotors():
    mh.getMotor(one).run(Adafruit_MotorHAT.RELEASE)
    mh.getMotor(two).run(Adafruit_MotorHAT.RELEASE)
    mh.getMotor(3).run(Adafruit_MotorHAT.RELEASE)
    mh.getMotor(four).run(Adafruit_MotorHAT.RELEASE)

atexit.register(turnOffMotors)

myStepper = mh.getStepper(200, 1)      # 200 steps/rev, motor port #i
myStepper.setSpeed(255)          # 30 RPM

while (True):
    myStepper.oneStep(Adafruit_MotorHAT.BACKWARD, Adafruit_MotorHAT.DOUBLE)

As every bit sidenote, what effective speed can I expect from such a motor/HAT combination?


EvilGarfield
Posts: 8
Joined: Mon December 19, 2016 nine:35 am

Re: DC Motor & Stepper Motor Chapeau: stepper not running smooth

by adafruit_support_bill on Mon Dec 19, 2016 11:48 am

Code: Select all | TOGGLE Full SIZE
myStepper.setSpeed(255)          # 30 RPM

This may be your problem. The maximum speed achievable on a Pi depends somewhat on what else is running on it. But the theoretical maximum using the default i2c autobus speed is nigh 50 RPM. It is possible to increase the speed of the i2c bus.

http://raspberrypi.stackexchange.com/qu ... an-i2c-bus


adafruit_support_bill
Posts: 83716
Joined: Sat February 07, 2009 10:11 am

Re: DC Motor & Stepper Motor HAT: stepper not running shine

past EvilGarfield on Mon December nineteen, 2016 12:30 pm

Thank you again for your help!
The thing is, fifty-fifty when decreasing this value to below 30, the motion is the same. This pick doesn't seem to have any effect. If the value is 1, thirty or 255, my motor behaves the same.

I modified my config.txt to a higher baudrate as explained in your link but when I check it using

Code: Select all | TOGGLE FULL SIZE
  sudo cat /sys/module/i2c_bcm2708/parameters/baudrate

I become 0. I'1000 kind of confused. Sorry for all those questions, I'm new to this.


EvilGarfield
Posts: eight
Joined: Mon Dec xix, 2016 nine:35 am

Re: DC Motor & Stepper Motor HAT: stepper non running smooth

by adafruit_support_bill on Mon Dec nineteen, 2016 12:43 pm

If you post some photos showing your soldering and connections to the Lid we can take a look for any problems there.

Pi internals are not my forte, simply there may exist differences for the version of Linux you are running. If y'all search "raspberry pi change i2c baud charge per unit" yous tin can probably find the right command for the version you are running.


adafruit_support_bill
Posts: 83716
Joined: Saturday Feb 07, 2009 x:11 am

Re: DC Motor & Stepper Motor HAT: stepper not running smooth

by EvilGarfield on Tue Dec 20, 2016 3:55 am

Adept morning!

Here are the pictures of my soldering. I tested the connections and all of them have a < 30 ohm resistance. Also, I tried my motor with both ports and the result is the same.

I volition check this baudrate thing and see if it fixes the problem.

Attachments
_DSC0110.jpg
Motor wires connection
_DSC0110.jpg (530.49 KiB) Viewed 1859 times
_DSC0107.jpg
Bottom soldegrin
_DSC0107.jpg (427.76 KiB) Viewed 1859 times
_DSC0108.jpg
top soldering
_DSC0108.jpg (370.27 KiB) Viewed 1859 times

EvilGarfield
Posts: eight
Joined: Mon December nineteen, 2016 9:35 am

Re: DC Motor & Stepper Motor HAT: stepper not running smooth

past EvilGarfield on Tue Dec 20, 2016 4:11 am

Ok I got information technology to work by increasing the baudrate of my I2C ports to 400 KHz. Cheers a lot Neb ;)

The only matter now is that the motor start spinning at a certain speed for like 2-3s and then slows down for the residual of the control. Any idea where this could come from?


EvilGarfield
Posts: 8
Joined: Mon December nineteen, 2016 9:35 am

Re: DC Motor & Stepper Motor Chapeau: stepper not running smoothen

by adafruit_support_bill on Tue Dec 20, 2016 6:41 am

You are running on Linux, so timing is not guaranteed. Your motor control procedure is going to exist sharing the processor with whatever else is running on the Pi. If possible, shut down some of the other processes and services and come across how that affects your motor.


adafruit_support_bill
Posts: 83716
Joined: Sat Feb 07, 2009 10:11 am

Re: DC Motor & Stepper Motor Chapeau: stepper not running smooth

by MVkit on Friday Jan 27, 2017 ten:54 am

Hello i've got the same problem equally mentioned at the height. I tried the board with the Raspberry Pi 3 with 4.4.44 Kernel Version. The solution above doesn't work for me. It seems that I tin non set the I2C baudrate correctly. Could you please tell me how you did this?

I added the post-obit lines in /boot/config.txt

Code: Select all | TOGGLE FULL SIZE
dtparam=i2c_arm_baudrate=400000

Merely

Code: Select all | TOGGLE FULL SIZE
sudo cat /sys/module/i2c_bcm2708/parameters/baudrate

tells 0.
My osciloscope says it's at 5kHz for SCL.

I also tried ii dissimilar Motor Hats with two unlike Raspberry Pi three and an Arduino Uno and different Motors (DC and stepper, NEMA xi and 17).
Here'due south the motor datasheet https://world wide web.pololu.com/file/download/SY28STH32-0674A.pdf?file_id=0J686


MVkit
Posts: 1
Joined: Fri Jan 27, 2017 10:41 am

Re: DC Motor & Stepper Motor Lid: stepper non running shine

past shmulyeng on Mon Oct 23, 2017 iv:40 pm

Have either of you solved this problem? I'm experiencing the same event.


shmulyeng
Posts: 2
Joined: Monday Oct 23, 2017 4:40 pm

Re: DC Motor & Stepper Motor HAT: stepper not running smoothen

by chenp on Mon Jan 29, 2018 four:19 pm

I realise its a while ago this was posted, but take been experiencing like bug - the motor was drawing c. 2.5A with no load on and using the "standard" 30rpm setting in the example code. This was on a nominal 12V 5A psu so "should" have the power. I swapped today for a lower ability motor which is drawing only about 0.5A and information technology seems to run smoothly. I'1000 not sure if the issue is the PSU or the motor - only worth because if you are getting unexpected results.


chenp
Posts: 1
Joined: Mon January 29, 2018 iv:fourteen pm

Re: DC Motor & Stepper Motor HAT: stepper not running smooth

past shmulyeng on Mon Jan 29, 2018 5:00 pm

Unfortunately that'due south not an option for me. I need the ability of the higher voltage motor.


shmulyeng
Posts: ii
Joined: Monday Oct 23, 2017 4:forty pm

Delight be positive and constructive with your questions and comments.



nievesblaint.blogspot.com

Source: https://forums.adafruit.com/viewtopic.php?t=108505

0 Response to "Adafruit Motor Hat Motor Jumps if Speed Is Set Again"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel