Arduino based Laser Control

A forum for the Arduino based Mach4/Darwin Laser Control Panel
User avatar
ArtF
Global Moderator
Global Moderator
Posts: 4586
Joined: Sun Sep 05, 2010 6:14 am
Contact:

Re: Arduino based Laser Control

Post by ArtF »

Dan:

  Yes, that sounds correct. With no spindle speed your getting a PWM of 0%, with S100, your getting 95%.
Its programmed that way because the PWM will limit to 95%, usually laser makers recommend you dont run at 100%, it slowly degrades the lasers power.. so the pwm actually goes from 0 - .95 ( or 95%). 

SO it looks like Darwin is properly sending out the PWM, so if the laser box is in Diags mode, and you press the spindle button, the box shoudl auto switch to CNC mode. The REM: in the upper right will display the power of the spindle , for example REM:50 is 50% is being sent via PWM. This means the biox will actually send 50% of the power dialup up by the pot. So if you have adjusted the pot to 50%, and Darwin sends .5 ( 50%), the REM:50 will display inthe upper right of the laser display, and your PWM out on pin 9 will put out 25% of lasers max power. ( Mach4 requesting 50% of the dialup up 50% max from the pot. ).

  So the REM: display will tell you if the power is getting through...

Art
DanL
Old Timer
Posts: 362
Joined: Wed Sep 10, 2014 1:35 pm

Re: Arduino based Laser Control

Post by DanL »

its doing everything its meet to do its just not sending a pwm output in pwm mode it just does the tickle pules

I might try tomorrow to set the spindle range to 0 to 1000 to see if it is the same problem I had when I had a spindle on the machine

engrave mode works fine so I wont worry about it I haven't got a laser yet anyway so it no problem for me
User avatar
ArtF
Global Moderator
Global Moderator
Posts: 4586
Joined: Sun Sep 05, 2010 6:14 am
Contact:

Re: Arduino based Laser Control

Post by ArtF »

Dan:

No, if its reporting .95 at S100, then the spindle range is set fine. Does the REM:50 sho up if you do a S50M3 when the dial on the pot is at 100%?

  If so, then its probably all good. If you jog the motors , the PWM will follow whatever the REM:% says. Of course, you may not easily see it, your only getting 1 fire pulse per motor step. Make sue you have 1 dialup up for pulse count as well, if pulse count ios set to zero, then it will also not fire..

Art
DanL
Old Timer
Posts: 362
Joined: Wed Sep 10, 2014 1:35 pm

Re: Arduino based Laser Control

Post by DanL »

rem 50 may show up when pot at 100% it flickers from 50 to 100 or 500, its to fast for me to read it comes up with 1 fire pulse, there is a in cress in pwm but the gape between pulses is very long 1/2 second what may be ok the pwm is not steady

I tested doing the same thing with engrave it worked well S50M3 with setting pulse at 1, pwm change with pot value.
ran a g code it worked very nicely with pwm changing value with pot.

if you wont me to try something else let me know

but its the bees knees in engrave mode.

I will strip out the yun parts in the code and see if there is a change

User avatar
ArtF
Global Moderator
Global Moderator
Posts: 4586
Joined: Sun Sep 05, 2010 6:14 am
Contact:

Re: Arduino based Laser Control

Post by ArtF »

Hi Dan:

  Its weird that only the PWM mode is affected.. sounds like Engrave mode is fine. The engrave mode doesnt use th ePWM at all, it uses serial power, so it must be something to do with the actual PWM signal, which sounds right. SO long as its set at 50hz, it should work OK.

    The system can be sensitive to kernal speed, mine is limited to about 35K-40Khz, any higher than that and
the arduino has trouble reading the serial input fast enough.. PWM though should be the easiest one to read
so there must be something dicked up there. Let me know how it runs with the YUN stuff out, mayeb it will help.
If not, we can always make up a test of some kind. Im thinking the interrupt for the pot may be different if your not
using a yun, the PWM relies on interrupt #6 on pin7. In a YUN you attach this interrupt by attaching it to
interrupt #4 which is done by one of two lines in the code...

attachInterrupt( 4, DUMMY, CHANGE ); //reattach the spindle interrupt

  This attachment to interrupt #4 actually makes interrupt vector #6 work on a YUN, it IS possibel that if its not a yun, you need to use interrupt 6, so it may be you need to change those two lines to the following two lines as replacment for each call to attachinterrupt. Generally a leonardo cannot use attachinterrupt to gain access to int 6, so the following two lines replace the one call to attachinterrut( 4...

EICRB |= (1<<ISC60)|(1<<ISC61); // sets the interrupt type
EIMSK |= (1<<INT6); // activates the interrupt

Art




DanL
Old Timer
Posts: 362
Joined: Wed Sep 10, 2014 1:35 pm

Re: Arduino based Laser Control

Post by DanL »

I am not quite sure what need me to do

do I replace
//attachInterrupt( 0, DUMMY, RISING ); //pulse external monitor
&nbsp;//attachInterrupt( 4, DUMMY, CHANGE ); //sets the routine to call..

with
EICRB |= (1<<ISC60)|(1<<ISC61); // sets the interrupt type
EIMSK |= (1<<INT6); // activates the interrupt

then what do I do with this bit

&nbsp; //detach the spindle interrupts.
&nbsp; &nbsp; &nbsp; //detachInterrupt(4);
&nbsp; &nbsp; &nbsp; //attachInterrupt( 1, DUMMY, RISING ); //reattach the spindle interrupt

and this as well

&nbsp; attachInterrupt( 4, DUMMY, CHANGE ); //reattach the spindle interrupt
&nbsp; &nbsp; &nbsp; detachInterrupt(1);

User avatar
ArtF
Global Moderator
Global Moderator
Posts: 4586
Joined: Sun Sep 05, 2010 6:14 am
Contact:

Re: Arduino based Laser Control

Post by ArtF »

Dan:

&nbsp; I need to read a bit to see if that will work and what needs to change. Leave it for now.. Liek you say, NGrave mode does everything one needs anyway.. :)

Art
DanL
Old Timer
Posts: 362
Joined: Wed Sep 10, 2014 1:35 pm

Re: Arduino based Laser Control

Post by DanL »

ok just let me know when you have something to try
DanL
Old Timer
Posts: 362
Joined: Wed Sep 10, 2014 1:35 pm

Re: Arduino based Laser Control

Post by DanL »

art I did a trucken nob thing I forgot to connect up the common wire to the bob.

it does work in PWM mode and for some reason the MB-06 is running the at 12Hz.

its pulsing so fast you can`t see the change on the screen but I can see it on the scope.

I will change over to using the G540 for the pwm and see if that makes it run at 50Hz.

sorry for being a nob
User avatar
ArtF
Global Moderator
Global Moderator
Posts: 4586
Joined: Sun Sep 05, 2010 6:14 am
Contact:

Re: Arduino based Laser Control

Post by ArtF »

Dan:

&nbsp; Funny thing is I did the same early on, forgot to hook up the 0vdc, so the signals were very noisy.
I had figured last night something must be up since you switch from diags to PWM when you turn on the spindle,
this means the PWM interupt must work.If the PWM is truly too low a freq, just tell it to go a bit faster in the
Darwin Diags menu under PWM frequency. ( Dont enter the frequency in Darin itself, just in Mach4, Darwin uses a differign formula and will report 25hz on a 50hz PWM system.

&nbsp; If the PWM is only at 12hz.. thats slow, not fast. It should make a PWM waveform at 50hz, which is 200us per PWM pulse cycle. Anyway, with the ground wire hooked up you should be seeing that REM:50 in the top of the screen in CNC mode if you select S50M3.
&nbsp; If so, I think your good to go.

Art
DanL
Old Timer
Posts: 362
Joined: Wed Sep 10, 2014 1:35 pm

Re: Arduino based Laser Control

Post by DanL »

yer seeing rem 50 at s50m3, rem 100 at s100m3,
so its Defiantly all go.
so make me fell like a nob forgetting to connect 0v up to bob from arduino
User avatar
ArtF
Global Moderator
Global Moderator
Posts: 4586
Joined: Sun Sep 05, 2010 6:14 am
Contact:

Re: Arduino based Laser Control

Post by ArtF »

lol.. dont feel too bad, I forgot to do it as well when I hooked up, and I spent
25 years as an electronics guy... :)

Art
User avatar
ArtF
Global Moderator
Global Moderator
Posts: 4586
Joined: Sun Sep 05, 2010 6:14 am
Contact:

Re: Arduino based Laser Control

Post by ArtF »

Hi All:

&nbsp; Just a note. Im playing with my laser today to see the differences between modes of the panel
to ensure its working as I wanted. Ive modfiied it a bit in Darwin. Heres a definition of how each mode
works.


Diags Mode:

&nbsp; Used ony for testing, nice to see how many shots and at what power it takes to piece
&nbsp; a particular material.
&nbsp;
CNC ModE:

&nbsp; In this mode, if the PWM spindle is on, during any motion the laser shoots. The power is
&nbsp; set by the S word, ( S(SpindleMax) is equal to max power. BUT, the power is distance/time corrected.
&nbsp; Let me explain that last term. Lets say you have a feedrate of 4000mm/min. Thats 66.6mm/sec.
&nbsp; My laser shoots 5000hz, so 5000 times a second it can shoot. SO if Im moving at 66mm/sec, thats
&nbsp; 5000 shots over 66mm at top speed or about 75 shots per mm. My system has 250 steps/mm so thats
&nbsp; 75 shots over 250 motor steps..&nbsp; so I only get about 30% of each fullpower shot over any 1 step
&nbsp; of the motor.
&nbsp; &nbsp; But what if Im still accelerating ? I may be moving much slower than 66mm/sec as I speed up, so the
&nbsp; CNC mode takes account of how many steps Im currrently taking this second, compares it to the fastest
&nbsp; I will go as determined by the F word, and scales all outpu8t to that max. This way, you dont get more
&nbsp; energy per mm at acceleration or deceleration. This is very handy at smoothing out acceleration articfacts
&nbsp; and stopping burning in corners.
&nbsp; &nbsp; Its important to understand this as you must try to set a feedrate that isnt higher than you can go.
&nbsp; For example setting a feedrate of F25000 when the fastest your drawing can get to is 250 will mean you
&nbsp; will always have no more than 1% of your expected power.
&nbsp;
Engrave Mode

&nbsp; My favorite mode. In this mode the laser will NOT shoot unless a) its moving and b) its a G1 move.
&nbsp; This means once you turn on the spindle, you can jog and it wont cut, run a Gcode program that uses a spindle,
&nbsp; and the G1's will cut, while the G0's wont. this means you dont need a bunch of M3 and M5 to slow
&nbsp; you down or have to edit to get that. A normal Gcode program for mill will cut on a laser fine with
&nbsp; no editing. Also, in this mode you can link a photo for photo engraving, the laser will then vary power in
&nbsp; realtime as a ratio fo Photo density.
&nbsp; &nbsp; I have found though, that I wanted the distance/time fix as mode CNC above. So today I added that to the
&nbsp; Engrave mode. Im testing it and all seems very good in all three modes. (Im cutting a XMas card for my wife
&nbsp; as a test. ( Christ Im cheap.. or perhaps I just hate shopping that much... :-)
&nbsp;
&nbsp; &nbsp; So I used VCarve to vector a Card graphic, posted for mill, and its cutting it fine from Bristol board.
&nbsp; Gotta love lasers. So this latest update makes the Laser cut fine from Milling GCode. Love it..
&nbsp;
&nbsp;
&nbsp; Anyay, just a Laser update.. Enjoy the holidays.
&nbsp;
&nbsp; Art
DanL
Old Timer
Posts: 362
Joined: Wed Sep 10, 2014 1:35 pm

Re: Arduino based Laser Control

Post by DanL »

thanks art merry xmas
Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests