Author Topic: Stepper pulses  (Read 1636 times)

0 Members and 1 Guest are viewing this topic.

Offline Pader

  • Active Member
  • Posts: 16
    • View Profile
Stepper pulses
« on: August 11, 2017, 08:55:54 AM »
Hello folks,
I am attempting to program a microprocessor to provide for an on screen position display by counting the pulses from the BOB to the stepper driver.  As I understand it, Mach3 can be set up to provide either a high or low level signal for 'DIR'.  What I need to know is: is the DIR signal in the form of a pulse transmitted simultaneously with a step pulse, or is the 'DIR' signal a constant high (or low) for a sequence of step pulses.  If it is the former, it would greatly simplify matters as I could use a 'DIR' pulse to decrement the pulse count

Your help would be greatly appreciated.

Offline Chris D

  • Active Member
  • Posts: 22
    • View Profile
Re: Stepper pulses
« Reply #1 on: August 11, 2017, 11:10:03 AM »
I'm pretty sure the DIR signal stays at a state (on/off) until direction change is called.  You can test this very easily with your micro once you get rolling.  Be aware, if backlash comp is being applied, your counter will need logic to deal with those extra pulses.

Chris D

Offline Pader

  • Active Member
  • Posts: 16
    • View Profile
Re: Stepper pulses
« Reply #2 on: August 11, 2017, 11:34:06 AM »
Ahh, I thought that might be the case.  Not an insurmountable problem, will just need more code but it would have been tidier had they been individual pulses.  Thank you for replying.

Offline Pader

  • Active Member
  • Posts: 16
    • View Profile
Re: Stepper pulses
« Reply #3 on: August 12, 2017, 02:16:43 AM »
In my naivety, it seems that I have another problem or two with my project. 

I had intended to use the stepper pulses from the BOB to the driver and multiply (in the code) by the number of microsteps that the driver is set at and using the significant numbers of the result divided by 100 to give me two decimal places of travel per millimetre.  The resultant output pulse would go to cascaded CD40110B up-down/latch/drivers which would either be to the up input or to the down input depending upon whether there was a 'DIR' signal present from the BOB (does that make sense?).  I have attached the circuit which gave me the basis for my idea below.

Using the spreadsheet at: https://www.machsupport.com/forum/index.php?action=dlattach;topic=16315.0;attach=23771, I decided that the setting for 64 microsteps would calculate at 7314.28571 per millimetre travel using 1.75/mm pitch lead screws.  Using the significant numbers divided by 100 would require 73 pulses per 100th millimetre with an error of about 0.143 pulses which, if my dubious math is correct, would equate to a total error over the full travel of my X axis (1700 mm) of 2.43mm.

Assuming that I am correct in my calculations (and theory), that brings me to another problem.  I had toyed with the idea to route the pulses from the BOB through some form of Schmit Trigger circuit to clean them up but have no idea of the resultant frequency or pulse width and do not know whether the PIC16F677 processor will be fast enough to handle the data  (20 MHz clock, 200 ns instruction cycle). 

My machine configuration is:
X, Y and Z axes all on 1.75mm pitch lead screws with tapped sintered bronze drive nuts followed by HDPE anti-backlash pads with:

X Axis - 4NM 60BYGH401-03 stepper motors x 2 driven by separate drivers from the same BOB connection.
Y Axis - 4NM 60BYGH401-03 Stepper motor
Z Axiz - 3.1NM 60BYGH301B Stepper motor

I also have a fourth (rotary) axis using a 2.2 Nm, 3.5A motor (designation unknown) at 1:6 ratio which would only be used with X and Z axes.

I hope that this explanation is not too long winded and would appreciate further help.

Offline Tweakie.CNC

  • Global Moderator
  • *
  • Posts: 7,643
  • Super Kitty
    • View Profile
    • Tweakie.CNC
Re: Stepper pulses
« Reply #4 on: August 12, 2017, 04:21:10 AM »
Quote
Assuming that I am correct in my calculations (and theory), that brings me to another problem.  I had toyed with the idea to route the pulses from the BOB through some form of Schmit Trigger circuit to clean them up but have no idea of the resultant frequency or pulse width and do not know whether the PIC16F677 processor will be fast enough to handle the data  (20 MHz clock, 200 ns instruction cycle). 


Because of the large numbers involved you may struggle with using an essentially 8 bit PIC processor but a 20Mhz clock frequency is more than enough for the job.

If it's any help...
Mach3 Step Pulse width is dependant on both the Kernel Frequency and the Feed Rate - at 25kHz, the maximum pulse width is 40uS, reducing to 10uS at 100kHz. The Step Pulse frequency is generated by the Kernel Frequency but is dependant on the Steps per Unit setting and the Feed Rate being used. Because there is seldom an exact harmonic match between the Feed Rate and the Kernel Frequency, Step Pulses are added or subtracted from the generated pulse train to create the ~correct Feed Rate and this has the effect of causing a cyclic, variable, Step Pulse frequency.

Tweakie.
Success consists of going from failure to failure without loss of enthusiasm.  Winston Churchill.

Offline Pader

  • Active Member
  • Posts: 16
    • View Profile
Re: Stepper pulses
« Reply #5 on: August 12, 2017, 05:21:16 AM »
Thanks for that information Tweakie.  I think that I have grasped what it means though I am unclear about whether the Mach3 extrapolates the variable pulses or not.  Will these variable pulses appreciably affect the overall readout of the OSD?

Offline Tweakie.CNC

  • Global Moderator
  • *
  • Posts: 7,643
  • Super Kitty
    • View Profile
    • Tweakie.CNC
Re: Stepper pulses
« Reply #6 on: August 12, 2017, 06:50:33 AM »
The cyclic variation in Step Pulse frequency does not, as far as I am aware, affect any stepper motor drivers so it should not affect your OSD. It is just something you should be aware of when counting pulses or measuring the frequency.

Tweakie.
Success consists of going from failure to failure without loss of enthusiasm.  Winston Churchill.

Offline Pader

  • Active Member
  • Posts: 16
    • View Profile
Re: Stepper pulses
« Reply #7 on: August 12, 2017, 11:19:24 AM »
Thanks for that additional info Tweakie, much appreciated. 

In your previous post you mentioned the various pulse widths at various frequencies.  How are the various frequencies set?  Are they generated by Mach3 according to load and does the number of motors working simultaneously alter the pulse frequency?

Offline Tweakie.CNC

  • Global Moderator
  • *
  • Posts: 7,643
  • Super Kitty
    • View Profile
    • Tweakie.CNC
Re: Stepper pulses
« Reply #8 on: August 13, 2017, 02:27:50 AM »
The maximum pulse frequency is set by the Kernel Speed.
The actual number of pulses can then and often is, reduced by the Feed-Rate and the Axis Velocity set in motor tuning. The actual number of pulses per axis are also tied to the slowest axis when more than one axis is moving at the same time.

You perhaps need to connect a o'scope to an axis step pin - then you can observe this and the cyclic pattern of pulses that have been removed from the fundamental frequency in order to create the desired Feed-Rate.
All this is a lot easier to see than it is to describe.

Tweakie.
Success consists of going from failure to failure without loss of enthusiasm.  Winston Churchill.

Offline Pader

  • Active Member
  • Posts: 16
    • View Profile
Re: Stepper pulses
« Reply #9 on: August 13, 2017, 04:18:50 AM »
I am very grateful for your help Tweakie.