In the GCode you have included in Reply #19 I see this line with a Z value
X4Z19
That line also includes an X value. If they were separate like this
X4
Z19
so that the machine was otherwise stationary while the Z pulses are being issued then I think you could use an Arduino program to count the pulses and when the pulses stop coming it could set the intensity of the laser ready for the following moves.
But it all sounds like a kludge. And it is going to involve a delay while the Arduino receives the pulses so it can figure out the intensity.
I suspect that might present an even steeper learning curve for the OP
maybe
I started off down the same path with a akz250/mach3 and soon realised its a combo just not made for lasers.
the auggie /pokeys combo makes a nice cnc machine well worth the effort . its not all that expensive , the
performance is excellent . not only that your gcode does not need to be kludged to suit , it can come straight
from your favourite cam package .
the gearotic forum is a warm and friendly place for help and advice if needed http://gearotic.com/ESW/FavIcons/index.php
do look at the auggie threads _ laser diode ones especially
I have not tried grbl for my laser but do use it for my marlin[rostok] 3d printer , its an impressive
piece of coding . if it works as well for lasers as it does for 3dprinters it should also be a good choice
a quick read of the wiki indicates pretty much the same functionality as a pokeys. it also has a good range of
console software choice .
the akz250 still goes in the bin
Robin2:
so that the machine was otherwise stationary while the Z pulses are being issued then I think you could use an Arduino program to count the pulses and when the pulses stop coming it could set the intensity of the laser ready for the following moves.
But it all sounds like a kludge. And it is going to involve a delay while the Arduino receives the pulses so it can figure out the intensity.
Maybe Mach3 is not what you need for this?
...R
the idea is to set the Z scale very low so that arduino can vary the intensity on the go and instantly.
Mach3 is not suitable for laser engraving (not cutting) i agree, but for the moment this is what i have running for the milling, and i am trying to fit it to laser engraving.
it has to be really really a tempting suggestion to dump mach3 and change it all to something else
jmansour:
the idea is to set the Z scale very low so that arduino can vary the intensity on the go and instantly.
I can't make sense of that in the context of what I said in Reply #20 and my earlier Replies I don't know what you mean by "set the Z scale" or why "on the go and instantly" is necessary.
At the very least I don't think you have adequately described what you are trying to get to happen.
the idea is to set the Z scale very low so that arduino can vary the intensity on the go and instantly
which can't happen
gcode is all about synchronised movement
x4z19 will move x to arrive at pos 4 when z has reached pos 19 , ie the move has finished before the Arduino can finish counting
if you go
z19
x4
then you burn a hole in you job while the Arduino is counting before the move can commence
plus mach3 looks ahead to calculate acceleration and cv compensation .
it just won't work that way
yes i agree with you guys on the timings of mach3, but the stepper motor doesn't know anything about synchronization.
when you tell it to turn, it turns. i want to increase the intensity of the laser in the same time i get the turn command.
i can control the increment and decrement in arduino to have a good intensity modulation.
jmansour:
yes i agree with you guys on the timings of mach3, but the stepper motor doesn't know anything about synchronization.
when you tell it to turn, it turns. i want to increase the intensity of the laser in the same time i get the turn command.
i can control the increment and decrement in arduino to have a good intensity modulation.
i am posting here because i know the experts will answer me.
what i am trying to do is to engrave a photo in black and white on a wood or paper or other material with a 2.5mW laser module.
the laser module intensity could be controlled by means of a PWM modulation.
since i already have a mach3 software along with the AKZ250 or Leafboy usb breakout board, i figured i can find a workaround to make it work with laser modulation.
for the moment i am using a software image2gcode to generate a gcode according to the grayscale intensity either in S command or Z command according to the limiations i do.
i have seen some youtube examples that use analog knobs that are connected to the z axis, and when the z axis turns left and right, it would actually control the intensity of the laser.
i am a fan of DIY approach before thinking to buy a finished product like this one:
so i am all ears to a suggestions that could make it work with mach3.
jmansour:
what i am trying to do is to engrave a photo in black and white on a wood or paper or other material with a 2.5mW laser module.
That is not the sort of description I was hoping for. I has hoping you would describe how you want the different axis movements and the laser intensity to interact with each other so that I could better understand the timing that is required.
For example if I want to mill a piece of metal I need to set the tool rotating at the desired speed and then I need to move the tool across the workpiece at a speed that suits the cutting ability of the tool. Or maybe the tool is held stationary and the workpiece is moved relative to the tool. When a cut is finished the tool is usually withdrawn from contact with the workpiece before the tool motor is turned off.
Now please describe how your machine should work?
And a large part of the reason for asking this question is that I don't think you have grasped the need to see the problem in those terms.
In the mean time, can you describe how your laser operates. Is it continuous unless electrically turned off/on? Or is it pulsed on/off with the on time being related to the PWM signal? Is the intensity you describe based on varying the power output, or is it just the appearance of intensity based on on-time? Will your program produce a series of overlapping dots, or a continuous burned line?
the laser intensity - as per the supplier description and confirmation (i don't have it yet) - can be controlled by PWM. i don't have experience in PWM modulation or what is its effect on intensity. so i suppose the on/off pulses are controlling the intensity.
0% will be off and 100% will be maximum power (i suppose)
and on/off can be controlled by a relay to cut the power to the laser module.
the laser will run over a dot once, so it would be a continous burned line on varying intensity.
is the analog modulation (some sort of knob to control power) considered better for a similar application?
The step pulses sent to a stepper drive is not PWM, it' a string of pulses telling the driver how often to step the motor, there is no modulation. Only thing that changes is time between (usually very short) pulses, the longer the time lag the slower the motor steps.
Now, it's different with a DC motor, the Arduino does send PWM to the H-bridge drive telling it how much voltage to apply to the motor, the higher the PWM duty cycle, the faster (usually) the motor runs.
So, maybe if your CNC thought the Z axis had a DC motor drive, it could send PWM?
edgemoron:
The step pulses sent to a stepper drive is not PWM, it' a string of pulses telling the driver how often to step the motor, there is no modulation. Only thing that changes is time between (usually very short) pulses, the longer the time lag the slower the motor steps.
Now, it's different with a DC motor, the Arduino does send PWM to the H-bridge drive telling it how much voltage to apply to the motor, the higher the PWM duty cycle, the faster (usually) the motor runs.
So, maybe if your CNC thought the Z axis had a DC motor drive, it could send PWM?
this is why i need to convert the pulses signals to PWM values to control the intensity of the laser.
the idea is to use arduino to read those pulses directly or by other means of translation (maybe encoder mounted on the motor) to change directly the PWM value that arduino would generate and thus controlling the laser.
now from previous replies from Robin and Paul, the issue would be the timing of the signals coming out of the board making it complicated to handle
jmansour:
now from previous replies from Robin and Paul, the issue would be the timing of the signals coming out of the board making it complicated to handle
Robin
the machine i built is a 3 axis cnc operated by Mach3 and the USB cnc board (AKZ250) running 3 stepper motors.
what i want to do is to attach a laser module on the machine and use mach3 to move the motors X and Y and in the same time, control the intensity of the laser to engrave a photo on lets say wood.
the movement of the X and Y axis are good because the Gcode of the image is generated by the image2gcode software.
i am looking for a way to control the laser intensity during the X and Y movement of the machine to engrave properly
jmansour:
Robin
the machine i built is a 3 axis cnc operated by Mach3 and the USB cnc board (AKZ250) running 3 stepper motors.
what i want to do is to attach a laser module on the machine and use mach3 to move the motors X and Y and in the same time, control the intensity of the laser to engrave a photo on lets say wood.
the movement of the X and Y axis are good because the Gcode of the image is generated by the image2gcode software.
i am looking for a way to control the laser intensity during the X and Y movement of the machine to engrave properly
is it clear now?
It is very clear that you need a 4-axis CNC machine. The 4th axis being the control of the laser.