Help with stepper motors - Page 1
Forum section: electronics / beginners

author: Ricardo99
author_rank: Newbie
timestamp: March 28, 2015, 02:51:10 pm
content: Hello all,My name is Richard, I have a background in electronics repair (nothing fancy, just good old through hole tech replacing burned out parts and simple fault finding) and computer and network systems hardware support / repair / system building.I am not a complete novice with electronics, but some things I just can't seem to find a straight answer to.I have a couple of stepper motors and want to use one to control the focus on my astronomy telescope.So, I have a Mitsumi M42SP-6TA Bi-Polar stepper motor out of a Lexmark printer to use which operates at around 12V, should provide enough torque as not much is needed to turn the focuser knob. I know I need a driver and some sort of control set up for it but have no idea where to start. The chips on the controller board from the printer are custom chips and I can find no data on them, one is definitely an ARM CPU (says so on it) badged as LexMark, the other is a Motorola ASIC, I'm guessing this does all the actual driving of the steppers and ink control but I have no idea what it actually is.I can get a decent enough driver for a small amount of money from eBay, so that is not too much of a problem. It's the control side of it all that has me stumped.All I want to make is a little box with the electronics in with some sort of rotary encoder which when turned turns the motor, and when rotation direction of the encoder is reversed so is the rotation direction of the motor.I have no microcontroller programmer (the last PIC programming I did was to add a little bit of extra functionality to a Playstation (PSX) back in the mid - late 90's) so I would be looking to do this without a microcontroller if it's possible.I have seen videos of how to use a 555 timer to control the stepper, but it does not seem to do what I need it to do; at least not the way I see it in my mind...which is a strange place at the best of times.....So I am after any ideas from the brains of experts. Seems to me this must be a simple thing to achieve, the whole idea is simple.Please bear in mind that I am also trying to do this on the cheap, proper motorised focusers for my 'scope start at around £200 which for some cheap electronics and cheap motor is absolutely ridiculous I think you'll agree.Anyway, thanks in advance for the responses. I'm sure I'm going to get a headache trying to understand the technical answers I'm bound to get, but I don't mind as long as I learn something, I have a draw full (not literally) of ibuprofenThanks, Richard.

author: franksanderdo
author_rank: Contributor
timestamp: March 28, 2015, 03:06:08 pm
content: Hey Richardeven though I am not the great Arduino fan, I believe from your description this might be the right start.A cheap Arduino Board plus a stepper shield.The Software is pretty much ready available in form of Arduino IDE and supper library.Some hardware exampleshttps://www.sparkfun.com/products/11021https://www.sparkfun.com/products/12779All the bestFrank

author: flynwill
author_rank: Regular Contributor
timestamp: March 28, 2015, 03:21:14 pm
content: The simplest -- no software way -- to do this would be to interface a quadrature shaft encoder to directly drive the motor phases. That is the A phase of the shaft encoder controls the A coil on the motor and the B phase from the shaft encoder controls the B coil of the motor.I was able to find a data sheet for your motor, which seems to indicate that it is a "6-wire" motor, meaning the two phases have center tapped coils so you can drive them with uni-polar drivers. If that is correct you'll need 4 drive devices, either MOSFETS or NPN transisters and a tiny bit of logic convert the signal so that when the signal from the shaft encoder is low you are driving one side of the motor coil and when the signal is high you are driving the other. It might be desirable add some filtering or delays (here's where the NE555 might be useful) to insure that there is some short period, maybe 10-30 mS when both sides of the coil are off at the transition. Be sure to add a diode between your drive transistors collector (or drain if Mosfet) and the positive supply to absorb the energy coming back from the motor coil when you turn off the transistor.You can control the effective "gear ratio" between your knob and the motor by choosing an encoder with more or less pulses per revolution.However the Arduino route that Frank suggests will probably be just as easy in the end and far more flexible.

author: MattHollands
author_rank: Frequent Contributor
timestamp: March 28, 2015, 03:32:49 pm
content: +1 for the Arduino suggestion. I've used these (http://www.ebay.co.uk/itm/3D-Printer-Stepper-Motor-Driver-A4988-Pololu-Reprap-Red-StepStick-comp-/201091441677?var=&hash=item0) stepper drivers to control CNC stepper motors from an Arduino and had good results plus they're pretty cheap.

author: Ricardo99
author_rank: Newbie
timestamp: March 28, 2015, 03:56:41 pm
content: Ok, trying to avoid Arduino but it does seem to be the cheaper option, especially as I can get an Arduino compatible board for £8.99!btw flynwill, the motor is a 4 wire Bi-Polar stepper. There are 3 or 4 different ones I found on that part number but mine has 4 wires and matched the Bi-polar part I found perfectly. Admittedly, it was hard to be absolutely certain at a quick glance.@MattHollands will that driver work with a bi-polar 4 wire stepper? Hard to tell from that advert, I guess it would but I don't want to pay out for it to not have it work.Cheers.

author: Ricardo99
author_rank: Newbie
timestamp: March 28, 2015, 04:20:09 pm
content: Actually, never mind.Arduino is such an overkill for this project it's not even funny.By the time I have paid out for, albeit a very cheap, Arduino + driver + encoder + box + making a way to fit all this to the 'scope I might as well have gone out and bought a Skywatcher focuser for £45 and then modded it's bracket and drive system to control the focus, works out a lot cheaper as the bracket and belt drive conversion I can do for pretty much freeSo thanks for the help / advice guys but consider this project dead.I'm sure I'll be back with another ridiculous question later onCheers, Richard.

author: Mechatrommer
author_rank: Super Contributor
timestamp: March 28, 2015, 07:39:46 pm
content: Quote from: MattHollands on March 28, 2015, 03:32:49 pm+1 you only need 2-3 IO lines from an mcu, no phase hassle spike detect or syncronoziation delayed hysteresis messup. just step, dir and enable pin off you go. just 30 minutes ago i completed a test code to run a stepper using the A4988, even managed to burn one while trying to increase torque by adjusting trimpot probed with current probe tongue at right angle. that was a $2.50 driverthe code is very simple less than a night to complete.... but for the rotary encoder to command the stepper, more code will be needed...

author: flynwill
author_rank: Regular Contributor
timestamp: March 28, 2015, 08:27:36 pm
content: There are a lot of bi-polar stepper motor drivers out there. I very quick web search turned up this part:https://www.pololu.com/product/2133Which at first glance seems like it should work for your little motor. The driver from SparkFun suggested by Frank should work with your bi-polar motor as well.The signals from a normal bi-phase shaft encoder can directly be used to drive the step and direction inputs on motor driver, if it's an optical unit (which tend to have pretty clean outputs) you can probably get away without any conditioning circuitry. But if you use a mechanical switch type encoder de-bounce circuits will be needed.There is one important issue using the bi-phase directly as step and direction. If the encoder is rocked back and forth across the same position the motor will advance, getting out of sync. For your proposed use this probably won't matter, but if it does then small bit of logic is needed to properly convert the bi-phase to step and direction. A little more searching turned up this little IChttp://www.elmelectronics.com/DSheets/ELM407DS.pdfthat seems to do the right thing.