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 »

I just read over yesterdays post I wired everything up according to the drawing you did so I do not have a pwm input might pay to add that to the drawing.

I will put one in to night a see if it changes anything
User avatar
ArtF
Global Moderator
Global Moderator
Posts: 4410
Joined: Sun Sep 05, 2010 6:14 am
Contact:

Re: Arduino based Laser Control

Post by ArtF »

Hi Dan:

  Thanks, I'll add the PWM input, though its opitional, its only used in the CNC mode.. not NGrave which
is the normal mode for CNC usage. It is handy though to see if the PWM input makes the box
switch to CNCMode from diags.

  I took mine apart last night and it had a loose 5vdc wire, so it seems to be running well again..

Let me know when your operational and well run some tests to see whats up. In Engrave mode you should
be able to see Darwin send power commands to the box with just a simp[le test or two..

Art


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

Re: Arduino based Laser Control

Post by DanL »

its all go cnc mode works it changes out of diags to cnc mode.
diags works.
engrave works.
DanL
Old Timer
Posts: 362
Joined: Wed Sep 10, 2014 1:35 pm

Re: Arduino based Laser Control

Post by DanL »

My set up for arts laser controller

G540 controlling motors, limit switches and estop

MB-06 V2 bob for controlling laser outputs and a kill switches for MB-06

pins used on MB-06 are

step flag pin 14 to pin 3 arduino

serial data pin 16 to pin 11 arduino

serial clock pin 17 to pin pin 2 arduino

pwm output pin 1 to pin 7 arduino

kill switch (NC) for MB-06 pin 10

MB-06 set to active high
User avatar
tweakie
Old Timer
Posts: 168
Joined: Wed Dec 01, 2010 12:58 am

Re: Arduino based Laser Control

Post by tweakie »

If it?s any assistance to others that follow with this project I have redrawn Art?s circuit diagram to show the interconnections and pin numbers shown on my Leonardo.

Tweakie.


EDIT Circuit diagram updated to include series resistors for LED's
Attachments
ard1.jpg
Last edited by tweakie on Sat Dec 06, 2014 11:44 pm, edited 1 time in total.
User avatar
ArtF
Global Moderator
Global Moderator
Posts: 4410
Joined: Sun Sep 05, 2010 6:14 am
Contact:

Re: Arduino based Laser Control

Post by ArtF »

Wow.. Thanks Tweakie, that looks awesome...

Art
User avatar
tweakie
Old Timer
Posts: 168
Joined: Wed Dec 01, 2010 12:58 am

Re: Arduino based Laser Control

Post by tweakie »

Thanks Art.

Well I have built it but I can't get it to work - no laser output pulses (except for the tickle pulse ?)  :'(
It's got to be something really silly that I am doing wrong but so far it is eluding me.  ;D

Tweakie.

Attachments
DSC01791a.jpg
User avatar
ArtF
Global Moderator
Global Moderator
Posts: 4410
Joined: Sun Sep 05, 2010 6:14 am
Contact:

Re: Arduino based Laser Control

Post by ArtF »

Tweakie:

Wow, thats looking good. Ok, lets debug it one step at a time and see where
Ive screwed  you up..

Lets get diosga running, its the easiest test just so we know all else is running..

Test 1 for any panel: Does it fire in Diags mode? 

1) Set to Diags, set count to 1000, ( 1/5th second).
2) Run button LED should now flash ( if box has one.. :)
3) Pressing fire should count down , PWM should go to power set by the pot.. 100% for test
4) did laser fire during count?

  Ok course, being Tweakie you may already know the pwm firing section works, I ask the above
only so future new users will see an initial test responce..

Second test, NGrave mode. For this Darwin and Mach4 must be setup correctly.
This you will know if the following is true.

StepFlag pulses everytime any motor does a step. Doesnt matter what motor..
Serial Flag also pulses every time motion occurs. This doesnt match step by step,
when a waypoint is sent to Darwin, the serial clock will pulse 16 times each time
changing the state of the Serial data on each pulse...

Test:  Set Darwin to Laser mode in the diags menu of mach4 under darwin. This turns on
the Laser outputs. Ensure Serial clk, serial data and Step flag are enabled and on proper pins.
Setup a PWM spindle in Mach3 and darwin, set it to frequency controlled in Darwins config at 25hz
what you set the frequency to doesnt actually matter in Darwins config, the diags setup in Mach4 will also
ask a frequency and Darwin will fill in the rigth hardware frequency then.

So in MAch4's diags menu setup for Darwin turn on PWM Spindle. Set it to 50hz. In Mach4, set the spindle range
to 0 min and 100max. Set Motor max rev at bottom of tab to 100. (all this is for power scaling).
Execute a S100F1000 in the MDI, then press the SpindleOn button on the screen or execture an M3.

The lcd in the panel should now show 100 in the REM: in the upper rigth corner indicating its getting
a spindle power of 100 currently. It wont shoot till it moves, but the power should show up as 100%

Lets trouble shoot from there.. :)

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

Re: Arduino based Laser Control

Post by ArtF »

Tweakie:

  Just so we're sure we're all on the same page, here's the code I will be running my machine on when testing why
you ( or dan ) may be having troubles. I'll compare to this codes standard .. it has a change you probably dont have, in the FireLaser routine there is a change in the CNCModes power level to the new standard I use. ( Which is the user of Mach sets a power word ( S0 - S100 ) as a percentage demand to the laser panel, which then gives 0-100% of the
dialed up power on the pot. this is true in all modes. It allows one to adjust power at the laser to see effect and judge
actual required power you might need. SO the pot is the master power selection, and the PWM ( cncMode) or DarwinLaserCalc ( NGrave Mode) are slaves demanding simply 0 - 100% depending on circumstances..

Here is the current Darwin I use as well as the current laser box code..

Art
Attachments

[The extension txt has been deactivated and can no longer be displayed.]

Darwin2138.zip
(2.73 MiB) Downloaded 333 times
User avatar
tweakie
Old Timer
Posts: 168
Joined: Wed Dec 01, 2010 12:58 am

Re: Arduino based Laser Control

Post by tweakie »

Thanks Art.

I have been busy with other stuff today but I will test it all out tomorrow, following your excellent diagnostics advice and report back.

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

Re: Arduino based Laser Control

Post by ArtF »

No Rush, I just tested everything this morning to make sure it all runs as I remember it should. :)

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

Re: Arduino based Laser Control

Post by DanL »

everything working fine for me art I just need to change the pot to a 5K instead of the 10k I have.

pin 9 output is around 2.5 to 3 v so its just half of what it is meant to be
User avatar
ArtF
Global Moderator
Global Moderator
Posts: 4410
Joined: Sun Sep 05, 2010 6:14 am
Contact:

Re: Arduino based Laser Control

Post by ArtF »

Dan:

  Doesnt work that way.. Pin 9  is a PWM signal, so if its set to 50% you should read 2.5volts or so.. if set to 90% you should see abotu 5 volts.  Changing the pot would do nothing to the voltage. 100meg or 100K..doesnt matter, it just tells the  arduino what timing for the PWM to use. So while a scope is what should be used to look at pin9, you can use voltage , just consider it a voltage of 0 - 5 volts in 100 increments of the power pot ( in the case of diags mode when firing..).

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

Re: Arduino based Laser Control

Post by DanL »

ok there is something wrong then, the 2.5 - 3v is with darwin set at m3 s100 and pot at 100% the arduino scope I am using does have volts and pwm I will check again just to be sure I am correct
User avatar
ArtF
Global Moderator
Global Moderator
Posts: 4410
Joined: Sun Sep 05, 2010 6:14 am
Contact:

Re: Arduino based Laser Control

Post by ArtF »

Dan:

    In Diags mode, at 100% and CW selected as count, ( constant wave), you should get between 4-5vc measured on pin9.. a pwm of 200us in period, and with no fire command you should see about 1us pulses, that go to about 190us pulses at full power..

  Generally though, if you see the voltage go up quite a bit when you press fire, then its probably working fine..

Art
Post Reply