Hello Guest it is May 10, 2021, 09:04:05 PM

Author Topic: Short output pulse from Mach4 + ESS  (Read 1788 times)

0 Members and 1 Guest are viewing this topic.

Short output pulse from Mach4 + ESS
« on: August 03, 2016, 12:01:43 AM »
I've just embarked on my first "cnc" project, I'm trying to make an auto exposure x-y table that basically turns on a laser for a precise time at various positions. The laser is controlled with a TTL signal, and ideally the pulse width should be able to be anything from minutes to ~5 milliseconds. I've started reading the scripting manuals etc, and looks like I can make an M code script quite easily, but I don't know where to start for the core function that would allow such a pulse to be generated.

Does Mach have the ability to generate an output pulse of a precise (say +/- 10%) length? I'm guessing that the ESS will have no problems with a millisecond pulse as it's capable of generating microsecond long pulses for motors etc.

Would I be better off just making a stand alone pulse generator and then communicating with it from Mach somehow?

Thanks for any suggestions you might have

Offline Tweakie.CNC

  • *
  •  8,706 8,706
  • Super Kitty
    • View Profile
    • Tweakie.CNC
Re: Short output pulse from Mach4 + ESS
« Reply #1 on: August 03, 2016, 03:25:32 AM »
A stand-alone pulse generator (triggered by an M call or an axis movement) would be my choice.

Re: Short output pulse from Mach4 + ESS
« Reply #2 on: August 04, 2016, 12:46:52 PM »
The capability to produce a single pulse of around 5ms, or any millisecond-scale pulse with 10% accuracy, would need to be specifically supported by the hardware device.  Windows is NOT a real-time environment.  There is no way to guarantee that 2 events in a windows program (i.e. rising edge and falling edge) happen with that kind of accuracy without writing a Windows kernel-mode device driver.  Now 5 minutes +/- 10% is easy, even in Windows :-)

So Tweakie's suggestion is the way to go, unless the ESS has capabilities (and I have no idea whether it does or not).

Re: Short output pulse from Mach4 + ESS
« Reply #3 on: August 15, 2016, 02:01:33 AM »
Thanks for the replies - I think a stand alone pulse generator communicating through modbus or some such would be nicest (and most reliable) way to go, however I didn't have the time to build up the hardware and interface it, so I ended up going quick and dirty...

Here is what I tried*:
- Just using a basic IO enable/disable with a G4 pause to set the pulse length. This worked OK for longer pulses but broke for anything below around 25ms. Of the around 100 pulses I tested I saw a variation of generally less than +/- 2ms. Running the PC (i5) under full load (cinebench CPU bench mark running) did not affect the pulse lengths. I changed my exposure setup so the shortest pulses needed are now 400ms so I think this method will be fine, subject to some more testing of course. Very simple and no extra hardware.

- Using a "motor" set up with 100000 counts per unit, max acceleration allowed, and commanding a move of for example 0.001 units at 6 units/min feed rate (10x pulses at 1ms intervals). This method requires some basic external hardware to shape the pulse train, but on the plus side it appears to be accurate to <1ms (seems to be a very small error on the last pulse). Again putting a high CPU load doesn't seem to change the timings.

* My tests weren't very scientific - definitely wouldn't use on anything timing critical!!

Offline Pedio

  •  200 200
    • View Profile
Re: Short output pulse from Mach4 + ESS
« Reply #4 on: August 15, 2016, 11:46:59 AM »
I am using the PMDX motion controller with my laser and taking a PWM signal from the board. When I first ordered the laser the signals were too fast for the electronics in the laser and they had to send me another one with a "fast" PWM. I suspect the problem was how fast the commands were being seen by the laser. My post processor often breaks an arc and a line that are actually attached to each other. The laser would do the arch and then miss the command for the line. This was a laser problem. The PMDX board does well with the PWM. The guys at PMDX were terrific in helping me to get the laser working with their board.

I use a Z axis movement to trigger a spindle on or off. My post processor deletes any Z axis movement and adds the spindle on or off command. This is pretty nice as I can use different "tools" to control the intensity of the laser. I change the spindle speed for the tool and it will control the laser output.

Note - if your laser is anything like mine you have to radically change the power to get a noticeable difference. My laser is set for 0-100 as the spindle speed. I have to reduce it 40 before I notice any real change in the cutting/burning ability of the laser.