[Swansea Hackspace] Arduino Uno interface to a 3D printer stepper motor.

Tim Moore timmoore47 at gmail.com
Sat May 9 14:09:14 BST 2015


What sort of current can a A4988 carry ?

Many thanks for responding.

(Can it support the Stepper Motor I'm using?)

:  )

Tim_1

On 9 May 2015 at 10:32, Justin Mitchell <justin at discordia.org.uk> wrote:

> This does seem the hard way to do things when something like an A4988
> stepstick is a similar price and way simpler to use.
>
> Did you need some specifically higher current or other requirement?
>
> On 9 May 2015 7:09 am, Tim Moore <timmoore47 at gmail.com> wrote:
> >
> > Magic blue smoke was released !  :  (((   So I've ordered another from
> China.
> >
> > I'll double check everything, as H configuration can short +12V to
> ground so easily !   Software can do that ! ?
> >
> > On another matter the L298N has two little cans marked '220 35V UT',
> I've pnly recently come across them.  What are they ?
> >
> > Is there any favoured software to drive them that is known to work
> Arduino friendly?
> >
> > Many many thanks for responding !
> >
> > :  )))
> >
> > Tim_1
> >
> > On 8 May 2015 at 22:03, Ceri Clatworthy <ceri.clatworthy at gmail.com>
> wrote:
> >>
> >> Fetch in in Monday an we will get it going
> >>
> >> Unless the magic blue smoke has been released
> >> Ceri
> >>
> >> On 8 May 2015 17:59, "Tim Moore" <timmoore47 at gmail.com> wrote:
> >>>
> >>> Well made sort of progress:-
> >>>
> >>> Got a 3D stepper type   17H16-2994S  in the hope it would be powerful
> enough to drive the thing I want to rotate.
> >>>
> >>> Based on an Arduino Uno with a L298N stepper controller,
> >>>
> >>> I found this software which I adapted for just one motor.
> >>>
> >>> quote
> >>>
> >>> // connect motor controller pins to Arduino digital pins
> >>> // motor one
> >>> int enA = 10;
> >>> int in1 = 9;
> >>> int in2 = 8;
> >>> // motor two
> >>> // int enB = 5;
> >>> // int in3 = 7;
> >>> // int in4 = 6;
> >>> void setup()
> >>> {
> >>>   // set all the motor control pins to outputs
> >>>   pinMode(enA, OUTPUT);
> >>>   // pinMode(enB, OUTPUT);
> >>>   pinMode(in1, OUTPUT);
> >>>   pinMode(in2, OUTPUT);
> >>>   // pinMode(in3, OUTPUT);
> >>>   // pinMode(in4, OUTPUT);
> >>> }
> >>> void demoOne()
> >>> {
> >>>   // this function will run the motors in both directions at a fixed
> speed
> >>>   // turn on motor A
> >>>   digitalWrite(in1, HIGH);
> >>>   digitalWrite(in2, LOW);
> >>>   // set speed to 200 out of possible range 0~255
> >>>   analogWrite(enA, 200);
> >>>   // turn on motor B
> >>>   // digitalWrite(in3, HIGH);
> >>>   // digitalWrite(in4, LOW);
> >>>   // set speed to 200 out of possible range 0~255
> >>>   // analogWrite(enB, 200);
> >>>   delay(2000);
> >>>   // now change motor directions
> >>>   digitalWrite(in1, LOW);
> >>>   digitalWrite(in2, HIGH);
> >>>   // digitalWrite(in3, LOW);
> >>>   // digitalWrite(in4, HIGH);
> >>>   //delay(2000);
> >>>   // now turn off motors
> >>>   digitalWrite(in1, LOW);
> >>>   digitalWrite(in2, LOW);
> >>>   // digitalWrite(in3, LOW);
> >>>   // digitalWrite(in4, LOW);
> >>> }
> >>> void demoTwo()
> >>> {
> >>>   // this function will run the motors across the range of possible
> speeds
> >>>   // note that maximum speed is determined by the motor itself and the
> operating voltage
> >>>   // the PWM values sent by analogWrite() are fractions of the maximum
> speed possible
> >>>   // by your hardware
> >>>   // turn on motors
> >>>   digitalWrite(in1, LOW);
> >>>   digitalWrite(in2, HIGH);
> >>>   // digitalWrite(in3, LOW);
> >>>   // digitalWrite(in4, HIGH);
> >>>   // accelerate from zero to maximum speed
> >>>   for (int i = 0; i < 256; i++)
> >>>   {
> >>>     analogWrite(enA, i);
> >>>     // analogWrite(enB, i);
> >>>     delay(20);
> >>>   }
> >>>   // decelerate from maximum speed to zero
> >>>   for (int i = 255; i >= 0; --i)
> >>>   {
> >>>     analogWrite(enA, i);
> >>>     // analogWrite(enB, i);
> >>>     delay(20);
> >>>   }
> >>>   // now turn off motors
> >>>   digitalWrite(in1, LOW);
> >>>   digitalWrite(in2, LOW);
> >>>   // digitalWrite(in3, LOW);
> >>>   // digitalWrite(in4, LOW);
> >>> }
> >>> void loop()
> >>> {
> >>>   demoOne();
> >>>   delay(1000);
> >>>   demoTwo();
> >>>   delay(1000);
> >>> }
> >>>
> >>>
> >>> Wired it all up with a 12V 5A power supply and the stepper shaft
> twitched a bit , but the L298N emitted a puff of smoke and the heatsink got
> very hot !
> >>>
> >>> Now I've checked the Arduino Uno and it seems aok.
> >>>
> >>> The stepper motor measure 2.7 Ohm from the +12v rail to nearest motor
> pin, ditto earth to nearest pin.
> >>>
> >>> Applying 1.5V at 0.8 Amp to the each of the pair of wires the shaft
> stops being rotatable.  the two motor wires are at infinity.
> >>>
> >>> I've assumed that's a sign that I've not killed the stepper motor.
> >>>
> >>> Now before I get another L298N, I thought a few precautions are worth
> while !  Slaying a series of L298N's doesn't seem that smart !!!  *LOL*
> >>>
> >>> Any thoughts from anyone as to what to investigate next ?  (I thought
> perhaps the software was wrong for this model of stepper motor ?  I'm
> capable of making crass errors here..)
> >>>
> >>> :  )
> >>>
> >>> Tim_1
> >>>
> >>> On 19 April 2015 at 11:41, Ceri Clatworthy <ceri.clatworthy at gmail.com>
> wrote:
> >>>>
> >>>> Reverse. ..
> >>>>
> >>>> If ULN 2003...
> >>>> The wiggle pins in other direction! !!
> >>>>
> >>>> On 19 Apr 2015 11:23, "Tim Moore" <timmoore47 at gmail.com> wrote:
> >>>>>
> >>>>> Many thanks Ceri for the tip !  Greatly appreciated !
> >>>>>
> >>>>> :  )))
> >>>>>
> >>>>> Tim_1
> >>>>>
> >>>>> On 19 April 2015 at 11:21, Tim Moore <timmoore47 at gmail.com> wrote:
> >>>>>>
> >>>>>> Update:-
> >>>>>>
> >>>>>> It may not be very riveting but the change to 6400 (and the
> deletion of */ at the top of the code worked fine !
> >>>>>>
> >>>>>> the count for
> >>>>>> 90  deg was 500  and  time 52.5 secs
> >>>>>> 180 deg was 1000             105
> >>>>>> 270 deg was 1500             157.5
> >>>>>> 360 deg was 2000             210 secs ( 3m 30 secs)  approx
> >>>>>>
> >>>>>> (I hope !)
> >>>>>>
> >>>>>> Now this might be very boring, but it also might help a Newbie to
> stepper motors test their new purchase out too !
> >>>>>>
> >>>>>> Anyone know if the controller board can make it go in reverse ?
> >>>>>>
> >>>>>> :  )))
> >>>>>>
> >>>>>> Tim_1
> >>>>>>
> >>>>>> On 19 April 2015 at 10:23, Tim Moore <timmoore47 at gmail.com> wrote:
> >>>>>>>
> >>>>>>> I've been trying to get this working on a   28BYJ-48 with ULN2003
> cheapest stepper motor set up.
> >>>>>>>
> >>>>>>>  Created 30 Nov. 2009
> >>>>>>>  by Tom Igoe
> >>>>>>>
> >>>>>>>  */
> >>>>>>>
> >>>>>>> #include <Stepper.h>
> >>>>>>>
> >>>>>>> const int stepsPerRevolution = 1440;  // 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);
> >>>>>>>
> >>>>>>> int stepCount = 0;         // number of steps the motor has taken
> >>>>>>>
> >>>>>>> void setup() {
> >>>>>>>   // initialize the serial port:
> >>>>>>>   Serial.begin(9600);
> >>>>>>> }
> >>>>>>>
> >>>>>>> void loop() {
> >>>>>>>   // step one step:
> >>>>>>>   myStepper.step(1);
> >>>>>>>   Serial.print("steps:" );
> >>>>>>>   Serial.println(stepCount);
> >>>>>>>   stepCount++;
> >>>>>>>   delay(100);
> >>>>>>> }
> >>>>>>>
> >>>>>>>
> >>>>>>> Spec:-
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>> Voltage : 5V
> >>>>>>> Diameter : 28mm
> >>>>>>> Step angle : 5.625 x 1 / 64
> >>>>>>> Reduction ratio : 1 / 64
> >>>>>>> 5 Line 4 phase
> >>>>>>> Current draw : 92mA
> >>>>>>> Operating Frequency : 100pps
> >>>>>>> Dimensions : 35mm x 28mm
> >>>>>>> 4 mounting holes
> >>>>>>> ULN2003 chip
> >>>>>>> A, B, C, D four-phase status LED
> >>>>>>>
> >>>>>>> ___
> >>>>>>>
> >>>>>>>
> >>>>>>> Now the divide by 64 seems to be a stumbling block ?
> >>>>>>>
> >>>>>>> What I'm trying to do is use the 1.8 degree characteristic to get
> 100 pulses to achieve a total rotation of 180 degrees to the shaft.
> >>>>>>>
> >>>>>>> A period of anything up to two minutes is fine for the 180 degree
> rotation.
> >>>>>>>
> >>>>>>> So far it twitches a bit but not much else e.g. not very exciting.
> >>>>>>>
> >>>>>>> Should the   stepsPerRevolution = 1440 be changed to
> stepsPerRevolution = 6400 ?
> >>>>>>>
> >>>>>>> Maybe I've got the Arduino pins a tad wrong ?
> >>>>>>>
> >>>>>>> :  )
> >>>>>>>
> >>>>>>>
> >>>>>>> Tim_1
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>> On 18 April 2015 at 19:58, Justin Mitchell <
> justin at swansea.hackspace.org.uk> wrote:
> >>>>>>>>
> >>>>>>>> Yes, one motor one step-stick.
> >>>>>>>>
> >>>>>>>> Control it from an arduino, or any other micro, just needs two
> GPIO
> >>>>>>>> lines.
> >>>>>>>>
> >>>>>>>>
> >>>>>>>> On Sat, 2015-04-18 at 16:04 +0100, Tim Moore wrote:
> >>>>>>>> > So a single 'step-stick' would do it ?
> >>>>>>>> >
> >>>>>>>> >
> >>>>>>>> > Many thanks for responding !
> >>>>>>>> >
> >>>>>>>> > :  )))
> >>>>>>>> >
> >>>>>>>> >
> >>>>>>>> > Tim_1
> >>>>>>>> >
> >>>>>>>> >
> >>>>>>>> > On 18 April 2015 at 15:09, Justin Mitchell <
> justin at discordia.org.uk>
> >>>>>>>> > wrote:
> >>>>>>>> >         It's an interface for all the stuff you need to drive a
> 3d
> >>>>>>>> >         printer, takes 5 step-sticks for stepper driving, has
> power
> >>>>>>>> >         MOSFETs to pwm the hotends and heated bed, and a bunch
> of
> >>>>>>>> >         inputs for end stops and thermistors. You plug it into
> an
> >>>>>>>> >         Arduino mega board, install some software like Marlin
> and it
> >>>>>>>> >         can run your printer, or mixed to control a CNC mill or
> laser
> >>>>>>>> >         cutter.
> >>>>>>>> >
> >>>>>>>> >         Way over kill for driving one motor :)
> >>>>>>>> >
> >>>>>>>> >         On 18 Apr 2015 2:51 pm, Tim Moore <timmoore47 at gmail.com
> >
> >>>>>>>> >         wrote:
> >>>>>>>> >         >
> >>>>>>>> >         > Wow !  Loads of interesting links and ideas !
> >>>>>>>> >         >
> >>>>>>>> >         > Its a very slow rotation, so inertia is not a problem.
> >>>>>>>> >         >
> >>>>>>>> >         > Is a 'RAMPS 1.4' useful ?  what does it do ?
> >>>>>>>> >         >
> >>>>>>>> >         > Many thanks to all who have responded !
> >>>>>>>> >         >
> >>>>>>>> >         > :  )))
> >>>>>>>> >         >
> >>>>>>>> >         > Tim_1
> >>>>>>>> >         >
> >>>>>>>> >         > On 18 April 2015 at 13:57, oliver Oliver
> >>>>>>>> >         <oliver at oliverjenkins.com> wrote:
> >>>>>>>> >         >>
> >>>>>>>> >         >> Think about pulleys or gears.  I don't know if you
> want the
> >>>>>>>> >         pole to stop at a particular point or not.  Inertia in
> 1m pole
> >>>>>>>> >         will be higher than braking force of a stepper motor.
> So it
> >>>>>>>> >         will continue to spin after you stop the motor. Giving
> you an
> >>>>>>>> >         unpredictable 180 plus rotation.
> >>>>>>>> >         >>
> >>>>>>>> >         >> For a pulley arrangement look at t5  timing belts.
> you can
> >>>>>>>> >         easily print the pulleys using a reprap.  There are
> libraries
> >>>>>>>> >         on thingiverse.
> >>>>>>>> >         >>
> >>>>>>>> >         >> A worm gear would be better,  but you can't print
> those.
> >>>>>>>> >         >>
> >>>>>>>> >         >> Oli
> >>>>>>>> >         >>
> >>>>>>>> >         >> On 18 Apr 2015 12:33, "Tim Moore" <
> timmoore47 at gmail.com>
> >>>>>>>> >         wrote:
> >>>>>>>> >         >>>
> >>>>>>>> >         >>> I'm trying to carefully rorate a metre long light
> weight
> >>>>>>>> >         pole through 180 degrees.
> >>>>>>>> >         >>>
> >>>>>>>> >         >>> I've got a Stepper Motor type 28BYJ-48 working
> fine, but
> >>>>>>>> >         I'm sure I need one that is a bit more chunky !
> >>>>>>>> >         >>>
> >>>>>>>> >         >>> I've got a 17HS16-2004S NEMA 17 (42 x 42 mm) high
> torque
> >>>>>>>> >         1.8 degree stepper motor  on the way with a controller
> card
> >>>>>>>> >         >>>
> >>>>>>>> >         >>> But I've not got a very clear vision yet what else
> I might
> >>>>>>>> >         need and if there is any Arduino example software
> listing that
> >>>>>>>> >         would be good to use to get it to work ?
> >>>>>>>> >         >>>
> >>>>>>>> >         >>> I don't want to reinvent the wheel !  *LOL*
> >>>>>>>> >         >>>
> >>>>>>>> >         >>> Any thoughts anyone ?
> >>>>>>>> >         >>>
> >>>>>>>> >         >>> :  )))
> >>>>>>>> >         >>>
> >>>>>>>> >         >>> Tim_1
> >>>>>>>> >         >>>
> >>>>>>>> >         >>> _______________________________________________
> >>>>>>>> >         >>> Hackspace mailing list
> >>>>>>>> >         >>> Hackspace at swansea.hackspace.org.uk
> >>>>>>>> >         >>>
> http://swansea.hackspace.org.uk/mailman/listinfo/hackspace
> >>>>>>>> >         >>>
> >>>>>>>> >         >>
> >>>>>>>> >         >> _______________________________________________
> >>>>>>>> >         >> Hackspace mailing list
> >>>>>>>> >         >> Hackspace at swansea.hackspace.org.uk
> >>>>>>>> >         >>
> http://swansea.hackspace.org.uk/mailman/listinfo/hackspace
> >>>>>>>> >         >>
> >>>>>>>> >         >
> >>>>>>>> >         _______________________________________________
> >>>>>>>> >         Hackspace mailing list
> >>>>>>>> >         Hackspace at swansea.hackspace.org.uk
> >>>>>>>> >
> http://swansea.hackspace.org.uk/mailman/listinfo/hackspace
> >>>>>>>> >
> >>>>>>>> >
> >>>>>>>> >
> >>>>>>>> > _______________________________________________
> >>>>>>>> > Hackspace mailing list
> >>>>>>>> > Hackspace at swansea.hackspace.org.uk
> >>>>>>>> > http://swansea.hackspace.org.uk/mailman/listinfo/hackspace
> >>>>>>>>
> >>>>>>>>
> >>>>>>>> _______________________________________________
> >>>>>>>> Hackspace mailing list
> >>>>>>>> Hackspace at swansea.hackspace.org.uk
> >>>>>>>> http://swansea.hackspace.org.uk/mailman/listinfo/hackspace
> >>>>>>>
> >>>>>>>
> >>>>>>
> >>>>>
> >>>>>
> >>>>> _______________________________________________
> >>>>> Hackspace mailing list
> >>>>> Hackspace at swansea.hackspace.org.uk
> >>>>> http://swansea.hackspace.org.uk/mailman/listinfo/hackspace
> >>>>>
> >>>>
> >>>> _______________________________________________
> >>>> Hackspace mailing list
> >>>> Hackspace at swansea.hackspace.org.uk
> >>>> http://swansea.hackspace.org.uk/mailman/listinfo/hackspace
> >>>>
> >>>
> >>>
> >>> _______________________________________________
> >>> Hackspace mailing list
> >>> Hackspace at swansea.hackspace.org.uk
> >>> http://swansea.hackspace.org.uk/mailman/listinfo/hackspace
> >>>
> >>
> >> _______________________________________________
> >> Hackspace mailing list
> >> Hackspace at swansea.hackspace.org.uk
> >> http://swansea.hackspace.org.uk/mailman/listinfo/hackspace
> >>
> >
> _______________________________________________
> Hackspace mailing list
> Hackspace at swansea.hackspace.org.uk
> http://swansea.hackspace.org.uk/mailman/listinfo/hackspace
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://swansea.hackspace.org.uk/pipermail/hackspace/attachments/20150509/a395dd06/attachment.html>


More information about the Hackspace mailing list