Arduino based Laser Control

A forum for the Arduino based Mach4/Darwin Laser Control Panel
DanL
Old Timer
Posts: 362
Joined: Wed Sep 10, 2014 1:35 pm

Re: Arduino based Laser Control

Post by DanL »

art engrave and diag work fine it switches from diag to pwm ok.

pwm does not work at all

I have pwm set at 50 Hz it keeps going to 12 Hz if I toggle pwm in pwm mode it does nothing if I toggle in engrave its fine.

also for some reason the pot will only go to 65% on arduino screen

I have tried having the pwm on the G540 and MB-06 makes no differences its set up correct. so I don't have a clue what's wrong

as long as engrave work its not a problem to I get a bigger laser
User avatar
ArtF
Global Moderator
Global Moderator
Posts: 4604
Joined: Sun Sep 05, 2010 6:14 am
Contact:

Re: Arduino based Laser Control

Post by ArtF »

Hi Dan:

>>art engrave and diag work fine it switches from diag to pwm ok.

  Good. Does the unit automatically switch from Diags to CNCMode when you turn on a PWM spindle in Mach4?

>>pwm does not work at all
>>I have pwm set at 50 Hz it keeps going to 12 Hz if I toggle pwm in pwm mode it does nothing if I toggle in engrave >>its fine.

The frequency should read 25 inside darwin when its a 50hz PWM signal. This is for technical reasons. Setup a spindle output signal. Done worry about the frequency of it, Darwins plugin will set it up when you turn on the spindle with a M3. Toggling the signal inside Darwins config doesnt do much, it has no reference speed to set the pwm to. Only test the PWM output by using an M3 or pressing the spindle on button in Mach4.

>>also for some reason the pot will only go to 65% on arduino screen

  This can only be a bad pot, or a bad connection. OR.. the 5 volts powering the board is pulling down to a lower voltage due to current restrictions. Measure the voltage at pin 4 to ground, it should go from 0 to 5 volts or very close. See if its limiting to a lower voltage... like 3.5volts.. 65% woudl be pretty low so Im suspecting a bad connection or pot..

>>I have tried having the pwm on the G540 and MB-06 makes no differenc es its set up correct. so I don't have a >>clue what's wrong
>>as long as engrave work its not a problem to I get a bigger laser

  Im not really sure where your at at this point. Does the Laser Pin9 PWM now work properly and adjust when your in NGrave mode and running M4? Is it just PWM nonlaser mode that dosnt work now?

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

Re: Arduino based Laser Control

Post by DanL »

ArtF wrote: Hi Dan:

>>art engrave and diag work fine it switches from diag to pwm ok.

  --Good. Does the unit automatically switch from Diags to CNCMode when you turn on a PWM spindle in Mach4?
yes

>>pwm does not work at all
>>I have pwm set at 50 Hz it keeps going to 12 Hz if I toggle pwm in pwm mode it does nothing if I toggle in engrave >>its fine.

--The frequency should read 25 inside darwin when its a 50hz PWM signal. This is for technical reasons. Setup a spindle output signal. Done worry ----about the frequency of it, Darwins plugin will set it up when you turn on the spindle with a M3. Toggling the signal inside Darwins config doesnt do ---much, it has no reference speed to set the pwm to. Only test the PWM output by using an M3 or pressing the spindle on button in Mach4.

ok

>>also for some reason the pot will only go to 65% on arduino screen

  --This can only be a bad pot, or a bad connection. OR.. the 5 volts powering the board is pulling down to a lower voltage due to current restrictions. --Measure the voltage at pin 4 to ground, it should go from 0 to 5 volts or very close. See if its limiting to a lower voltage... like 3.5volts.. 65% -------woudl be pretty low so Im suspecting a bad connection or pot..

will do


>>I have tried having the pwm on the G540 and MB-06 makes no differenc es its set up correct. so I don't have a >>clue what's wrong
>>as long as engrave work its not a problem to I get a bigger laser

  -- Im not really sure where your at at this point. Does the Laser Pin9 PWM now work properly and adjust when your in NGrave mode and running ------M4? Is it just PWM nonlaser mode that dosnt work now?

pin 9 works as it should
it just pwm that does not work

Art
I will test all connections I am powering it of my laptop it could be the laptop its stuffed
User avatar
ArtF
Global Moderator
Global Moderator
Posts: 4604
Joined: Sun Sep 05, 2010 6:14 am
Contact:

Re: Arduino based Laser Control

Post by ArtF »

Dan:

Probably the laptop cant provide enough current. You coudl use much higher resistance values on all resistors and the pot.. but probably better to use a 5 volt wall wart or something.. the arduino actually uses a fair bit. I tried powering mine off the breakout boards 5vdc .. and it wasnt enough so I used a CPU 5vdc supply..

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

Re: Arduino based Laser Control

Post by DanL »

the pot was bad its getting 5v under logging its come up as a step and direction spindle
DanL
Old Timer
Posts: 362
Joined: Wed Sep 10, 2014 1:35 pm

Re: Arduino based Laser Control

Post by DanL »

pwm mode no work at all done everything properly tried all sorts of things nothing worked.

when in engrave mode it work perfect pot changes pwm value instantly.

diag perfect

diag change to pwm when turning spindle on every time

its getting enough power.

it could be the same problem when I had a spindle on the machine I had to have it set to 0 - 15000 to get 5000 rpm 

other than that I don't know what's going wrong
User avatar
ArtF
Global Moderator
Global Moderator
Posts: 4604
Joined: Sun Sep 05, 2010 6:14 am
Contact:

Re: Arduino based Laser Control

Post by ArtF »

Dan:

  Well, on the good side, Engrave mode will do everything he CNC Mode does.. it just uses the power word instead of the PWM Spindle.

If you have Darwin setup properly in its Daigs menu, then you should see the report
"Spindle Output PWM detected." in the error log if you aloso turn on debug mode in Darwin.
Do you get that message?

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

Re: Arduino based Laser Control

Post by DanL »

with turning spindle on with button, spindle output pwm detected comes up under it has pwm set 0.00%,count2

useing mdi m3s100 it comes up  spindle output pwm detected under it it has pwm set 0.95% count 3167
User avatar
ArtF
Global Moderator
Global Moderator
Posts: 4604
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: 4604
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: 4604
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: 4604
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
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests