Connect with us

Basic Function for Stepper Motor for Beginner

Discussion in 'Microcontrollers, Programming and IoT' started by kavinuma, Dec 1, 2013.

Scroll to continue with content
  1. kavinuma


    Dec 1, 2013

    I am a beginner n00bzorz with circuits, and for this project I'm working on, it was recommended that I use a stepper motor for its precise rotation. So I bought a stepper motor, but I have absolutely no idea how to use it. It's a 4 phase 5 wire lead stepper motor, which looks a lot like this:

    I don't know how to hook it up, and I don't know how to operate it at all. Our project was originally complex, but we have dumbed it down considerably. We are using an electrical signal from the eye (EOG to control a prosthetic eye to rotate synchronously. We are only working with left and right movements and it's pretty much three positions for the eye: left, right, and middle. So what I need to do is use the right movement output to rotate the stepper motor let's say 70 degrees and the left 70 degrees the other way. But again, I have no idea what I am doing. If anyone can help, I would greatly appreciate it.

    - kavinuma
  2. (*steve*)

    (*steve*) ¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd Moderator

    Jan 21, 2010
    Perhaps the easiest would be a simple microcontroller and a stepper motor driver.

    I would probably look at either arduino or picaxe. Both have lots of beginner support and what you want to do should be pretty easy to achieve.

    If you or anyone else on your team(?) have experience with programming one of these devices, go with that one. If there is C experience, go Arduino. If Basic experience, go PicAxe. Otherwise, look at the available information for each and make your own mind up.

    An arduino board and a "stepper shield" may require that you do almost no wiring up of things. A PicAxe will require you to connect the chip on a breadboard.

    There may be other options that I've missed, but these are the ones I'd me looking at for a beginner.

    CDRIVE Hauling 10' pipe on a Trek Shift3

    May 8, 2012
    I'm extremely biased. If simplicity and low cost is a priority then would not recommend anything other than Picaxe for nubes, students or just about any electronhead.

    All software, manuals and catalogs are free downloads. They contain basic Stepper info for both Bipolar and Unipolar motors. They even sell the motors and interface components, including shields.

  4. BitHead


    Mar 2, 2012
    Stepper motor with Arduino...

    I also bought that exact motor - but on eBay - and it came with a driver board - like the one you find by searching for searching for...
    " ULN2003 Stepper Motor Driver Board for AVR/LPC/STM32 "
    But - I'm not a noob who needs to do things the hard way for awhile. (that is, gain experience :) )
    It's only one chip (ULN2003) - you could just breadboard your own.
    Then, all you need is a minimal controller - a PIC16F505 (and a programmer) or something like that would be my choice - you just need four output pins and three input pins (for your left,middle,right) .
    Of course, this means you will end up with assembly language programming experience. :)

    You can find my Arduino stepper code here on E-Point (search for ULN2003) to use as an example. You will need to add a variable to keep track of where it was last so `middle' would know which direction to go, but "stepit(direction,# of steps);" runs the pins to make the motor spin.
    Good luck - sounds quite fun! (and kinda creepy) :)
  5. anroop


    Dec 11, 2013
    better get the datasheet of the motor and find if its a bipolar or unipolar stepper. then google or youtube helps you to understand the funtion.
  6. BitHead


    Mar 2, 2012
    It's one of those 28BYJ... 5-wire uni-polor types that's driven with a ULN2003 driver board that are often bundled with it on eBay.

    To kavinuma - I just finished a little project that used a PIC12F508 microcontroller.
    Since I also have that exact stepper motor, I'm going to program one to be a `ULN2003 interface board' - with two pulled-up input pins for "Step CW" and "Step CCW".
    That, plus a ULN2003 driver board, should make running that stepper as easy as a DC motor with a full-bridge driver.
    Hang in there - I'll be making PCB's with OSH Park - and they can take awhile. :-(
    I'll post again when I have working units in my hand.
  7. nas-r


    Apr 13, 2014
    Just to go off on a bit of a tangent here, you may be better served by a servo motor as it knows it's position and can be set to positions between 0 and 180 degrees. This would remove the need for a 'home' position when using steppers. Because a stepper doesn't know where it's currently positioned without some reference, a switch is often put at a position identified as 'home' and then the steps are calibrated as distance movements away from this position.

    With a servo motor this operation is simplified by saying "Servo go to 60 degrees"
    With a stepper it's "Stepper, move right until home switch is triggered, then move left X Steps (where X is the number of steps to turn the motor 60 degrees)"

    The downside with servos is their rotation is usually limited to around 180 degrees of rotation. Sounds like that would not have an effect on your planned application.

    Good luck.
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day