Is this project possible? (By possible I also mean not break the bank)

Hi, I’m new to Arduino and stepper motor control but I’m working on a home project and considering using a stepper motor. Basically I want to be able to position a dial in one of 7 positions using 3 buttons. I’m thinking I need a home sensor to bring it to the first position when powered on. What I would like to know is how difficult this would be and from your experience what components would I require?

I have attached a rough outline of the project which might make what I am hoping to achieve a bit clearer. Any advice or guidance would be greatly appreciated.

Yes should be quite straightforward. I would advise you get a proper stepping motor driver and have a read of Stepping motor basics

You would need some sort of end stop detector, micro switch or opto slot are simple.

Robin2's stepper motor basics. has lots of info on stepper motors and drivers. A home switch (micro switch, opto interrupter) is necessary to seek a starting point. Programming the Arduino to read the switches and control the driver is not very hard.

May I suggest that you look at a servo to do the job. No home switch nor driver board necessary. Just sent it an angle and it will go there if possible.

How much torque is required?

Sounds very plausible. As you surmise, you'll need an appropriate stepper motor driver; One of Pololu's would likely do unless this is a heavy duty motor. Yes, you'll need a microswitch to allow you to home the stepper. Any Arduino could do the job.

Don't forget to debounce your buttons. The binary button interface seems a bit unfriendly though. I'd be inclined to have a button for each state or a pot with a pointer on it with numeric labels around it and use analogRead.

Rotary encoder is another choice for input.

Thank you for your quick replies. I wasn't concerned about the motor torque required because I was hoping to achieve it with a low rated motor to begin with to see if it can be done with regards code and then scale up maybe a 2Nm rated motor if I was happy with how it worked.

I would definitely consider using a servo motor but I was under the impression that servo motors are much more expensive, especially if I want to scale up to a higher torque motor in time, is this true?

Thank you for the suggestions on how to control the different positions but I must add that controlling the 7 different positions using 3 buttons is what I would really hope to achieve because this makes the system user friendly and scalable. For example if I can achieve 7 positions using 3 buttons I can scale up to achieving 15 positions using 4 buttons. Just some background on why I want to do it this way, what I am trying to do is open and close particular air vents, so If for example I press the button labelled "vent 1" it will move the motor to open vent 1. but now if I want vent 1 and 2 open I just press button 1 and 2 and the motor will move to a position that opens vent 1 & 2. This would remove the need for a button that reads "Vent 1&2". The benefits of this would become more clear if I wanted an extra vent. I would then have 4 vents and 15 different settings and so on.

Sorry to bore you with details but this is what led me to believe it may be a bit more difficult than what I first thought. Could you advise me on where best to seek support regarding the code for such a project?

P_Nihill: but I was under the impression that servo motors are much more expensive,

I believe @groundfungus was referring to a hobby servo of the type used for controlling flying model airplanes and not the expensive industrial servo motors that are used in place of stepper motors.

The hobby servo has the advantage of inbuilt electronics and position control.


maybe a 2Nm rated motor

Might want to consider a geared DC motor with limit switches. Worm drive reducer will hold position with the motor unpowered.

Steppers (with powerful enough drivers) and servos in that torque range are more expensive.

Might want to consider a geared DC motor with limit switches

This sounds like it might be the solution I require. I quickly drew a schematic of what was in my head in terms of using limit switches to control the 7 positions. Could you throw your eye over it and let me know if I’m on the right track.

I put a relay into the circuit just to show how I would control a heavier duty motor. A collar would be fitted on the motor shaft with physical contacts to activate the limit switches at pos. 1-7. Button 1,2 & 3 on the HMI would activate the secondary circuit which contains a N/C relay and connects the DC motor. 1 of 7 digital pins will be providing an output voltage depending on what combination of the 3 buttons are pressed on the HMI using the analog input pins. When the N/O limit switch, that corresponds to the active digital output pin, is closed by the shaft collar then the N/C relay will be opened and the motor stopped. Have I over complicated things? See image attached

Granted I don’t have the code to control the digital outputs yet but if this was a possible solution I would get to work on the code.

If using a DC motor you will need an H bridge to get forward and reverse, a single simple relay will not work. You can use 2 relays, one DPDT to control the direction (open, close) and one SPDT to control the power (on, off). Or there are motor control boards that have the H bridge and can also enable speed control via PWM. You can't really PWM a relay.

Since you are using a controller (Arduino, I assume) I would separate the sensing and control functions. The position switches are connected from ground to input pins and are not part of the motor control circuit. As the motor is moving poll the switches to see if the position has been reached and stop the motor.

I don't quite understand the input switches (HMI). When you are pushing the switches, how does the controller know when the number that you want is entered. Even if you think that you are pushing them at the same time there will be differences in the times the switches actually close. A pot or rotary encoder could be used to set the position required and a push switch to enter the setting and tell the controller to make the move. Rotary encoders often have built in switches. You push the knob (shaft) to actuate the switch.

Where does the dial fit in?

You have buttons and vents...

Strength of a motor is only needed for how fast you want something (vent?) to move when you can apply leverage in some form(s) to the job.