Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

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

Status
Not open for further replies.

bhl777

Full Member level 6
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!
knob control.png
 

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 :

1674904101391.png


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 :

1674904688478.png


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.

iu



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.

1674905220642.png



Regards, Dana.
 
Last edited:
  • Like
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 :

1674915158221.png


Regards, Dana.
 
Last edited:
  • Like
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!
knob control2.png
 

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
 
  • Like
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.
1681576542136.png



These have 200 quadrature steps per rev.
1681576770568.png

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:

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.
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.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top