Stepper motor vibrating for no apparent reason  - Page 1
Forum section: electronics / beginners

author: abdullahseba
author_rank: Frequent Contributor
timestamp: October 03, 2017, 04:59:54 pm
content: HiI just connected a SN754410 to my Arduino and stepper motor.I send the number of steps via serial.Code:#include <Stepper.h>const int stepsPerRevolution = 200; // change this to fit the number of steps per revolution// for your motor// initialize the stepper library on pins 8 through 11:Stepper myStepper(stepsPerRevolution, 8, 9, 10, 11);void setup() {// set the speed at 60 rpm:myStepper.setSpeed(200);// initialize the serial port:Serial.begin(19200);Serial.setTimeout('1');}void loop() {while (Serial.available()) {int steps = Serial.parseInt();myStepper.step(steps);Serial.println(steps);}}After a bit (10sec to 1min) the motor starts to vibrate - I would say 1 step both ways continually, until I send another step.Its definitely the Arduino because when I disconnect it it stops.Anyone know whats going on?Is it my code?Thanks in advance.

author: khs
author_rank: Regular Contributor
timestamp: October 03, 2017, 05:58:27 pm
content: Hi abdullahseba,it looks there is no current limiter, so maybe the sn754410 switches off due to overheating.

author: abdullahseba
author_rank: Frequent Contributor
timestamp: October 03, 2017, 07:50:15 pm
content: Quote from: khs on October 03, 2017, 05:58:27 pmThanks! It is getting really hot. what circuit do I need? Can you link something in?or would a ground plain on a PCB be enough?

author: janoc
author_rank: Super Contributor
timestamp: October 03, 2017, 09:09:45 pm
content: Quote from: abdullahseba on October 03, 2017, 07:50:15 pmUm, what voltage are you using? Keep in mind that steppers are usually driven from constant current drivers and if you don't limit the current, you can have large currents flowing (several amps ...) due to the low resistance of the motor windings.That can damage both the motor and the driver you are using. These Arduino circuits using sn754410 or L239D are probably responsible for more burned out steppers than anything else.Look into a proper stepper driver like the popular Allegro A4983 / A4988 (The "Stepstick" modules use these). However, it will also depend on the type of motor you are driving (the rated voltage/current).

author: abdullahseba
author_rank: Frequent Contributor
timestamp: October 03, 2017, 09:11:33 pm
content: Quote from: janoc on October 03, 2017, 09:09:45 pmThanks I'll look in to it. I was using 5v 2A.

author: janoc
author_rank: Super Contributor
timestamp: October 03, 2017, 09:13:55 pm
content: Quote from: abdullahseba on October 03, 2017, 09:11:33 pmUh, absolute maximum ratings for SN754410 (http://www.ti.com/lit/ds/symlink/sn754410.pdf):Peak output current +-2AContinuous output current +-1AAnd you are surprised it doesn't like it?It is possible to drive a stepper using one of these chips but then either you need to drive the motor from low enough voltage that the resistance of the motor windings doesn't let large current to flow (but then you lose speed/torque) or you must add a current sensing circuit and some means to limit the current when a preset value is exceeded - e.g. a transistor or maybe high frequency PWM where you reduce the current by reducing the duty cycle. However, if you go to these lengths, it is probably easier and cheaper to just use a dedicated driver chip like that Allegro one which includes this functionality.

author: abdullahseba
author_rank: Frequent Contributor
timestamp: October 03, 2017, 09:16:04 pm
content: Quote from: janoc on October 03, 2017, 09:13:55 pmI guess all I can say is nub meI just saw that schismatic and was in a rush so thought nothing of it.

author: janoc
author_rank: Super Contributor
timestamp: October 03, 2017, 09:27:52 pm
content: Quote from: abdullahseba on October 03, 2017, 09:16:04 pmHappens.However, beware of these circuits - you will find in many places that one doesn't need to limit current when driving steppers with L293D (or your SN754410 which is the same thing) because they have thermal protection and thus won't burn out.Yes, that is true. However, that doesn't meanthe motorwon't burn out! A lot of small steppers have windings of around 8-10\$\Omega\$, rated for about 0.5A max current, when driven from 20-26V. 26V/10\$\Omega\$ = 2.6A, so you can imagine the meltdown if there is no current limiting (or only the thermal shutdown of driver).E.g. this motor (common on eBay or salvaged from cheap printers and copy machines):http://www.mitsumi.co.jp/latest/Catalog/compo/motor/m42sp6k_e.htmlThat one would be overdriven even at 5V already.

author: kosacid
author_rank: Contributor
timestamp: October 08, 2017, 09:46:49 am
content: i posted recently about driving stepping motors, got told i would burn the H bridge out and that, this form is about helping people, but all i see is your going to blow it up burn it out and stuff like that and no help lol, so how about you so called experts show us how to handle a stepping motor of say 10ohms, instead of saying your going to blow the shit out of it, i salvaged mine from a lexmark printer i dont see no heat sinks and that so hows it done ?, that's what wee noobs want to know

author: janoc
author_rank: Super Contributor
timestamp: October 08, 2017, 10:13:54 am
content: Quote from: kosacid on October 08, 2017, 09:46:49 amHmm, if you want help it would help if you mastered the art of punctuation first so that people can actually understand what are you writing about. All I can guess from your rather incoherent rant that you want to drive a stepper motor properly.It isn't hard - look at the datasheet of the motor and dimension your driver accordingly. The winding resistance alone is not enough - you don't know how much current can the winding handle from that.A bit of googling finds you also this application note from ST:http://users.ece.utexas.edu/~valvano/Datasheets/Stepper_ST.pdfThat explains well the various possibilities of driving the motors and also shows how to implement the constant current driving (current limiting) in order to not destroy your motor. Or use one of the (many) available driver chips that implements all this already.The information is widely available out there, this isn't some sort of secret sauce. Just don't expect to be handed stuff on a silver plate.

author: kosacid
author_rank: Contributor
timestamp: October 08, 2017, 10:22:19 am
content: firstly, i joined what i believed to be a forum for assistance. a forum that i was under the impression was supposed to be an online community of like minded (not small minded) people.secondly, before you go ahead correcting anyone's punctuation i would like to refer you to the website below that may give you some guidance on other peoples reasoning for not being as super perfect (NOT) as you clearly are.https://www.dyslexiascotland.org.uk/

author: Kleinstein
author_rank: Super Contributor
timestamp: October 08, 2017, 10:31:32 am
content: In the old days, before dedicated drivers with current limit, simple series resistors were used with stepper motors. They produce quite some heat, but can be Ok for a not so demanding application. Using a series resistor can be still more effective than reducing the voltage with a linear regulator, as the current can still rise faster which thus allows a higher speed.If the motor does not need to run fast or deliver a high moment there is no need to use the full rated current. Something like 70% of the rated current already reduces the power loss in the motor to about half, so keeps the motor significant cooler.

author: abdullahseba
author_rank: Frequent Contributor
timestamp: October 11, 2017, 04:12:44 pm
content: Hi againI got thishttp://www.ebay.co.uk/itm/A4988-Heatsink-Reprap-Stepstick-Stepper-Motor-Driver-Ramps-3D-Printer-Pololu-/182644636445?epid=1789100579&hash=item2a8677fb1d:g:5WwAAOSwvflZVkGpa4988 driverand used this schematic:and this code:Code:void setup(){pinMode(6,OUTPUT); // EnablepinMode(5,OUTPUT); // SteppinMode(4,OUTPUT); // DirdigitalWrite(6,LOW); // Set Enable low}void loop(){digitalWrite(4,HIGH); // Set Dir highfor(x = 0; x < 200; x++) // Loop 200 times{digitalWrite(5,HIGH); // Output highdelayMicroseconds(500); // Wait 1/2 a msdigitalWrite(5,LOW); // Output lowdelayMicroseconds(500); // Wait 1/2 a ms}delay(1000); // pause one seconddigitalWrite(4,LOW); // Set Dir lowfor(x = 0; x < 200; x++) // Loop 2000 times{digitalWrite(5,HIGH); // Output highdelayMicroseconds(500); // Wait 1/2 a msdigitalWrite(5,LOW); // Output lowdelayMicroseconds(500); // Wait 1/2 a ms}delay(1000); // pause one second}But it doesn't seem to work properly and makes odd noises. With no load on it turns okish, but If I put a load on it stalls even with max current on the pot.I'm tried using a 9V battery and a 12V 5A PSU with more or less the same result.I was getting better results with the SN754410 even tho it melted my breadboardI made a vid of what it does.Thanks in advance.

author: PA0PBZ
author_rank: Super Contributor
timestamp: October 11, 2017, 06:29:49 pm
content: Are you trying to step it too fast? what happens if you change the 2 delay lines toCode:delayMicroseconds(5000); // Wait 5 ms

author: abdullahseba
author_rank: Frequent Contributor
timestamp: October 12, 2017, 06:03:05 am
content: Quote from: PA0PBZ on October 11, 2017, 06:29:49 pmThanks That seems to be it!