Laser control via external MOSFET

  • Hi,

    I hooked up a small laser to VIN via an external MOSFET module (PWM-capable, ).
    The trigger input for this module is connected to HEATER_3.
    Since my VIN is 24V, and the MOSFET states a max. trigger voltage level of 20V, I cannot use a fan output (or maybe I can without burning up anything?)

    I can turn on the laser at full power with [c]M42 P3 S0[/c].
    I can turn on the laser just slightly to see a faint dot with [c]M42 P3 S254[/c].
    I can turn on the laser off with [c]M42 P3 S255[/c].

    I was planing on using "laser mode" with [c]M452 P3[/c], which immediately turns on the laser at full power. [c]M3[/c] or [c]M5[/c] both result in 100% laser power. Only [c]M3 S255[/c] turns the laser off.

    This means that the logic signal is inverted. I think what I'm looking for would be a I parameter on M452, to set "inverted" or not. Would it be possible to add this feature in an upcoming release, or is there a simpler solution?


  • administrators

    This will be implemented in firmware 1.20RC3.

  • Thanks for implementing this so quickly.
    I'm running:
    Firmware Electronics: Duet WiFi 1.02 or later
    Firmware Version: 1.21RC3 (2018-02-28 build 4)
    WiFi Server Version: 1.21RC4(08b3)
    Web Interface Version: 1.21-RC4

    Unfortunately I can't get it to work.
    The I-parameter does not change the way my pins behaves:

    M452 P3 I1
    M3 S240

    I hooked up an oscilloscope to check the PWM signal on pin 3.
    For [c]M3 S240[/c], the PWM signal is mostly low, with short peaks to 3.3V. The laser is dimly lit.
    For [c]M3 S20[/c], the PWM signal is mostly high, with short drops to 0V. The laser is almost at full power.
    If I use I0 the behaviour stays the same.

    I'm not sure what value range is expected? 0-255 or 0.0-1.0?

  • administrators

    What order do you have the M307 H3 A-1 C-1 D-1 and the M452 commands in? You probably need the M307 command first.

    Thanks for reporting this, I think I have found the problem. Will be fixed in RC4.

Log in to reply