Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: Pader on May 18, 2018, 11:53:01 AM

Title: Understanding Mach3 pulses
Post by: Pader on May 18, 2018, 11:53:01 AM
As I understand it, the Default setting for Mach3 is 25kHz but I need to understand more of how this works in practice.

Does this mean that   pulses to the Stepper Drivers are transmitted at this speed?

If so, does the number of stepper motor drivers affect the overall speed?

I am building a circuit that is required to physically count the pulses, are they 'clean' pulses or will I have to introduce some sort of 'debounce' into the circuit?

And finally, is the direction pulse of the same length as the positioning pulses and/or will that too require debouncing?
Title: Re: Understanding Mach3 pulses
Post by: ger21 on May 18, 2018, 12:23:11 PM
The quality, or cleanliness of the pulses may vary greatly from PC to PC.

25Khz is the maximum speed for each axis. So Mach3 can output up to 25,000 steps per second for each of 6 axis + the spindle.

Actual pulse rate depends on the  feedrate and acceleration of the current commanded move.

The pulse width setting will vary the length of the pulse.

There really isn't a direction "pulse". It's 0V in one direction, and 5V in the other direction. The pin doesn't change state unless the direction changes.
Title: Re: Understanding Mach3 pulses
Post by: Pader on May 18, 2018, 02:40:40 PM
Thank you very much for the information coming so quickly.

It has clarified a lot of things for me and will enable me to get on with my project.

Thanks once again.
Title: Re: Understanding Mach3 pulses
Post by: joeaverage on May 18, 2018, 04:28:30 PM
Hi,
in a sense a stepper motor is like your pulse counter.

Every step pulse with the direction pin high cause the rotor to go 1.8 degrees clockwise and if the direction pi  is low it will go 1.8 degrees counter-clockwise.
If you like the rotor position is an accumulation of all previous pulses. If for instance from the start of the session the rotor has turn 431 turns and 113.4 degress
then net number of pulses in one direction  is (200 X 431)+(113.4/1.8 )=86200+63=86263.

Does you project require the net number of pulses, ie a position accumulator or  a total number of pulses?

Craig
Title: Re: Understanding Mach3 pulses
Post by: Pader on May 18, 2018, 07:40:54 PM
I am building a DRO for the work position coordinates on my home built CNC machine. 

By using stainless steel threaded rod with a pitch of 1.75 at 10 microsteps, gives me a figure of 1142.85714 pulses per millimetre.  As my display is 4 digits plus decimal 2 places it will give me a resolution on the DRO of /100th of a millimetre (0.394 thou) which is more than enough given the inaccuracy of the threaded rod manufacture.

If my calculations are correct, then the significant figures (ll42) would be enough to provide a reading for a single millimetre (with two decimal places) travel using up/down counter chips.  However, this is unlikely to be very accurate due to both the inaccuracy of the lead screw threads and the accumulated decimal places over the 1600mm travel of my X Axis.

Although I have no experience of microprocessors, I am using a programme for PICAXES that uses graphical algorythms for programming.  Ignoring the last two decimal places (0.00014) as being too small to make any appreciable difference, I intended to count pulses up to 7 (third dec place), increment the second dec place then reset, then the same again up to 5 for the second dec place and up to 8 for the first dec place.  And then the processor outputs to the second decimal place of the actual display and so on by inputting to the 'UP' on the CD40110 up/down counter-driver chips (Cascaded; one for each digit).   hope that iis not too convoluted.

I will have a second routine for decrementing the figures when the 'DIR' signal is present outputting to the 'DOWN' connection on the CD40110 up/down counter-driver chips

If anyone is interested, I have attached the schematic for the actual display circuit.
Title: Re: Understanding Mach3 pulses
Post by: joeaverage on May 18, 2018, 08:01:59 PM
Hi,

Quote
Although I have no experience of microprocessors, I am using a programme for PICAXES that uses graphical algorythms for programming.  Ignoring the last two decimal places (0.00014) as being too small to make any appreciable difference, I intended to count pulses up to 7 (third dec place), increment the second dec place then reset, then the same again up to 5 for the second dec place and up to 8 for the first dec place.  And then the processor outputs to the second decimal place of the actual display and so on by inputting to the 'UP' on the CD40110 up/down counter-driver chips (Cascaded; one for each digit).   hope that iis not too convoluted.

Yes, I understand what you are getting at. What you have outlined is a 'position accumulator'. All step/dir servos for instance require such device.

The next question is why? Mach3 has it built in. The DROs in Mach usually display work co-ordinates but at a click of a button can display machine co-ordinates at programmable resolution.
If you wish it you can use the OEMDROs built into Mach and have access to the raw encoder count. That would place the data on the PC screen, would that be adequate?

If you wanted to have a separate numeric display that could be done by 'sending the numbers' by serial to a display unit, maybe with a micro to 'untangle' the incoming data.

You may have seen advertised CNC pendants. The ones I am thinking of are VitsaCNC but there are heaps of others  and some of there models have an LCD numeric display built in...

Craig
Title: Re: Understanding Mach3 pulses
Post by: Pader on May 18, 2018, 09:36:13 PM
I would like a small DRO fixed to the gantry immediately at the work position.  My machine, overall, is 1800mm long and the position of the PC is beyond that.  It would enable me to keep an eye on the work as it progresses in case of error and the Emergency stop button is also on the gantry.  The chances are that is the place that I would most likely be whilst the work is going on.

 Apart from that, it is something that I would just like to do for the hell of it. ;D
Title: Re: Understanding Mach3 pulses
Post by: joeaverage on May 18, 2018, 09:45:03 PM
Hi,
well yes, the challenge of doing something just for the hell of it is something I know a bit about....

While its being built though a wireless pendant with LCD display, and they have an Estop button on them could be sitting in a bracket on the gantry or
even in hand....

Craig
Title: Re: Understanding Mach3 pulses
Post by: Pader on May 19, 2018, 04:55:01 AM
 I have a USB pendant that is quite basic, it doesn't even have a rotary speed dial let alone a DRO.  However, a more serious version would, for me, be an unnecessary expense.  As to the E stop button on a pendant.  That is great if you have the pendant in your hand the whole time, but Sod's Law says that you won't at the immediate time of needing it and then you may be fumbling around for it whilst your machine is chewing itself to pieces.  On the gantry is this nice big, 45mm diameter, red button that I could find in my sleep.  I have a similar button on the enclosure of of my control unit.

I am very much a hobbyist and far from sophisticated with my machining equipment.  I am, after all, a retired Building Surveyor with no prior machining experience except a small amount back in school more than half a century ago. 

I think I mentioned that my CNC is home built.  If you are interested, I made an 'Instructable' for it (https://www.instructables.com/id/Good-quality-CNC-Machine/).  I have changed the original design a little in that I now have a dedicated stepper motor for each of the two X Axis lead screws as I found that the original belt drive from a single motor caused problems with belt alignment and torque.  The machine is down at the moment as I am replacing the original, home made, HDPE and steel nut arrangement on the lead screws with sintered bronze bushings together with the original HDPE anti-back lash.  But, as I said, I don't have any particularly sophisticated equipment in my workshop.  More like hobby DIY although I do have a 14" Chinese lathe which, after a lot of adjustment, seems to work quite well.  I also have an abrasive type metal chop saw and a 6" vertical bandsaw with a variety of blades.

I probably could have saved and bought more sophisticated equipment but, for me, the fun was in building much of what I have.   The journey is better than arrival.
Title: Re: Understanding Mach3 pulses
Post by: BluePinnacle on May 22, 2018, 05:57:58 AM
A word of warning, after fifteen years or so I wouldn't say that I had arrived yet  ;D
Title: Re: Understanding Mach3 pulses
Post by: Pader on May 22, 2018, 06:29:02 AM
Let us hope that the next 15 years are just as 'unproductive'  ;D
Title: Re: Understanding Mach3 pulses
Post by: BluePinnacle on May 22, 2018, 07:43:19 AM
 ;)
Title: Re: Understanding Mach3 pulses
Post by: Pader on June 01, 2018, 06:10:02 AM
Going back to Ger21's post,  I fully understand that the pulses will probably not be 'clean' pulses, but as you say, the pulse width can be set in Mach3.  So, assuming that a 20 uS pulse is selected, that 'dirty' pulse may consist of several square wave oscillations followed by a low voltage level before the next pulse is sent?  Also, assuming that the pulse is read only on the first rising wave form, would it be advantageous that the first rising pulse as well as incrementing the count also initiates a 'wait' sequence of, say 18 uS before it attempts to read the next pulse?
Title: Re: Understanding Mach3 pulses
Post by: joeaverage on June 01, 2018, 06:26:22 AM
Hi,
have you looked at the pulse stream with a scope? Its not a perfectly regular pulse train like you'd get from a signal generator
but neither do you have to go to such lengths to recover it. Provide you amplified and limited to 0-5V TTL levels then a Schmitt Trigger will retrieve
the signal without difficulty.

Unless your dead set keen on using logic ICs I'd use an Arduino as your counter and binary to BCD and 7-seg decode/latch.

Craig
Title: Re: Understanding Mach3 pulses
Post by: Pader on June 01, 2018, 07:41:00 AM
I started on the logic IC route simply because I have no experience with microprocessors.  I designed the PCB for the schematic included earlier and had it professionally made.  I have also purchased the ICs, displays and discrete components which, when added together, the cost is significant.  There is an online pcb programme (free) that I used for the PCB design and it is called Circuitmaker.  All of the designs become open source and the relevant circuit is simply called 'CNC OSD' if you should want to view it. The circuit shewn is for one channel only and can be extended to suit the number required as they are all independent.

I will be using a microprocessor for rounding up the number of pulses per millimetre to two decimal places but the unit that I am using (Genie20) is a PIC based chip that is programmed using graphical flowcharts and the code is then generated automatically.   The programming is done in the 'Genie design studio' by New Wave Concepts and is again, free.

Unfortunately, their is no schmidt trigger facility in the programme and so that is why I was considering using the 'wait' function to debounce the pulse.