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 »

cool will look soon
User avatar
tweakie
Old Timer
Posts: 168
Joined: Wed Dec 01, 2010 12:58 am

Re: Arduino based Laser Control

Post by tweakie »

Hi Art,

Well I fell at the first hurdle (installed Mach4-2138 and Darwin-2138 and reloaded Arduino with latest sketch).

1) Set to Diags, set count to 1000, ( 1/5th second).

Set to Diags and Pulses set to 1000 - OK

2) Run button LED should now flash ( if box has one..  )

Fire button now flashing - OK

3) Pressing fire should count down , PWM should go to power set by the pot.. 100% for test

Nothing ? no countdown

4) did laser fire during count?

Nothing ? laser did not fire

Its all bit of a mystery ? I will go back and check my Mach4 / Darwin set-up and also check my Arduino wiring etc. and see if I can find what I have missed.

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

Re: Arduino based Laser Control

Post by DanL »

art I will test the full new code here since test and engrave work properly on my set up to see if it from all the yun stuff probably not but cant hurt to check
DanL
Old Timer
Posts: 362
Joined: Wed Sep 10, 2014 1:35 pm

Re: Arduino based Laser Control

Post by DanL »

the code works fine here diag switching to pwm ok, engrave ok, diag fine

diag and engraving works fine pwm not so much it runs at half of what engrave does so engrave at 4.5 to 5v max at s100, f400 power at 100%.
pwm running about 3v at m3s100g1x50f400 the scope is not that all that good so I put in a led its bright as in diag and engrave mode
just glowing in pwm mode.

I will need to do some more testing in pwm to see if I can get it working better
User avatar
ArtF
Global Moderator
Global Moderator
Posts: 4425
Joined: Sun Sep 05, 2010 6:14 am
Contact:

Re: Arduino based Laser Control

Post by ArtF »

HI Guys:

  Sorry for delay, I didnt get notification on this thread for some reason..

Tweakie.. Sounds like perhaps we need to add a display code for fire button being pressed,
sounds like something is messed up there. Yell if youd liek a hand getting a diags message
on that.. Im betting when we find that bug things will begin to run..

Dan, Ensure you use the latest laser code I posted a couple messages back, it fixes a bug where the
CNC Mode was doubleing the S power, so an S40 would give 80% ... last post fixed that ( small typo
on my part.. ).
  Sounds like yours is runnign well Dan.. any idea how to get your laser to fire with the signals?
The LED was a good idea, PWM does make an LED glow brighter or dimmer depending..

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

Re: Arduino based Laser Control

Post by DanL »

I am using everything that is new I will be testing some more tomorrow I will try a do a screen shot so you can what I am meaning if I can`t get it working better
User avatar
ArtF
Global Moderator
Global Moderator
Posts: 4425
Joined: Sun Sep 05, 2010 6:14 am
Contact:

Re: Arduino based Laser Control

Post by ArtF »

Dan:

  Cool. Explain an issue and Ill do all I can to fix it up. th eLED is a very good idea for testing though, it will
glow brightly for hi and dimly for low power. BUT , be aware that in engraving mode, it may vary quite a bit as in engraving mode  the fire is limited to 1 shot per step of  a motor....

Art
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: 4425
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: 4425
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: 4425
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
Post Reply