Using the knob to implement step/dir mechanism for motor control

Status
Not open for further replies.

bhl777

Full Member level 6
Joined
Sep 30, 2008
Messages
363
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,296
Activity points
5,140
Hi All,

I am trying to implement a knob-controlled step/dir mechanism to drive the motor using Arduino and any necessary circuits.
This is what I have and what I want to achieve. Would anyone give me some suggestions on what can be done using the MCU and/or any necessary external circuits? Any suggestions or useful online examples are highly appreciated.
Thank you!
 

Hi,

Code is almost complete available at Arduino IDE.(or available as downloads)
* Step/DIR interface, in "position control".

You just say "run to position x"
Where x = ADC_result × your_factor.
Then the software automatically controls, STEP, DIR does acceleration and deceleration.

It is done many thousands times before. Just do an internet search "arduino step dir position control"

The only thing you have to do is to define your "idle" state. The ADC may be noisy, thus the ADC results may differ a bit from one to the other. No one can define this for you.

Klaus
 
Hi Klause,
Thank you so much! Since "idle" could be a problem due to the noise introduced by ADC, would you recommend just using keeping DIR as the GND for the cases including (1) turning the knob in CCW, and (2) idle?
If there are more considerations that should be considered, would you advise as well?
Thank you!
 

Hi,

DIR: for stepper controllers ... I don´t think "high impedance" is a true thrid state.
--> Why do you need "High impedance"?

Usually there is an ENA signal to put the stepper driver into IDLE mode.

For "your idle" state I guess you need some kind of hysteresis. So: as long as the ADC_value is within a small deviation around the last_valid_value you may call this IDLE. Simple software.
Why do you need to detect your IDLE state at all?

Klaus

Btw: I recommend to call it "poti" instead of "knob".
An idea: Why don´t you use an encoder. They look similar to a poti, but have digital output, thus they don´t suffer from the noise problem. Do an internet search for "encoder alps". ALPS is the manufacturer, you may use a different brand encoder.
 
Use an ATTINY85 to gen the PWM and direction signal :



Blocks in 3'rd window (copied out of second window) block library, config part. Tool,
mBlock, gens the Arduino code in right hand window to program via Arduino IDE the
ATTINY85. The board you use to program ATTINY85 is an Arduino board like a Nano
or Uno.

But if all you need is a servo controlled by a knob, thats easy too :



Here knob V converted to digital with ATTINY85 internal A/D, it ranges from
0 - 1023, then that is mapped to servo angle 0 to 180. and that causes PWM
used internally to alter its pulse width to control angle of servo

mBlock is free.




Here is simple proto of using PWM in ATTINY85 to control a fans speed. Transistor
is used to boost current for the fan. In case of servo it has internal power control for its motor,
so you just tie its control signal to the ATTINY865 PWM output directly.




Regards, Dana.
 
Last edited:
Reactions: bhl777

    bhl777

    Points: 2
    Helpful Answer Positive Rating

Almost forgot, here is all it takes to do a V to Pulse Width converter if thats all you need :



Regards, Dana.
 
Last edited:
Reactions: bhl777

    bhl777

    Points: 2
    Helpful Answer Positive Rating
Hi Klause,
Thank you for your reply. I am using a servo motor that has an encoder in it in the loop. It seems like the encoder integrated with my brushed DC motor is not identical to the encoder you defined.
The following is my block diagram. Would you advise if I change my poti to the "encoder alps", would it bring some extra benefit?
Thank you!
 

Hi,

is not identical to the encoder you defined.
I defined no encoder for the motor.

Now it's a DC motor ... never seen one interfaced with a STEP/DIR interface.

Klaus
 
Last edited:
Dont fortget you can modifiy a servo motor to be a motor :




Regards, Dana
 
Reactions: bhl777

    bhl777

    Points: 2
    Helpful Answer Positive Rating
Hi Dana,
Thank you for your help! I will go over all the tutorials you shared and post any follow up questions.
--- Updated ---

Hi Klaus,
Since you have known my case, I am trying to evaluate the difference between using the "encoder alps" that you recommended and the poti I already have.
Since my purpose is to convert the knob (a mechanical knob mounted on top of a poti or an encoder) turning behavior to a series of pulses (with a defined frequency, 50% duty cycle), while the number of the pulses is proportional to the angle turned. I somewhat feel using the encoder alps could be a more straightforward way to do so, would you advise from this context?
 
Last edited:

I don't know what you want to do.
This has 20 quadrature steps per rev.


These have 200 quadrature steps per rev.

Define the input output process , accuracy , forces etc , not the parts you had in mind.
 

    bhl777

    Points: 2
    Helpful Answer Positive Rating
a servo motor does not use step and direction. A STEP MOTOR does; they are quite different things.
Yes but a servo system may use a stepper motor with a reference like Index or Home to calibrate, then it is open loop between this.
A servo loop is not restricted to linear motors or linear pots yet has some form of position feedback.

Thus you may see that stepper servos can be very precise with open loop interpolation between index pulses.
 
Last edited:

The OP specifically said (post #8) that they are using a servo motor. The fact that you can use a step motor in servo loop does not make it a servo motor.
 

I suggest this thread be closed and start a new one with the correct specs for a servo controlled motor with / without requirements for acceleration, velocity and position and links to datasheets or parts online. Otherwise, many others will waste time with the initial false question.
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…