Arduino : How to Control a Stepper Motor With Potentiometer

58K26711

Intro: Arduino : How to Control a Stepper Motor With Potentiometer

This instructable is the written version of my "Arduino : How To Control a Stepper Motor with Potentiometer" YouTube video that I've uploaded recently. I strongly recommend you to check it out.

My YouTube Channel

First, you should see the following Instructable:

How to Control a Stepper Motor With L293D Motor Driver

STEP 1: Tutorial


This tutorial is all about tuning the speed of a stepper motor using a potentiometer. The idea is to up or down the speed of a stepper motor using with analog read. Theoretically analog input to a digital output, we're going to use this concept to control the speed of a running stepper motor.

STEP 2: Hardware Required

Hardware Required :

- 10k Potentiometer

STEP 3: Circuit & Connections

The Stepper motor used here is a rusty old EPOCH (5 wires) stepper motor, which is a unipolar stepper.

Use the analog input with the help potentiometer to control the delay in-between each steps of the stepper motor. Shorter the delay in-between each steps - faster the stepper motor runs and vice-versa.

STEP 4: Programming

STEP 5: If I Was Helpful

First of all, I would like to thank you for reading this guide ! I hope it helps you.

If you want to support me, you can subscribe my channel and watch my videos.

My YouTube Channel

6 Comments

I've been "migrated" for some time now of them steppermotor's actually work's? That I know that they go on steps of two, via an H-bridge, (or ewen a half-H-bridge). Nothing about how to actuate them, no. But in the "deep.. deep beyound", don't YOU need a feedback of it's accurate position, (actually after ewery "click"?).

Usually they use a microswitch in both "home" and "end" position's and then calculate the "relative" position by counting the number of pulses sent?

There's many ways to owercome this "dumb" way of control. A Pot-feedback, works but not good enough. An optical, (IR-tranceiver), good enough for "most" feedback, Gray-code coders, (they actually are 100% mechanically, even they are sold in a form of a potentionmeter, check it out on Goo). There's (for real) them 16-bit and higher Gray-coders. Imagine: to get a feedback of a steppermotor making 1 step and the feedback will tell you that, easy to keep the count. Me, a newbe with Arduino, made a routine from my previous project's written in Assambler, and translated it to c++, Java, I'll DIY it later on, timegenerator using the benefit of a prosessor genereting both a microsecond and a millisecond to be read during your process of something. The downside with these functions is that the normal command for them is: "delay(xx)", and thats exactly what it does, it actually "halt's" the execution of your program for the delay time, (nothing else happends during that delay). So, back to stepper's, if you use my timegenerator you'll get a timewindow of a millisecond to be totally controlled, (You can make this timewindow to be 1 microsecond, but really??). This my timer is "dynamic", that is because the processor itself generates a "timer-interrupt internally" and executes that, my timer "just" reads the result of that. After that it's a peace of cake to multiply that 1 millisecond to whatewer. Again, back to steppers, you can use them cheep 2-bit Graycoders to be fedbacker's, could write a whole book on object.

Hi Kiselin. You have some good insight into stepper motor powered devices. Most of the stepper motor devices I am familiar with are open loop control. With open loop you send the signal to the stepper and hope it does what it is supposed too. Closed loop systems require feedback of what actually happened. Closed loop systems are a lot harder to implement.

Thank You for your comment. I'll later on making a DIY-feedback solution, with a Gray-coder. I try to do it with a low-cost 2- or 4-bitcoder. And gonna use my "own" time-generator code to it in the software. I'll publish it later on here in Instr's as a DIY, both the code and testresults, aren't having the coder's yet, (have ordered them).

I understood why did you this comment :/

I'm sure it takes a lot less effort for someone who is interested in this to understand it, than the effort it took for you to write it. Thanks for your effort!

Joe