Whether we care to admit it or not, motors can be found all over in our everyday lives; they just tend to be hidden. Motors are present in cars, printers, computers, washing machines, electric razors, and much more.

However, there are a number of people (which until recently included myself) that would be uncertain of how to make a motor run if they were handed one. So, let's learn something today. Let's learn how to use a stepper motor!

## Step 1: Materials That I'm Using

In order to demonstrate how to use the stepper motor (a hybrid stepper motor), there are a few things that I will end up using.

Both the stepper motor and the Darlington Transistor Array are available in the chipKIT Starter Kit.

## Step 2: Stepper Motor Theory

Stepper motors are part of a class of motors known as brushless motors; these motors have a shaft but it does not physically touch anything in order to rotate. Rather, stepper motors work by utilizing electromagnets that are concentrically located around the shaft.

The idea behind electromagnets is that when a voltage of any kind is applied to a coil surrounding the piece of "soft" metal, that metal becomes magnetized until the current stops flowing through the coil. The central shaft rotates as the coils surrounding the electromagnets are brought to various voltage states. These voltage states create a magnetic polarity between the shaft and the electromagnet, causing the teeth of the shaft to line up with the teeth of the electromagnet. The motor can then be induced to spin by having the electromagnets appropriately change their polarity in a sequential fashion.

## Step 3: Types of Stepper Motors

There are three main types of stepper motors that exist: variable inductance motors, permanent magnet motors, and hybrid motors. Variable inductance motors only use the generated magnetic field to make the central shaft rotate and line up with the energized electromagnets. Permanent magnet motors are similar except that the central shaft is polarized to have magnetic north and south pole which will appropriately rotate to whichever electromagnets are turned on. The difference between this and the variable inductance motor is that the permanent magnet motor's central shaft does not have multiple "teeth"; just a north and south pole.

The hybrid motor, as you likely expect, is a combination of the two. Its magnetized central shaft has two sets of teeth for the two magnetic poles which then line up with the teeth along the electromagnets. Because of the double set of teeth on the central shaft, the hybrid motor has the smallest available step size and so is one of the more popular types of stepper motors. It is also the same type of motor that we will be primarily focusing on. You can learn more about the different types of stepper motors and how they are constructed here.

## Step 4: Unipolar Vs Bipolar Stepper Motors

There are two types of stepper motors: unipolar and bipolar stepper motors. On a fundamental level, these two types work exactly the same way; electromagnets are turned on in a sequential fashion, inducing the central motor shaft to spin.

The difference between the two types is the voltage levels. A unipolar stepper motor only operates with positive voltage, so the high and low voltages applied to the electromagnetic coils would be something like 5V and 0V. A bipolar stepper motor has two polarities, positive and negative, so its high and low voltages would be something like 2.5V and -2.5V.

Taking these electrical differences into account, the physical difference between these two styles is that the unipolar configuration requires an extra wire in the middle of each coil to allow current to flow through either to one end of the coil or the other. These two opposite directions produce the two polarities of the magnetic field, effectively mimicking the positive and negative voltage capabilities of the bipolar stepper motor.

Although both of these have a overall voltage range of 5V, the bipolar stepper motor will actually have more torque because current flows the entire coil, producing a stronger magnetic field to induce the shaft to rotate to the appropriate angle. On the other hand, unipolar stepper motors only utilize half of the coil length due to the extra wire in the middle of the coil, so less torque is available to magnetically hold the shaft in place.

## Step 5: Stepper Motor Wires

Different stepper motors can have different amounts of wires, typically 4, 5, 6, or 8 wires. A 4-wire arrangement is only able to support bipolar stepper motors, since there is no central wire available.

5-wire and 6-wire arrangements can be used for both unipolar or bipolar stepper motors, depending if the center wire on each of the coils is used or not. The 5-wire configuration implies that the central wire on the two sets of coils are internally connected together.

An 8-wire arrangement, although relatively unused, is the most flexible out of all of the wire configurations as it can be run in a unipolar 5 or 6-wire arrangement, or bipolar mode with a parallel or series configuration.

This particular stepper motor that I am using has 5 wires, implying that it is to be run as a unipolar stepper motor. We learned that this 5th wire is to allow current on that particular coil to flow in two directions. But should we connect it to a 5V power line? Or to 0V ground line?

## Step 6: So, Power or Ground?

Theoretically, the wire can go to either a 5V line (since our stepper motor is designed for 5V) or a ground line and then have the electromagnets energized in the appropriate fashion rotate the shaft.

Realistically, for the circuit that I am designing, I will need to attach the center tapped wire to a 5V line. The reason for this is because of the way that I am going to be sending the signals to the stepper motor telling it to "turn on" an electromagnet or not.

Digilent boards operate at 3.3V, so we would need to amplify their signals to 5V. We could use a four op-amps to bring the signals up to 5V, but I'd rather not have to mess with all of the resistors that I would need to use. Instead, I will use a Darlington Transistor Array. This IC has multiple Darlington Transistor pairs.

In a nutshell, a Darlington Transistor pair has two NPN transistors arranged in such a way so that when a high logic voltage is sent from the microcontroller, the output of the transistor pair will be a low voltage (0V), drawing in current from the 5V center tapped line.

However, if a low logic voltage is applied, the output will instead be at a high impedance state, because the NPN transistor will be acting as an "open circuit". This effectively prevents any current from flowing through the IC, and so no current will flow through the coils of the stepper motor. With no current flow in the coils, no magnetic field is created so the central shaft will not move. You can learn more about how Darlington Transistors work here.

## Step 7: Stepping the Stepper Motor

There are several different ways that stepper motors are able to be driven including full step, half step, and microstepping. Each of these driving styles offer different amounts of torque and step sizes that the stepper motor can use.

A full step drive always has two of the electromagnets "turned on". To rotate the central shaft, one of the electromagnets gets turned off and the next electromagnet is turned on, causing the shaft to rotate 1/4 of a tooth (at least for hybrid stepper motors). This style of always having two electromagnets on has the most torque out of all of the styles, but the largest step size.

A half step drive alternates between having two electromagnets and just one electromagnet turned on. To rotate the central shaft, the first electromagnet is energized as the first step, then the second one is also energized while the first one is still powered for the second step. The third step turns off first electromagnet and the fourth step turns on the third electromagnet, all while the second electromagnet is still powered. This pattern, shown in a picture above, uses twice as many steps as the full step drive, allowing for half of the step size, but it also has less overall torque since there are not always two electromagnets holding the central shaft in place.

Microstepping, not surprisingly, has the smallest possible step size out of these styles. One of the most common ways to peform microstepping is to do "sine cosine microstepping". This means that the current flowing through each coil is manipulated such that a sine/cosine wave is created. The "overlap" of the waves between two coils results in a large number of substeps. The actual number of substeps is dependent on how many distinct changes in current you can provide to the coils, but microstepping will still have the smallest step sizes, and thus the most precise movement, out of all of the styles. The torque associated with this style is dependent on how much current is flowing through the coils at a particular time, but will always be less than the full step drive.

## Step 8: Plans for Our Stepper Motor

I have found that this particular stepper motor, as a hybrid stepper motor, needs to sequentially turn on its four electromagnets about 200 times (as opposed to the supposedly 64 times that I have also seen) to rotate the central shaft a full 360 degrees. This means that each of the 200 or so teeth are about 1.8 degrees apart. I haven't determined an exact number since it's difficult to tell when an exact full rotation has been made as opposed to a full rotation plus a tooth.

I personally do not have a need to have a smaller step size than ~1.8 degrees and am interested in having as much torque as possible, so I will demonstrate (with code) how to use the full step drive which always has two of the electromagnets turned on at a time. You can check out how to use the half step drive in code here.

## Step 9: Making the Circuit: Part 1- Power

But before we actually start running the stepper motor, lets make our circuit first.

Create a 5V rail and a ground rail on your breadboard by connecting the 5V supply on the uC32 to the breadboard's positive rail and connection one of the ground pins on the uC32 to the negative rail on the breadboard.

Then, using the pinout diagram for the ULN2803A, connect the GND pin (pin 9) to the negative rail and connect the COM pin (pin 10) to the positive rail.

Finally, since I designed the circuit to drive a unipolar stepper motor, connect the 5th wire (red in the case of this stepper motor) to the COM pin.

If you know you have a unipolar stepper motor, but are not sure which wire is the one that is in the center of the coils there is a way to figure out which wire it is. Simply measure the resistance between pairs of two wires coming out of the stepper motor. When you find a wire that consistently measures half the resistance when it is paired with all of the other wires, that wire is the one attached to the middle of the coils (hence half the resistance).

## Step 10: Making the Circuit: Part 2 - Signal Lines

Naturally, we'll need some wires that will signal to our stepper motor which electromagnet should "turn on".

Connect four of the numbered (as opposed to lettered) digital pins on the uC32 to four of the inputs on the Darlington Transistor Array. I used the digital pins 34, 32, 30, and 28 on the uC32 and the inputs 1B, 2B, 3B, and 4B on the Darlington Transistor Array, respectively.

Then, connect the outputs of the transistor pairs, (1C, 2C, 3C, and 4C in this case) to an appropriate wire on the stepper motor. What I mean by that is that you want your outputs to attached in a sequential fashion to the coils of the stepper motor.

For example, you would want your first output connected to the first coil, second output for the second coil, and so on. What you do not want to have is your wires all mixed up with the first output connected to the third coil, the second output connected to the second coil, the third output connected to the 4th coil, and the last output connected to the first coil. If you do not know which wire goes to which coil (and putting all of the outputs in a row doesn't seem to be working), look for a datasheet diagram showing you which one is which, much like the diagram I found for the 28BYJ48A stepper motor.

## Step 11: Performing the Full Step Drive in Code

To simulate the full step drive with our microcontroller, we will need to make that our signals that we give to the stepper motor are arranged in such a way so that the coils within the stepper motor are energized sequentially. I mentioned this bit earlier, but it's good to double check, otherwise its awkward when you have set everything up right, but nothing happens because a couple of wires are switched.

To energize a particular coil, it needs to receive a low (0V) voltage signal so that current is able to flow from the center tapped 5V line to the end of the coil at 0V. With the Darlington transistor pair, this means that we need to digitally write the pin associated with that coil to a logic high voltage. This nicely makes sense; drive a pin high to turn on an electromagnet and drive a pin low to turn off an electromagnet.

In full step drive, two electromagnets need to be turned on at a time, so we will digitally write two adjacent electromagnets (such as coils 2 and 3) high and digitally write the remaining two electromagnets low. We then need to implement a delay for enough time to allow the central shaft to start moving and get to its destination. I have found by trial and error that for my stepper motor this is about 1.6 milliseconds. After that waiting period, we can turn off one of the electromagnets (such as coil 2) and then turn on the next electromagnet (coil 4 in this case) and then wait before turning off and on the next set of coils.

You can see how this pattern might look in the above picture. The actual code that I used provided in the text file below.

## Step 12: Parting Thoughts

Although they are not the fastest type of motor, stepper motors are a great way to rotate something in precise incremental steps with a decent amount of torque for their size. Feel free to check out the video to see what I mean.

If you have any questions or comments that you want to share, please feel free to do so and I will do my best to answer any question you may have.

Check out the Digilent Blog to see what other cool things the Digilent team and I are up to!

<p>So I am using a 4 wire but it just hums, the shaft does not move. I am confused.</p>
Generally, when I encountered the humming it meant that the various poles on the motor are not being enabled/disabled in a sequential order or that you are not using a high enough voltage to get the motor to turn. I had a bit of trouble getting the 5V motor I used to nicely rotate with 3.3V logic.
<strong>This is really cool!!!!</strong>
<p>I made this example with an Arduino Nano changing the pin numbers because it has no pin higher than #13.</p><p>Another change I made is that I simply used a driver board instead of the raw Array-CI. This is more practical but has no electronic difference.</p><p>The good part of this example is that no library is required.</p>
<p>Very nice Instructable. Thanks</p><p>The very best</p>
<p>Help Is that woking for Arduino Mega 2560 +Ramp 1.4</p>
<p>it is very helpful to understand the stepper motor thank you</p>
<p>I've been having some trouble with motors. I'm completely new to this and I've been playing about with all sorts of arduino sketches from here and their example ones, but all of the motors feel like they're burning rubber on the inside without actually moving the shaft. I've tried dcs, servos and steppers, so I assume it's something I'm doing, but I can't work it out. Has any got any ideas? Any and every is welcome at this stage!</p>
<p>When you opened with &quot;Whether we care to admit it or not, motors can be found all over in our everyday lives&quot; I just imagined someone denying that motors make our phones vibrate and our garage doors open and how hilarious that would be....</p>
<p>It would be pretty funny, although admittedly I was one of those people (admittedly awhile ago) that was living in those dark ages thinking that motors were everywhere. I'm not sure how I would've answered onto how a phone vibrated though; that's probably part of the reason of why I am now correctly informed.</p>
<p>12v stepper motor control with a arduino</p>
<p>Nice!</p>
<p>Nice instructable. I wanted to test and see if I can run several steppers I've been collecting, but I noticed the ULN2803A only stands 500mA per collector. And the stepper motor I have runs at 0.7 amps. I was wondering if you know another popular array (with 4 transistors if necessary) that can handle around 1 amp. </p><p>I guess I could also buy transistors per separate, but I prefer a less bulky chip.</p><p>Thanks for your time.</p>
<p>You can double the capacity to handle current by combining 2 inputs and 2 outputs. If you want to upgrade an existing project, simply solder another 2803 on top of the first chip.</p>
<p>To be honest, I haven't worked much with transistors until this Instructable, so I do not know what a &quot;popular&quot; one might be. </p><p>However, after doing a search on digikey, I did find a <a rel="nofollow">list of transistor arrays</a> that had outputs of 1amp or greater. There are a bunch of individual transistors that will also work (since it's easier to get a big heat sink on them), but as you said, they are more bulkly.</p><p>Let me know if you have any more questions.</p>
<p>Thanks, I did a bit of research too and I bought a L293DNE and I plan to buy a L298, I still don't know too much about the L298 and H bridges, but I'll get into it eventually. Thanks!</p>
<p>Sounds like fun! I haven't gotten much opportunity to work with H-Bridges myself, but they don't look too bad; they're essentially a set of switches that let you complete the circuit in one direction or the other. At least, that's what I learned from this Learn Module: <a href="http://learn.digilentinc.com/Documents/325" rel="nofollow">http://learn.digilentinc.com/Documents/325</a><br></p>
<p>Thanks for the info! I successfully drove a stepper motor I found in a printer, although the voltage has a strong correlation speed of the motor, causing it to fail if it's not set up according to the stepping speed. I guess this could be solved with a current limiter. I'll keep trying.</p>
<p>You could use a current limiter to get that rotation speed slower. I'm not sure how the printer stepper motor is set up, but if it has a bunch of individual steps like mine, you could just increase the delay time between energizing the individual coils, effectively making it rotate slower.</p>
<p>Apparently, my link below doesn't work (at least for me) so here is the expanded link: <a href="http://www.digikey.com/product-search/en?pv812=183&pv812=191&pv812=426&pv812=238&pv812=216&pv812=186&pv812=178&pv812=188&pv812=173&pv812=108&pv812=177&pv812=46&FV=fff40015%2Cfff8007a&k=darlington+transistor+array&mnonly=0&newproducts=0&ColumnSort=0&page=1&quantity=0&ptm=0&fid=0&pageSize=25" rel="nofollow"> http://www.digikey.com/product-search/en?pv812=18...</a><br></p>
<p>i want to activate my nema 17 stepper motor just only in 45 degrees angle. how can i do it? please help. thank you. :D</p>
<p>Good article Colvin. If you were to use a stepper motor as a generator which would be better a unipolar or bipolar ? Is there any special requirements to produce good results. I was thinking of a simple kids project.</p>
<p>i really need help fast</p>
<p>my adriuno said there was no coil4 pls help me</p>
<p>You forgot to mention the big advantage of unipolar motors; the whole reason they exist: you only need 4 transistors to drive a unipolar motor; you need 8 (2 full bridges) to drive a bipolar motor. So if you don't need the full strength of a bipolar motor, the unipolar motor is much simpler and easier to drive (so simple you don't even need a stepper motor driver or board, just literally four transistors wired straight to your microcontroller).</p>
You're completely right; the fact that the unipolar stepper motor just flat out requires less components to operate makes it much more accessible and convenient to use for a wider variety of people.
<p>thank u very much that was helpful :)</p>
<p>Hii I would like to know from you that I am trying to make a system where the stepper motor needs to to give a step of 8 degree every 30 minutes. </p><p>Stepper motor model - BH42SH33-0404A</p><p>I need to know the required arrangements and driver circuit required for the system to work.</p><p>I will be grateful if you can help me out in this problem. Nayone if you can, please help.</p>
<p>USE L297+L298 </p>
<p>Please help me!!! I have used this technique to drive my unipolar stepper motor just a little bit another way and succeeded to run in CCW that means first loop works fine but at second loop my stepper just vibrate and do not run CW after that it runs again CCW mode. <strong>The motor heated up a lot afer few cycle. </strong> whats wrong with my code? I am using 24BYJ48 motor, Atmega8, ULN2003 and codevision avr.</p><p>PORTB=0b00001001; // setting the inital state of the electromagnets</p><p>delay_ms(20);</p><p>while (1)</p><p>{</p><p>for(i=0; i&lt;202; i++) // looping through this chunk of code for ~ a full rotation</p><p>{ //This loop works</p><p>PORTB=0b00001001; delay_ms(20);</p><p>PORTB=0b00001100; delay_ms(20);</p><p>PORTB=0b00000110; delay_ms(20);</p><p>PORTB=0b00000011; delay_ms(20);</p><p>}</p><p>PORTB=0b00000110;</p><p>delay_ms(2000);</p><p>for(i=0; i&lt;202; i++)</p><p>{ //This loop not working</p><p>PORTB=0b00001100; delay_ms(20);</p><p>PORTB=0b00001001; delay_ms(20);</p><p>PORTB=0b00000011; delay_ms(20);</p><p>PORTB=0b00000110; delay_ms(20);</p><p>}</p><p>PORTB=0b00000110;</p><p>delay_ms(2000);</p><p>};</p><p>}</p>
<p>Great ible! thanks for sharing! I was wondering if it is possible to controll more than 2 steppers with an arduino board? something like 10 or 20 of them (why not 100). Did anyone try something like this? </p>
<p>In theory, the answer is yes.</p><p>However, you will be limited by how many output pins your board has since most stepper motors need 4 signals lines. So, since Digilent's uC32 has 42 input/output pins, I could theoretically drive up to 10 of them. This could be expanded even further by using a <a href="https://www.instructables.com/id/Operating-a-Shift-Register/" rel="nofollow">shift register</a> in combination with the Darlington Array.</p><p>But, you will be limited in terms of how much current your microcontroller can output, so you would need to use a power supply as your source of current. If you are driving a lot a steppers though, eventually you will become limited in how quickly you can have your microcontroller switch which electromagnets are &quot;turned on&quot; in your plethora of steppers.</p><p>In short, you can definitely drive two stepper motors with an arduino. More steppers will require more work.</p><p>Let me know if you have any other questions!</p>
Thank you! I'll give it a try with Digilent's chipKIT Max32, with more than 80 I/O ! and the easy stepper driver. This one only requires 2 outputs per stepper, if I am not wrong!<br><br>=40 steppers on 1 board!<br><br>Thank you once again for helping!
<p>Actually, the chipKIT Max32 will still need to have 4 outputs per stepper (since stepper motors need 4 inputs). So, you'll only be able to wire up 20 steppers to the Max32, but, nevertheless, that's still quite a lot.</p><p>Good luck!</p>
<p>Well if I'm not wrong, the easy driver can control a stepper by only using 2 digital outputs, <a href="https://www.sparkfun.com/products/10267" rel="nofollow">https://www.sparkfun.com/products/10267 </a> . You can find cheap copy of these ones for less than 2\$</p><p>I ordered a few of them to run some tests....</p><p>my goal: <a href="http://2.bp.blogspot.com/_9cvLDPPuQJw/S6u2hNwojMI/AAAAAAAAGQY/DVFst9A6OF8/s640/Kinetic_Sculpture_BMW_Museum.jpg" rel="nofollow">http://2.bp.blogspot.com/_9cvLDPPuQJw/S6u2hNwojMI/...</a></p><p>Thanks once again</p>
<p>Oh ok, that's pretty cool!</p>
<p>Hello, I tried to drive the motor 24BYJ48A using a PmodStep (the driver). I used a function generator to provide the PWM ignal and I used 5V for at the pin 1 of J1 and sent the signal on pin 5. I connected the jumper JP1 to Vcc and i also connected an external power supply (5V) at H5 taking the right pin to be negative and left pin to be positive (5V ). I then connected the motor to J2 (bipolar), connecting orange wire to pin 1, yellow to pin 2, pink to pin 3 and blue to pin 4. Still my motor only vibrates but does not rotate :/ Can anyone help??</p>
<p>Hi sweta.dauhawoo,</p><p>You will need to send separate pwm signals for each of the wires (orange, yellow, pink, and blue), corresponding to signals 5, 6, 7, and 8, respectively, which are pins 7, 8, 9 and 10 on the 6x2 pin header. Also, you will not need to use both Vcc and an external power supply; only one of those is needed to run the stepper motor.</p><p>The PmodSTEP is not actually a driver in the traditional sense. It is simply a &quot;pass-through&quot; board that physically organizes your signals.</p><p>If you are wanting to run the stepper motor in bipolar mode, you will need to be able to produce a negative voltage (or have current run in the opposite direction through the coils). This can be accomplished by having your system board interface with an H-Bridge before the signals reach the stepper motor.</p>
Is it possible to ignore the common wire (red in this motor) of 28BYJ48A s (the one in this instructable ) and use it as 4 wire bipolar ? Because some motors are different and it isn't possible to do this with them , but I don't know about 28BYJ48As .
<p>It can be done but it's not that easy. I 've done it in my projects (you can check them on Instructables! ) and it surely doubles the torque. It can't be done directly because a bipolar motor has no &quot;common&quot; wire tapping both coils (this is what red wire is doing). </p>
<p>Not really that difficult... currently you are using 5 lines... four for coils, and one where the two ground lines are tied together. If you ignore the grounds... you can drive the coils directly... lines 1-2 for one coil, and 3-4 for the other. You are currently using 4 signal lines... connect up a SN754410NE chip, and use your four signal lines to drive that... The chip will create the +/- signals needed... although your bit pattern will be different. And you get the extra torque. I am using 6-line steppers on my lathe... and one day thought about that... I rewired them and now they run cooler with more torque.</p><p>Let me do a quick Google search... ah... found some examples... here is one...</p><p><a href="http://roevalley.com/newsbrowser/pi_projects/pi_bi-step.htm" rel="nofollow">http://roevalley.com/newsbrowser/pi_projects/pi_bi-step.htm</a></p><p>Someone want to do an Instructable on this?</p><p>Huh... just found 10 of them in my drawer... let me see if I have time...<br></p>
<p>6-wire motors can work like this but 5-wire ones can't (tried it myself). To make 5-wire motors bipolar you have to destroy the common wire connecting the 2 coils (open the motor). This isn't difficult using the 28byj-48 motors, there is even a youtube video about it.</p>
<p>I'll have to try it... in theory... if you put +V on one side of the coil, and -V on the other side, the center tap should be 0V. I would think that it would not effect the other coil... if there are slight manufacturing differences... you would get some minor inefficiency... but overall should still be better. I'll wire one up and do some testing. I don't want to modify the stepper... so that I can revert if I want to. If I get the chance to test it out, I'll update here.</p>
<p>You can use an H-bridge with a 5-wire motor but you need to ground the common wire. If you don't you will get jogging and nothing else.</p>
<p>Totally! </p><p>From my understanding and the research that I've done, the nearly all stepper motors can be run as a bipolar stepper motor as long as you leave the common wire floating. I just didn't have a way to create a negative voltage (or have a convenient H-bridge on hand to reverse the current) so I ran this motor as a unipolar stepper motor.</p><p>As a side note, the stepper motor I used, at least according to the sticker on the back of it, is actually 24BYJ48A. That being said, I don't think there is a difference between it and the 28BYJ48A, so both of those motors can be run as either a bipolar or unipolar stepper motor.</p>
<p>Look at the L293D chip or the <a href="http://www.mouser.com/ProductDetail/Texas-Instruments/SN754410NE/?qs=AMJt07B76uuZ4Fb3eRjJ6A%3d%3d&cm_mmc=google-_-ppc-_-americas-_-TI-CoOp&gclid=CjwKEAjwns6hBRDTpb_jkbTv1UYSJACBhberEfKr1cTQmQU0YHhXAWj8i8FYzua_6kk0eghijjVtaRoCC6vw_wcB" rel="nofollow">TI SN754410NE</a> chip... dirt cheap, and can run your stepper in bipolar mode. (<em>Also good for small DC motor drivers</em>.) </p><p>The stepper you are using is actually a gear-motor stepper (<em>looks like the same one I have</em>) so instead of the typical 200 steps per revolution... I'm seeing 4096 steps... which is cool for the project I'm working on. (<em>May have an instructable to follow.</em>)</p><p>Nicely written... great instructable!</p>
<p>Thanks!</p><p>I haven't heard of the gear-motor stepper before...what is the difference between it and a hybrid stepper motor? I was also seeing 4096 on various datasheets for this motor, but when I ran the code on the microcontroller it took 200 times of rotating through the 4 electromagnets to get a full 360 degree rotation. So to me this meant that there was 200 teeth on the internal shaft, for 800 separate electromagnet changes, as opposed to the 4096 steps. Maybe the 4096 steps is for microstepping?</p><p>I actually do have that L293D chip, but I had completely forgotten that I had it. I'll try to add it to this instructable to show off the bipolar mode at some point in the future.</p>
<p>It's pretty simple... they have a series of gears on the output of the stepper... so normally these things are about 200 steps per revolution... so you go through your 1,2,3,4 sequence 50 times and you have made one revolution. But in this case... you have an output gear... so it takes 1024 of your 1,2,3,4 cycles to get one revolution... </p><p>As an added bonus... because it has a gear train in there... you get more output torque for a smaller size stepper... with less current. You do sacrifice speed... but for what I'm doing... that is not an issue.</p><p>(Can you say Pan/Tilt head for a GoPro???)</p><p>Now watch... someone else will beat me to it... :-)</p>
<p>A pair of servos would be a little more practical for a pan/tilt.. (and would also hold position easier). Once you remove power from a stepper motor, it would release position..</p>
<p>Actually, for what I am doing the steppers are better. A servo (<em>common hobby servo</em>) uses a pulse width to determine it's desired location... you must send a constant stream of pulses which the unit converts into an analog voltage and runs through a comparator to drive a DC motor. The accuracy is limited by the width of the pulse, the accuracy of the DC supply line, and the mechanical losses and backlash in the system. A stepper on the other hand can be indexed, then the precise number of steps can be driven. As for a loss of steps, normally you would be correct... however these are gearmotor steppers with a very high accuracy 0.0878 degrees per step, so I'm thinking about a 20:1 gear ratio... a lot of torque would be required... more than the weight of the GoPro in the device. Holding/recovering position is very simple... once the stepper reaches the index (<em>limit switch, etc</em>) you would know the exact number of pulses to send to return to the same location. I need four lines instead of three... and four signals instead of 1, but that's not really an issue for me. I can use a AVR Tiny13 and write a serial input on the remaining line... so I'm back to 3 lines... Supply, Ground, Signal. And I can serially command it to any location instantly. Humm... might be worth an Instructable.</p><p>If you are curious about programming the AVR chips directly...</p><p><a href="https://www.instructables.com/id/Getting-Started-with-Atmel-AVR-and-BASCOM/" rel="nofollow">SHAMELESS PLUG</a>. </p>

372,822views

1,190favorites