PWM laser

155 views
Skip to first unread message

Angelo Posteraro

unread,
May 19, 2015, 5:53:16 PM5/19/15
to smoothiewa...@googlegroups.com
Hello!

I have a laser driver board that uses a TTL signal in to pulse a laser diode to achieve a desired power level. When the TTL pin is high, it turns the laser on.

When I used a marlin electronics set up, it was connected to the fan output and I just "pretended" that the output was PWM'ing the fan, when in fact it was PWM'ing the laser. This setup worked with my MATLAB code to engrave with the laser by setting the fan (laser) to a higher pwm on areas desired to be darker and lower PWM on areas desired to be lighter.

On smoothieboard I'd like to accomplish the same thing so I have it set up as follows:

#switch.laser.enable                               true            # LASER
#switch.laser.input_on_command            M106          #
#switch.laser.input_off_command            M107          #
#switch.laser.output_pin                         2.4             #
#switch.laser.output_type                       pwm           # pwm
switch.laser.max_pwm                           255             # set max pwm for the pin default is 255
switch.laser.startup_value                       10              # starts laser at 10

The LCD menu entry I have for controlling ht laser is:

custom_menu.laser_on.enable                true                  #
custom_menu.laser_on.name                 Laser_on_P5    #
custom_menu.laser_on.command           M106 S5          #

custom_menu.laser_on1.enable                true                     #
custom_menu.laser_on1.name                 Laser_on_P100     #
custom_menu.laser_on1.command           M106 S100          #


custom_menu.laser_off.enable                true                 #
custom_menu.laser_off.name                  Laser_off         #
custom_menu.laser_off.command            M107              #

The Iaser controller is attached to pin 2.4, and I can turn the laser on with either of the two pwm levels, or by setting a start-up value, however, the laser just comes on to full power immediately (PWM @ 255, instead of 5 or 100), and neither above command has any effect. I can limit the power by changing the max_pwm parameter, in which case the laser comes on to the maximum allowed PWM immediately and the commands have no effect.

I'm not sure why the LCD commands have no effect, but at the moment I have no "host computer" so I cannot test whether the fan output is controllable via serial.


I'm not sure how to troubleshoot this issue, as it seems like it just isn't behaving as intended, or that I am missing a fundamental step of the module's code.

wolfmanjm

unread,
May 19, 2015, 9:37:20 PM5/19/15
to smoothiewa...@googlegroups.com
no spaces allowed in the M commnads so you need to do..

M106S100

this is documented in the wiki I believe.

Arthur Wolf

unread,
May 20, 2015, 11:08:02 AM5/20/15
to smoothiewa...@googlegroups.com
Why are you using switch instead of the laser module ?
The laser module will give much better results, and uses hardware pwm instead of software pwm ...

--
You received this message because you are subscribed to the Google Groups "Smoothieware Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to smoothieware-sup...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Courage et bonne humeur.

Angelo Posteraro

unread,
May 20, 2015, 12:09:58 PM5/20/15
to smoothiewa...@googlegroups.com
It was mostly for a quick test, seeing as the module was set up aside from an LCD entry to enable it.

The laser module has quite a few settings I'm unfamiliar with, and I'll have to go through the wiki. Thanks for the tip though, what is the advantage of hardware vs software pwm?

Arthur Wolf

unread,
May 20, 2015, 12:13:37 PM5/20/15
to smoothiewa...@googlegroups.com
On Wed, May 20, 2015 at 6:09 PM, Angelo Posteraro <angelop...@gmail.com> wrote:
It was mostly for a quick test, seeing as the module was set up aside from an LCD entry to enable it.

The laser module has quite a few settings I'm unfamiliar with, and I'll have to go through the wiki. Thanks for the tip though, what is the advantage of hardware vs software pwm?

You'll get finer control. Also the laser module actually reduces power during acceleration so the output is not too much when running at lower speeds during acceleration.
So it's essentially necessary to use the laser module to get good results ( unless your acceleration is insanely high ).
 

--
You received this message because you are subscribed to the Google Groups "Smoothieware Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to smoothieware-sup...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Angelo Posteraro

unread,
May 20, 2015, 6:23:31 PM5/20/15
to smoothiewa...@googlegroups.com
In the documentation it shows the use of spaces between the M106 and S parameter. Additionally, testing now with a host, the M106  S100 command works as expected, however with an LCD command, no spaces are allowed, just as you described. This is somewhat confusing, but The custom commands work now, so thanks!

Arthur Wolf

unread,
May 21, 2015, 5:44:20 AM5/21/15
to smoothiewa...@googlegroups.com
See : http://smoothieware.org/panel

« custom_menu.menu_name.command » explains about the spaces and using multiple commands.

--
You received this message because you are subscribed to the Google Groups "Smoothieware Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to smoothieware-sup...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Angelo Posteraro

unread,
May 21, 2015, 9:37:42 AM5/21/15
to smoothiewa...@googlegroups.com
Thanks for the link!

It doesn't explicitly say no spaces, and since all other G/M codes allow spaces it may be difficult for a new user to make that leap. 
I got it working just fine after your advice of course, but I'd recommend adding it to that page for a bit of clarification.

Cheers
To unsubscribe from this group and stop receiving emails from it, send an email to smoothieware-support+unsub...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages