# Stepper motor control

Discussion in 'Sensors and Actuators' started by seagull369, Sep 6, 2017.

1. ### seagull369

11
0
Nov 30, 2014
I need to control a stepper motor in a similar fashion to the one shown in this youtube vid.

In my case, the motor only needs to move in 3 positions (12 o'clock, 6 o'clock, 8 o'clock). 3 buttons would be used, each bringing the motor its respective location and then hold it there. In this project, the motor can't be traveling anywhere in the area between 8 and 12,

I don't have much experience in doing this sort of thing, so I was hoping some kind soul wouldn't mind help pointing me in the right direction. Although the video I posted didn't explain how it all worked, similar youtube videos used Arduinos.

Any ideas?

2. ### Minder

3,020
640
Apr 24, 2015
Appears to be controlled with μP of some kind.
This would probably the easiest for a custom set up, are you familiar with any of the Arduino Picmicro products etc?
Roman has a few steppers circuits here https://www.romanblack.com/
M.

3. ### kellys_eye

4,275
1,146
Jun 25, 2010
The principle is straightforward in that you know the distance travelled in one 'step' of the motor and that a single pulse makes the motor 'jump' that far therefore 'x' pulses get it to the specified position.

A circuit to produce the pulse string(s) to move it where it's required and the same number of pulses in the reverse direction to return it to the starting point.

There are dedicated stepper motor driver chips that have inputs such as 'step' and 'direction' and connect straight to a stepper motor. As @Minder states, a simple Ardunio circuit that counts and recalls the count (therefore position) would be required. It could be done with discrete logic but in a far more complicated manner.

Many Arduino tutorials exist that offer the learning experince with steppers but there's no getting away from the fact that you will need to get your hands on one and start to learn the basics of Arduino porgramming.

4. ### seagull369

11
0
Nov 30, 2014
No, unfortunately I don't. Could you recommend one that might be appropriate for the project?

I don't mind starting from scratch on this, kellys. The idea has actually interested me ever since I took a Visual Basic class some years ago. I actually purchased a Basic Stamp at one point, but I guess since I never really had an actual need for it, I never got around to playing with it. .

Would you know of a good place to start to learning about Arduino and the programming?

5. ### kellys_eye

4,275
1,146
Jun 25, 2010
Ardunio's own website isn't too bad a place to start:

https://www.arduino.cc/

and you'll need to go there to download the IDE (programming environment) anyway. Arduino uses a lot of 'libraries' - code packages for specific purposes - and one such library (or 'sketch' as they are known) is written specifically for controlling stepper motors:

https://www.arduino.cc/en/Reference/Stepper

Have a look for yourself and explore the very good tutorials associated with them.

6. ### Irv

112
30
Jun 7, 2017
This would make an interesting series of engineering assignments. After the solutions using stepper motors are presented, next week we'll do the same without steppers - 1930's style. The week after that, without electricity, steampunk style.

Back on topic, have you considered how you are going to know how many steps and which direction to move the pointer after the power has been cut off and later restored?

7. ### seagull369

11
0
Nov 30, 2014
That's a very good point. I suppose once the power is off, the Arduino wouldn't remember where the motor's position is once power is restored,

I should probably explain what my end goal here is. This project is for my truck, specifically to engage/disengage the 4wd system. The positions fn the clock mentioned earlier represent the 2wd, 4wd high and 4wd low positions of a shaft on the transfer case. 12 is 2wd, 6 is 4wd high and 8 is 4wd low range. The current setup isn't working and is notorious for being problematic, so that's why I wanted to replace it.

Instead of going the Arduino route, I've been thinking about possibly using something simpler like this instead and was curious what you guys thought of it. It's a blend door actuator (motor) which is controlled by the rotary temperature knob (which apparently is a potentiometer) on the dash. When you move the temp knob from, say, hot to cold, The motor mirrors that movement and moves a door its connected to to let cold air in. In the old days, a simple push/pull cable was used to accomplish this. This actuator is supposed to be able to hold its position even after power to it is shut off then turned on again.

Anyway, instead of using push buttons, as I suggested earlier, I guess I could just use a rotary pot to change positions. I could just put some marks on the dash to know how far to turn. The only concern I have with this is idea that the actuator wont have enough twisting force to move the shaft on the t-case. The shaft doesn't require much effort to move, but it's more than the heater door. The gears inside the actuator are only light plastic.

8. ### kellys_eye

4,275
1,146
Jun 25, 2010
Quoted from the Arduino site:

"The microcontroller on the Arduino and Genuino AVR based board has EEPROM: memory whose values are kept when the board is turned off (like a tiny hard drive). This library enables you to read and write those bytes."

But for a simple positional control actuator controlled by a potentiomenter then a simple servo actuator will do.

9. ### Irv

112
30
Jun 7, 2017
Yes a heavy duty servo would work. He asked about steppers, however, which do not "remember" where they are, and have no concept of a zero or reset position. Your servo idea is more suitable, now that the problem has been explained.

10. ### seagull369

11
0
Nov 30, 2014
If the blend door actuator proves not beefy enough to turn the shaft, where might I find a servo motor that has some decent turning force? The ones I've been finding appear pretty light duty, more suitable for small r/c cars.

If I ever need to use it in the future, it's good to know the Arduino 'remembers' things even when the power goes off

My apologies for the late reply. I didn't notice there were new comments since posting my last message until now.

11. ### kellys_eye

4,275
1,146
Jun 25, 2010
You need to search using 'high torque servo' to get the right one.

12. ### Minder

3,020
640
Apr 24, 2015
A prime decision on selecting a motion controller or servo, is generally based on the final rpm or positioning rate required, if relatively very slow positioning is required, some system of gearing is used in order to economically size a motor and drive, IOW, It is Pointless to select a powerful motor and drive to run direct drive when just a few rpm is required.
Gearing obviously economically allows a very small motor to achieve the desired function at a much lower price and size.
A door actuator hardly requires very fast operation!
M..

13. ### seagull369

11
0
Nov 30, 2014
I'll give the "high torque" one a try. I searched 'heavy duty' last time, but most every servo listing, it seemed, claimed to be that.

The speed isnt really an issue for this application and, you're right, the door actuator is pretty darn slow. Only problem is uses plastic gears internally, so it may not be the best option.

Thank you all for the great help.

14. ### Alec_t

2,906
785
Jul 7, 2015
You can get high torque modeller's servos with metal gears. Measure the force you need to move the shaft, Specify the rate at which you need the shaft to move and the distance involved.