Laser TTL via servo PWM on Duex



  • Just got my Duex2 and want to use the servo connector to drive the TTL (5v signal) for a laser using the last heater (PWM5/E6_PWM).

    Let me know if this seems right.

    TTL controller + to Duex servo 5v
    TTL controller - to Duex servo PWM

    Use M307 H7 A-1 C-1 D-1 to disable the heater.

    From here, would I use M42 P7 S### (0-255) to control the PWM signal for the TTL controller?


  • administrators

    I don't know the details of your laser controller, but I would expect it to be:

    TTL- to DueX servo ground
    TTL+ to DueX servo PWM

    M307/M42 commands are as you said.



  • I'm waiting on a replacement TTL circuit (I think I killed mine).

    In the meantime, I tried putting the M307 line in the config.g custom gcode section, but I still get the pin not available message when I use M42 until I manually send the M307. Is there somewhere else I should be putting it or do I just have to manually send the M307 each time I want to use the laser?


  • administrators

    Check that the format of the M307 command in config.g is correct. You don't need to send it more than once. Also make sure that you don't have any tools defined in M563 commands that use that heater.



  • Don't have any tools assigned to H7 and I'm using the exact M307 as posted in the first post. Here's what my config.g looks like from the Tools section to the custom gcode.

    ; Tools
    M563 P0 D0 H1                                      ; Define tool 0
    G10 P0 X0 Y0 Z0                                    ; Set tool 0 axis offsets
    G10 P0 R0 S0                                       ; Set initial tool 0 active and standby temperatures to 0C
    M563 P1 D1 H1                                      ; Define tool 1
    G10 P1 X0 Y0 Z0                                    ; Set tool 1 axis offsets
    G10 P1 R0 S0                                       ; Set initial tool 1 active and standby temperatures to 0C
    M563 P2 D2 H1                                       ; Define tool 2
    G10 P2 X0 Y0 Z0                                    ; Set tool 2 axis offsets
    G10 P2 R0 S0                                       ; Set initial tool 2 active and standby temperatures to 0C
    
    ; Automatic power saving
    M911 S22 R23 P"M913 X0 Y0 G91 M83 G1 Z3 E-5 F1000" ; Set voltage thresholds and actions to run on power loss
    
    ; Custom settings
    M307 H7 A-1 C-1 D-1
    M207 S50.0 F5000
    

  • administrators

    Do you have a M307 H7 command in config-override.g?



  • Never even looked at that file. There's a M307 H7 A340.0 C140.0 D5.5 S1.00 V0.0 B0 heater config there. Should I change it to M307 H7 A-1 C-1 D-1 or just delete it?


  • administrators

    You can just delete it. Sometime in the past you have run M500, when you didn't have the M307 H1 command in config.g, so it saved the default parameters to config-override.g.



  • Sorry for the late update.

    Deleting the M307 in the override fixed that issue.

    My replacement TTL circuit arrived today and I just wanted to run the config by you before powering it up just to make sure I'm not doing anything obviously wrong.

    In the picture below, you can see the green and black wires going from the Duex PWM header going to the TTL circuit (green->pwm ; black-> -- ) From what I understand, the TTL circuit uses 0v on signal, 5v off signal. I'm assuming that means that the logic for the pwm would be reversed (S0 being on and S255 being off)

    The plug above the TTL header is 12v in from a buck converter and the two on the oppostie side are the fan and laser outputs.

    0_1524479283508_IMG_2794.JPG


  • administrators

    That looks correct to me.



  • I think I did something in a prior attempt that buggered the PWM on the one in the picture because I wasn't getting any voltage out of the header when I sent the M42 P7 S255 command. Switched to P5 and it's working beautifully.

    Probably nothing that can be done about this, but it does ping the laser to full power for a fraction of a second when powered on. I'm guessing that's just the delay from reading the firmware. Mostly a non issue though as long as it isn't pointed in someone's face since it is such a short burst.

    Thanks for the guidance!


  • administrators

    Because your TTL input is active low, the best option would be to use an open collector buffer or just an NPN transistor or N-channel MOSFET (e.g. 2N7000) between the servo output and the TTL input, to invert the signal.

    It would be possible to use the PS_ON output to drive it directly, but the firmware doesn't yet support using PS_ON as GPIO.



  • In this post, @dc42 recommended using a 74HCT02 as simple logic inverter.
    Because all the PWM-output of the Duet are active-low, we need a hardware solution to prevent the laser from powering on during booting & parsing of config.g.
    I have ordered a 74HCT02, but not received it yet. But for the reasons @dc42 outlined, this is the correct way to go.



  • @dc42 I forgot to mention in that post that I was wrong about the TTL being active low. S255 is full power and S0 is off.

    @resam I'm going to get a separate switch for the laser's power so it won't be powered until I'm ready to start a 'print'. That way when I power the laser on, the config will already be loaded and there shouldn't be a full power spike.
    I should have one for other safety reasons anyway.


Locked
 

Looks like your connection to Duet3D was lost, please wait while we try to reconnect.