In order to build a sampler, I use a stepper motor to move a tray along a linear rail. I'm using a NEMA 17 size motor with a step angle of 1.8° and a peak current of 1.68A/phase.
The stepper motor and the driver are mounted as follows:
Instead of the Arduino, I use a Beaglebone Black.
I also set the current limit to 0.9 using the formula: Current Limit = VREF x 2 x 0.7 (for full step mode)
Finally, my motor connection is as follows: (after checking the pairs with a multimeter)
B2 : blue ; B1: red ; A1: green ; A2: black.
My problem :
-> all the connections seem ok but my stepper motor makes an abnormal strident noise as soon as I feed it...
(there is a picture of my electrical installation as an attachment)
M0/M1/M2 pins on the driver is for microstepping, try highest microstepping, that should improve the situation. Also for optimal result steppers should be eased in/eased out.
@3Dgeo
I would recommend the opposite in the beginning. Use single step to verify the function, direction, number of steps per rev etc. @OP
Do You have documentation telling where A1, A2, B1 and B2 connects? Else, try switching B1 and B2, or the As.
"Beaglebone Black" sounds like a line in the restaurant menue so coding help will probably be limited here.
Yes, I already try to switch the stepper motor connections (B1 with B2 and B1,B2 with A1,A2).
I put in attachment the technical document of the motor with the connections. I also tried to plug the microstep pins but nothing change. The more I leave the motor under power (less than a minute), the more the noise increases.
To answer to @Wawa, the beaglebone black is a great combination of some of the interfacing flexibility of the Arduino with the fast processor and full Linux environment of the Raspberry Pi (more so in fact). The BeagleBone has good input/output features and can easily connect to the network, so I can have it run a web server to make its readings available to me. But the Arduino community is more developed, so it's more interesting for me to ask my question here.
Study the driver board, how to set it up, especially regarding stepping. Don't use random and guesses.
Have connected the ENABLE pin to GND?
When power is on, try to turn the stepper by hand. Does that work easily or not?
It would help if you post the code that you tried when you got the noise. It may be that 3Dgeo is onto something in that you may be trying to get the motor to run at too high a speed from a dead stop. Acceleration is the answer to that. The AccelStepper library allows acceleration. Try the Bounce example.
Read the how to use this forum-please read sticky to see how to properly post code and some advice on how to ask an effective question. Remove useless white space and format the code with the IDE autoformat tool (crtl-t or Tools, Auto Format) before posting code.
To answer to @RailRoader
No, the ENABLE pin isn't connected to the GND, do I have to do it?
When to power is on, i can't turn the stepper motor with my hand..
Strange. The ENABLE normally needs to be connected to GND to put out pwr to the stepper cables.
Disconnect the stepper and try turning it. That is what it feels like without pwr. Then connect ENABLE to GND, connect the stepper, put on Power, try again to turn and compare. I think there would be a greate difference.
I agree, the enable must be LOW for the motor to run. If the motor makes the clunk sound when powered but will not run and is hard to turn by hand, I think that it is getting power, but not step pulses or step pulses are to fast.
Measure the motor yourself with a meter to confirm that the wire you think is A1 is actually connected to A2 and ISN'T connected in any way to B1 or B2.
@groundFungus.
Yes, code does play a roll.... The actual code.
@OP and @ MorganS
I once got a strangly working stepper. Having experience from running steppers I was puzzled. After some time I found a damage to one cable was much more than cosmetical. The copper wire inside was cut off! Reparing the broken cable made the stepper dance like it should. If is is China stuff everything is possible.
Sorry for answer too late.
I tried to connect the Enable pin to the GND but the noise still persists and it is impossible to turn the stepper motor by hand.
I also tried to follow this pattern in order to put the Enable pin on LOW:
But my motor didnt react anymore and I still could not turn it by hand.
Otherwise, here is the code I use to run the stepper motor. Note that the syntax is slightly different because I use a beaglebone:
#import Arduino library
from bbio import *
#Define pins
stepPin = GPIO2_3
dirPin = GPIO2_4
#Set the pins as output
def setup():
pinMode(stepPin, OUTPUT)
pinMode(dirPin, OUTPUT)
def loop():
digitalWrite(dirPin, HIGH)
for i in xrange(0,200,2):
digitalWrite(stepPin, HIGH)
delayMicroseconds(500)
digitalWrite(stepPin, LOW)
delayMicroseconds(500)
delay(1000)
run(setup, loop)
when I run the code, the motor tries to turn but can not. So I tried to change the delay for: delayMicroseconds(1000)
but the problem is not solved.
During my first tests with the stepper motor( 1 week ago), he responded well to the code (despite the shrill noise). But today he doesnt answer at all. I think the condition of the motor is getting worse as I test it.
Yes, i checked the pairs with a multimeter set in "Buzzer" mode. The blue and red wires are together and the green and black wires are together. Then, I checked on the stepper motor datasheet which wires correspond to B1/B2 and A1/A2 :
blue and red wires = B
green and black wires = A
The wiring diagram is attached.
Last week, my motor worked well with a delay of 1s but now it doesnt react anymore ...I added in my loop a "print" to visualize each step until the 200th, I hear the sound of the motor but the rod doesnt turn at all.
#import Arduino Library
from bbio import *
#Define pins
stepPin = GPIO2_3
dirPin = GPIO2_4
#Set pins as output
def setup():
pinMode(stepPin, OUTPUT)
pinMode(dirPin, OUTPUT)
def loop():
digitalWrite(dirPin, HIGH)
for i in xrange(0,200,2):
digitalWrite(stepPin, HIGH)
delay(1000)
digitalWrite(stepPin, LOW)
delay(1000)
print("1")
delay(1000)
run(setup, loop)
Your stepper was running in the beginning You tell. Your setting for current, 0.9 Amps looks okey. Do You use heatsinks on the driver? 12 Volt pwr supply is okey. Could it be that the driver board gets hot and Cuts down current in order to save itself?
Did You check the heat discipation from the driver board in the beginning. Could it be possible that the driver board IC is toast some way?
My battery was losing all its "juice" once connected, explaining that my stepper motor no longer responds to commands.
I could also test my project with an arduino. All problems seem solved using the Arduino.
The only difference I can see between the Arduino and the Beaglebone is the current delivered by the digital pins:
-> about 48 mA for the Arduino pin
-> about 6 mA (sometimes just 4mA) for the Beaglebone pin
If I rely on the driver datasheet, the current of 4mA is sufficient because it requires a high input current (Ihc) <100 uA (0.1 mA). In addition, the circuit has an internal resistance (pulldown) of about 100k ohm, which corresponds to a current of 33 uA (0.033 mA) to 3.3 V.
What do you think ?
I realized that the driver and the beaglebone were heating up quite quickly when powered on.
Remember that a stepper consumes current all the time, even at stand still to keep. That makes the stepper maintainits position.
Arduino UNO outputs can deliver 20 mA, 40 mA shortly. Note that there is maximum for total current delivery so You can't put out 20 mA on all outputs at the same time.
Do You use heatsinks on the driver board? Even then it gets hot so I have installed a little 12 volt fan blowing air to the heatsinks in order to have power extended time.
Beaglebone was also heating up?