Adafruit Dc Motor Hat Motor Jumps if Speed Is Set Again
DC Motor & Stepper Motor HAT: stepper non running smoothly
Please exist positive and constructive with your questions and comments.
DC Motor & Stepper Motor HAT: stepper not running smoothly
Hullo,
I recently bought a DC Motor & Stepper Motor HAT from y'all and installed (following https://learn.adafruit.com/adafruit-dc-and-stepper-motor-hat-for-raspberry-pi?view=all#overview) everything to work with the aforementioned model of nema17 stepper motor you have on the website.
After installing the software and finding the right pairs of wires, I tried the stepperTest.py file. The motor turns in 1 directection and then the other every bit expected merely the rotation is very irksome and hasty every bit if the motor was going frontward two steps and 1 back constantly. When the program uses Single steps the motor going back is nigh visible. The movement when using Microsteps is seem smoother merely I can nonetheless feel the motor blocking from time 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-style) in a loop and tried with an other motor only the result is always the aforementioned. Moreover, increasing the RMP with setSpeed has no visible result. Whatever the value, the motor turns at a speed of a few rotations per minute in singlestep way.
Does anyone have whatever feel with this issue? Do yous recollect it is a code issue? Or is the Chapeau only too limited to use a stepper motor efficiently?
Sorry if this has been asked before. I searched the web just could not find a solution to my trouble.
EDIT: If i set the speed to 255 and practise a simple while loop with the i stride function:
- Code: Select all | TOGGLE FULL SIZE
-
while(True)
myStepper.oneStep(Adafruit_MotorHAT.Forrard, Adafruit_MotorHAT.SINGLE)
The motor moves randomly back and along with no apparent logic as when and why it reverses direction
-
EvilGarfield - Posts: eight
- Joined: Mon Dec nineteen, 2016 9:35 am
Re: DC Motor & Stepper Motor Lid: stepper non running smooth
The Unmarried stride fashion is the weakest and roughest of the stepping modes and more decumbent to skipping steps.
What are you using to ability the motor?
-
adafruit_support_bill - Posts: 83420
- Joined: Sat February 07, 2009 ten:11 am
Re: DC Motor & Stepper Motor HAT: stepper non running smooth
How-do-you-do Pecker,
Thanks for your reply. I am using a 12V two,24A power supply.
I know that single is not the near precise. I can use microstep and then it runs a chip smoother (withal not perfect) just the fastest rotation I go is 1-ii RPMs.
I noticed that when I showtime the script the motor changes direction several times during 4-5s and so chooses one direction and keeps it but it is still vibrating a lot and not turning very smooth. Could this be linked to the baudrate settings of my pi?
-
EvilGarfield - Posts: viii
- Joined: Mon Dec nineteen, 2016 ix:35 am
Re: DC Motor & Stepper Motor HAT: stepper non running smoothen
Practise you take a link to the specifications for the motor you are using? The NEMA 17 designation but specifies the location of the bolt-holes on the faceplate. There can be major differences in electrical characteristics betwixt different NEMA 17 motors.
Also, delight post the code y'all are using.
-
adafruit_support_bill - Posts: 83420
- Joined: Sat February 07, 2009 10:11 am
Re: DC Motor & Stepper Motor Lid: stepper not running smooth
The motor I am using is this one
I read on the forums that the Chapeau was designed for motors with a high phase resistance. And the specs on this i is the same as the i yous have here
The kickoff code I used was
- Lawmaking: Select all | TOGGLE FULL SIZE
-
#!/usr/bin/python
#import Adafruit_MotorHAT, Adafruit_DCMotor, Adafruit_Stepper
from Adafruit_MotorHAT import Adafruit_MotorHAT, Adafruit_DCMotor, Adafruit_StepperMotorimport time
import atexit# create a default object, no changes to I2C accost or frequency
mh = Adafruit_MotorHAT()# recommended for motorcar-disabling motors on shutdown!
def turnOffMotors():
mh.getMotor(1).run(Adafruit_MotorHAT.RELEASE)
mh.getMotor(2).run(Adafruit_MotorHAT.RELEASE)
mh.getMotor(3).run(Adafruit_MotorHAT.RELEASE)
mh.getMotor(4).run(Adafruit_MotorHAT.RELEASE)atexit.register(turnOffMotors)
myStepper = mh.getStepper(200, i) # 200 steps/rev, motor port #1
myStepper.setSpeed(255) # 30 RPMwhile (True):
print("Single gyre steps")
myStepper.step(100, Adafruit_MotorHAT.BACKWARD, Adafruit_MotorHAT.SINGLE)
myStepper.step(100, Adafruit_MotorHAT.Astern, Adafruit_MotorHAT.SINGLE)impress("Double coil steps")
myStepper.step(100, Adafruit_MotorHAT.FORWARD, Adafruit_MotorHAT.DOUBLE)
myStepper.pace(100, Adafruit_MotorHAT.BACKWARD, Adafruit_MotorHAT.DOUBLE)print("Interleaved whorl steps")
myStepper.step(100, Adafruit_MotorHAT.FORWARD, Adafruit_MotorHAT.INTERLEAVE)
myStepper.step(100, Adafruit_MotorHAT.BACKWARD, Adafruit_MotorHAT.INTERLEAVE)impress("Microsteps")
myStepper.step(100, Adafruit_MotorHAT.FORWARD, Adafruit_MotorHAT.MICROSTEP)
myStepper.pace(100, Adafruit_MotorHAT.BACKWARD, Adafruit_MotorHAT.MICROSTEP)
And and then I changed it to
- 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_StepperMotorimport 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(i).run(Adafruit_MotorHAT.RELEASE)
mh.getMotor(2).run(Adafruit_MotorHAT.RELEASE)
mh.getMotor(three).run(Adafruit_MotorHAT.RELEASE)
mh.getMotor(4).run(Adafruit_MotorHAT.RELEASE)atexit.register(turnOffMotors)
myStepper = mh.getStepper(200, i) # 200 steps/rev, motor port #i
myStepper.setSpeed(255) # xxx RPMwhile (True):
myStepper.oneStep(Adafruit_MotorHAT.Backward, Adafruit_MotorHAT.DOUBLE)
Equally equally sidenote, what effective speed can I wait from such a motor/Lid combination?
-
EvilGarfield - Posts: 8
- Joined: Monday December nineteen, 2016 ix:35 am
Re: DC Motor & Stepper Motor Lid: stepper not running smooth
- Code: Select all | TOGGLE FULL SIZE
-
myStepper.setSpeed(255) # 30 RPM
This may exist 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 motorcoach speed is about 50 RPM. It is possible to increase the speed of the i2c bus.
http://raspberrypi.stackexchange.com/qu ... an-i2c-jitney
-
adafruit_support_bill - Posts: 83420
- Joined: Sat Feb 07, 2009 10:xi am
Re: DC Motor & Stepper Motor HAT: stepper not running shine
Thank you again for your help!
The thing is, fifty-fifty when decreasing this value to beneath 30, the motility is the same. This option doesn't seem to have any effect. If the value is 1, 30 or 255, my motor behaves the same.
I modified my config.txt to a higher baudrate as explained in your link but when I cheque information technology using
- Lawmaking: Select all | TOGGLE Total SIZE
-
sudo cat /sys/module/i2c_bcm2708/parameters/baudrate
I get 0. I'grand kind of confused. Sorry for all those questions, I'thou new to this.
-
EvilGarfield - Posts: viii
- Joined: Mon December 19, 2016 nine:35 am
Re: DC Motor & Stepper Motor HAT: stepper non running smooth
If you lot post some photos showing your soldering and connections to the HAT nosotros can take a look for any problems there.
Pi internals are not my forte, but at that place may be differences for the version of Linux yous are running. If you search "raspberry pi modify i2c baud charge per unit" you tin can probably notice the correct command for the version you lot are running.
-
adafruit_support_bill - Posts: 83420
- Joined: Sat Feb 07, 2009 10:11 am
Re: DC Motor & Stepper Motor Chapeau: stepper not running smoothen
Good morning!
Here are the pictures of my soldering. I tested the connections and all of them have a < 30 ohm resistance. As well, I tried my motor with both ports and the outcome is the same.
I volition bank check this baudrate thing and meet if it fixes the problem.
- Attachments
-
- Motor wires connection
- _DSC0110.jpg (530.49 KiB) Viewed 1827 times
-
- Bottom soldegrin
- _DSC0107.jpg (427.76 KiB) Viewed 1827 times
-
- superlative soldering
- _DSC0108.jpg (370.27 KiB) Viewed 1827 times
-
EvilGarfield - Posts: 8
- Joined: Mon Dec 19, 2016 nine:35 am
Re: DC Motor & Stepper Motor HAT: stepper not running polish
Ok I got it to piece of work by increasing the baudrate of my I2C ports to 400 KHz. Thanks a lot Bill ;)
The but affair now is that the motor start spinning at a certain speed for like 2-3s and then slows downwardly for the remainder of the command. Any idea where this could come from?
-
EvilGarfield - Posts: 8
- Joined: Mon Dec 19, 2016 ix:35 am
Re: DC Motor & Stepper Motor Hat: stepper not running shine
You are running on Linux, so timing is not guaranteed. Your motor control process is going to be sharing the processor with any else is running on the Pi. If possible, shut down some of the other processes and services and run into how that affects your motor.
-
adafruit_support_bill - Posts: 83420
- Joined: Sat Feb 07, 2009 10:eleven am
Re: DC Motor & Stepper Motor Chapeau: stepper not running polish
Hullo i've got the same trouble as mentioned at the superlative. I tried the board with the Raspberry Pi 3 with iv.iv.44 Kernel Version. The solution above doesn't work for me. It seems that I tin can not set the I2C baudrate correctly. Could you please tell me how y'all did this?
I added the following lines in /kicking/config.txt
- Code: Select all | TOGGLE Full SIZE
-
dtparam=i2c_arm_baudrate=400000
Only
- 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 likewise tried 2 unlike Motor Hats with ii different Raspberry Pi 3 and an Arduino Uno and different Motors (DC and stepper, NEMA 11 and 17).
Here's the motor datasheet https://www.pololu.com/file/download/SY28STH32-0674A.pdf?file_id=0J686
-
MVkit - Posts: 1
- Joined: Fri Jan 27, 2017 ten:41 am
Re: DC Motor & Stepper Motor HAT: stepper not running polish
Have either of you solved this problem? I'm experiencing the same consequence.
-
shmulyeng - Posts: 2
- Joined: Monday Oct 23, 2017 4:40 pm
Re: DC Motor & Stepper Motor Hat: stepper not running smoothen
I realise its a while ago this was posted, but have been experiencing similar problems - 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" take the power. I swapped today for a lower power motor which is drawing only about 0.5A and it seems to run smoothly. I'm not sure if the result is the PSU or the motor - only worth considering if yous are getting unexpected results.
-
chenp - Posts: ane
- Joined: Mon Jan 29, 2018 4:14 pm
Re: DC Motor & Stepper Motor HAT: stepper not running smooth
Unfortunately that'southward not an option for me. I need the power of the higher voltage motor.
-
shmulyeng - Posts: two
- Joined: Monday October 23, 2017 4:40 pm
Delight exist positive and effective with your questions and comments.
Source: https://forums.adafruit.com/viewtopic.php?t=108505
0 Response to "Adafruit Dc Motor Hat Motor Jumps if Speed Is Set Again"
Post a Comment