Notifications
Clear all

Trying to understand controllers

12 Posts
4 Users
4 Likes
289 Views
(@douglaskeene)
Member
Joined: 2 months ago
Posts: 9
Topic starter  

Hello

I am new to Arduino and digital stepper controllers, but I have made a working example of a DM542T controlling a geared (47:1) stepper motor. 

Question: for the Pulse/rev DIP switches, is the "pulse/rev" a PROPERTY of the motor or a feature that is adjustable to meet the user's needs?

I assume each motor has a minimum and maximum RPM. So, for example if I want the motor to spin at 400 revolutions per minute, AND the DIP switches are set to 12800 Pulses/rev, then math shows 

  • 400 RPM = (X Pulses/sec) / (Revolutions/12800 Pulses) * (60 sec/minute)
  • 400 * 12800 / 60 = X
  • 85,333 Pulses/sec

So, does the digital controller generate a signal that is 85,333 pulses per second? if so, what signal (5 volts of a specific duration) do I need to feed the DM542T so that it generates this signal? Is there a table that would link a PULSE signal duration to emitted Pulses per Second?

Also, DIP switches are great, but wouldn't it be better to have these values (Pulses/Revolution and Current Table) programmatically adjustable based on the user's needs?

I love discovering information about these items and THANKS for your expertise!!

Doug


   
Quote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6983
 

@douglaskeene If I had those questions I would find the video/article Bill(@dronebot-workshop) did. I think this article covers the basics ARTICLE

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
 John
(@jhb)
Member
Joined: 2 months ago
Posts: 12
 

Also, look carefully at the datasheet, https://www.omc-stepperonline.com/download/DM542T.pdf.   It gives some required characteristics, like max 200kHz pulse frequency, and pulse width of at least 2.5 uS.  There's a table on page 7 that gives various switch settings for the desired micro-step settings.  Importantly for achieving a certain RPM is to know the motor's steps/rev (the table assumes 1.8 degrees/step) and factor in your gearing.


   
ReplyQuote
(@davee)
Member
Joined: 3 years ago
Posts: 1689
 

Hi @douglaskeene,

     John (@jhb) has kindly answered your questions, but there are a couple of points that might not be obvious to anyone with little or no experience of stepper motors and contemporary driver boxes, so I offer some extra explanation. I would also recommend looking at Bill's (dronebot-workshop) excellent tutorials if you haven't already seen them.

I should also admit, I have no experience of the specific hardware you reference, so this is only my interpretation of the manual I found at https://www.omc-stepperonline.com/download/DM542T_V4.0.pdf

------

I note that your motor has a gearbox fitted ... all of my discussion refers to the 'bare' motor ... obviously a reduction gearbox will reduce the motion of the output shaft of the gearbox by the ratio defined by the gearbox.

-----

Question: for the Pulse/rev DIP switches, is the "pulse/rev" a PROPERTY of the motor or a feature that is adjustable to meet the user's needs?

With regard to the steps/revolution, I guess you mean the table that I include a small clip of below

image

A stepper motor will have a physical number of steps per revolution, based on the mechanical design of the windings, rotor, etc., with 200 steps/rev 1.8 degrees/step being a common option.

In the common design, there will two windings and a simple driver will cycle through a 4-step sequence to the windings to cause the shaft to rotate by 4 steps. There are a lot of tutorials on the web to explain the details, but the important point is that at any one time, each winding is either carrying 'full' current or 'zero' current.

Microstepping is a more recent development, in which driver is internally programmed to be able to precisely control the current through each of the two windings, so that the rotor will align at position between a pair of step positions. Looking at the full table of switch options, the DM542T can divide a single 'motor' step into a maximum of 128 'microsteps', when the switches are set to off-off-off-on. In this condition, a (micro)-step is not 1.8 deg, but 1.8/128 = 0.0140625 degrees. Obviously, this is a very small motion, and it is unrealistic to suggest that the shaft will rotate by exactly that amount, but any errors will average out, so that 128 of such microsteps will rotate to the same position as 1 step.

The most obvious advantage of microstepping in applications like 3D printers is the much quieter, and smoother motion.

-------

The DM524T (and similarly for many other such drivers) has three inputs: PUL(se), DIR(ection) and ENABLE. Each of these input as logic levels ... commonly described as high/low, 1/0, ON/OFF  etc.

ENABLE is often not connected, in which case the driver is usually enabled. (Read the manual to check.)

DIRection refers to forward or reverse ... e.g. high for forward. low for reverse (or vice versa)

PUL(se) is typically held 'low' with a 'short' pulse of high .. for say 10 microseconds, to cause the driver to move one "step" to the next winding power sequence position. Note that in this context "step" refers to a "microstep", so if the switches are set to "128" configuration discussed above, the change of angle by just one step will be very difficult to perceive, and it will take 25,600 pulses to cause the rotor to rotate by 1 revolution.

Hence, the table column of steps/revolution refers to the number of step pulses that must be sent to the driver box to cause the rotor to rotate by one revolution, for each of the possible switch position configurations.

Note, depending upon how each of these inputs are wired, 'low' and 'high' may effectively be reversed ... it is necessary to carefully understand your wiring and that of the driver. The figures 4 and 5 of the manual illustrate the two possibilities. A 'low' from the controller output of Fig 4 is equivalent to a high from the controller of Fig 5, and vice versa.

------------

do I need to feed the DM542T so that it generates this signal?

Yes ....

The three inputs to the DM524T (PUL(se), DIR(ection) and ENABLE) must all be driven by an external circuit, such as a controlling Arduino for the full control.

As mentioned earlier, ENABLE is sometimes left unconnected, or maybe connected to a limit switch arrangement to stop the motor if it goes beyond the normal travel limits.

The DIR(ection) is normally switched as required by the controller, although there may be some applications that only drive the motor in one direction, which could be 'hard wired'.

The controller, must be produce a pulse for each step ... the motor will not move without it.

----------

if so, what signal (5 volts of a specific duration) do I need to feed the DM542T so that it generates this signal?

The manual includes:

a) t1: ENA must be ahead of DIR by at least 200ms. Usually, ENA+ and ENA- are NC (not connected). See
“Connector P1 Configurations” for more information.
b) t2: DIR must be ahead of PUL effective edge by 5 micro-secs to ensure correct direction;
c) t3: Pulse width not less than 2.5 micro-secs;
d) t4: Low level width not less than 2.5 micro-secs;
e) Duty cycle of Pulse signal is recommend 50%

So your signal must meet all of these requirements. Essentially, pulse duration is not important, as each step will be triggered by the rising (or maybe the falling) edge of the pulse ... the timing requirements are to make sure the electronics sees a 'full, well-shaped' pulse. If a pulse is too short, it will be filtered out by the electronics that is unable to keep up with the rapid transitions.

DIP switches are great, but wouldn't it be better to have these values (Pulses/Revolution and Current Table) programmatically adjustable based on the user's needs?

Perhaps, but this driver is among the many at the "budget" and "lower power" end of the market, compared to large industrial machines ... so switches (and sometimes potentiometers for current), to preset values maybe a reasonable compromise between cost, complexity, etc. There are applications which require a more flexible approach, particularly those requiring a relatively wide range of rotation speed range, and I presume there are vendors who can offer more flexible drivers, but I would guess their price range may be less palatable.

-----------

I hope some of this is helpful. Apologies if I have explained the 'obvious'. 

Best wishes for your project, Dave


   
Inst-Tech reacted
ReplyQuote
(@douglaskeene)
Member
Joined: 2 months ago
Posts: 9
Topic starter  

@jhb Thank you so much for your help!


   
ReplyQuote
(@douglaskeene)
Member
Joined: 2 months ago
Posts: 9
Topic starter  

@davee Thank you DaveE, for the wonderful explanation. I think I have made great progress here. I bought an oscilloscope so I can look at the characteristics of the system, especially the pulse wave that i generate through Arduino. I chose 5 us as a pulse width, then I vary the delay. While I don't have a very accurate way of measuring the rate of rotation of the motor's axle (other than visual-stopwatch), I get some pretty reasonable results. I am also able to experiment with different frequencies. I still need to understand if the duty cycle makes any difference -- i.e. what changes at 200 hz when the pulse width is 5us vs. 200us. I have also wired a joystick so i can vary the frequency... Again this forum is great and thanks to you and all for your expertise!


   
ReplyQuote
(@douglaskeene)
Member
Joined: 2 months ago
Posts: 9
Topic starter  

For the other newbies interested in steppers: from what i have learned, the giant stepper controllers seem daunting but they're not too difficult once you get to understand them. There is a bit of a learning curve, and for me, the documentation was not that helpful. I use a DM542T as it was recommended by Amazon when I purchased a stepper motor. In a nutshell, pardon my simplification, correct me if i am wrong. Arduino can feed signals to the controller. The controller takes these signals and adds some current and voltage to the motor so it can turn, as the arduino can't really power the motor. The pulses should be at least 2.5us followed by a delay. The pulse duration plus delay create the frequency. The frequency determines the rate of rotation of the motor. There are also inputs for direction and enabling/disabling the motor. There are switches on the controller that adjust the number of pulses per revolution of the motor. There are also switches that adjust the current fed to the motor, higher current creates more torque. There are minimum and maximum frequency values, below and above which the motor will not function properly. There is a maximum torque produced by the motor, above which the motor will fail. Hope this helps!


   
ReplyQuote
(@davee)
Member
Joined: 3 years ago
Posts: 1689
 

Hi @douglaskeene,

  Thanks for your kind reply.

  I obviously didn't design the DM524T, but I am pretty sure that just one edge of each pulse sent to PULse input ... it might be the rising edge, or it might be the falling edge, but for a given wiring arrangement, it will always be the same one ... will cause the output to move to the microstep state, and hopefully the motor will respond accordingly, by moving to that new position. 

I have never tried it, so it might be a bit tricky, but you could try testing this hypothesis. If you set the DM524T for "1" microstep, so that the motor moves the maximum of 1.8 degree, which is just about visible if you can add a pointer to the shaft, otherwise, hopefully you will hear it click. Then send a pulse with an edge change (rising or falling) every 2(or more) seconds, and watch the level change with your scope (or even a meter).  Then try to match the voltage change with the motor movement or click noise.

----------

At the other 'extreme' of the pulse timing, although the pulse rising and falling edges may look vertical, in practice they have a slope, so there is a time between the start of the transition and the end of it, which might be (say) 2 microseconds. Then, if your pulse width is also 2 microseconds, the waveform will look more like a sawtooth pattern, and the driver electronics may not have enough time to change the output voltages to the motor.

Note that this 'slope effect' applies at every point in the electronics chain, so even if the pulse from the Arduino looks good, the pulse may be 'struggling' to keep up, at some point inside the DM524T. This is one of those cases in which the slowest part of the circuit largely defines the overall performance.

Also, not that when I refer to 'Pulse', this is both low-high-low sequence, which is the 'obvious' pulse and the high-low-high sequence, which might be referred to as an 'inverted' pulse.

As the manual points out, the 'optimal' case is when the high and low times are the same, because this when the electronics has the maximum amount of 'spare' time.

-----------

I agree with practically all of your following explanation, except for the penultimate sentence. There is certainly a maximum frequency, limiting the top speed, but there is no minimum frequency, providing you have the patience of waiting for the motor to do the required number of steps, and the current setting of the controller has been appropriately configured.

Unlike most electric motors we commonly use for food mixers, electric drills, rotary saws and so on, stepper motors are normally configured to be 'happy' to move to a requested position, and hold that position with electric current passing through the windings, for an indefinite time. Of course, this implies that the current has been preset to an appropriate, as if the value is too high, the motor will overheat.

It is this property that makes stepper motors the 'norm' for home 3D printers, in which each motor is responsible for moving to a specific position, and if necessary, holding that position.

--------

Hope this helps a little. Best wishes, Dave


   
ReplyQuote
(@douglaskeene)
Member
Joined: 2 months ago
Posts: 9
Topic starter  

@davee Thank you! Yes, with the oscilloscope i can see a slight slope. For the minimum frequency, i suppose you are right that you could send one pulse per day! LOL

While I get the My next task is to understand the Enable/Disable signal 😉

This post was modified 2 months ago by douglaskeene

   
Inst-Tech and DaveE reacted
ReplyQuote
(@davee)
Member
Joined: 3 years ago
Posts: 1689
 

Hi @douglaskeene,

   Depending on your project, you might never need the Enable/Disable.

if you leave it disconnected, it will always be enabled, which means the DM524T will follow PULse and DIRection.

If you connect Enable, then when you select DISable ... that is when there is about 5 V difference between ENA+ and ENA-, then I think the controller will ignore PULses, and hence the motor will stop moving.

It might also stop sending any current through the windings of the motor, allowing the motor shaft to be rotated manually ... I am not sure about this.

One possible use:  if you have mechanical limit switches, connect them, so that if the switch is activated, it sends a 'Disable' signal to the DM524T, thereby protecting the machine from mechanical damage, etc. (I have never tested this suggestion out myself, so if you use it, test carefully as you go.)

Sorry if it appeared I was being 'over fastidious' in my last reply ... I made a point of it, because I think it helps to show how stepper motors are fundamentally different from most electric motors we encounter in everyday life. The differences can be really helpful in some situations.

Best wishes, Dave


   
Inst-Tech reacted
ReplyQuote
 John
(@jhb)
Member
Joined: 2 months ago
Posts: 12
 

@zander The article to which you refer is excellent for sourcing and passing through audio.  I did not see anything about interpreting a stereo audio stream or doing anything with the stream as it passes through.  Perhaps I missed that?


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6983
 

@jhb It looks like you posted on the wrong topic as your last post in this topic is to do with stepper motors.

However, in general it sounds like you are in the invention phase, not much I or likely any other outside observer can suggest.

If you want to 'process' the audio data, then attach (via software) some code to the pins that are currently passing the audio signal.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote