Can I check output of pwm channel?

  • I am trying to get my laser operational. I have read everything I can find on setting up a laser. Much of it is old but I think I have it set up correctly. However I cannot get the pwm function to work. If I try to use duex.pwm2 to control it (using pwm and gnd pins) I get nothing. If I use duex.fan6 to try to control it, it is on full power and won't adjust.
    I don't know if I am getting the correct signal from the pwm.

    What I have:
    Duet2 wifi
    RRF 3.1.1
    Laser module:

    Here is my config.g

    ; Configuration file for Duet WiFi (firmware version 3)
    ; executed by the firmware on start-up
    ; generated by RepRapFirmware Configuration Tool v3.1.3 on Mon Jun 15 2020 11:14:50 GMT-0600 (Mountain Daylight Time)

    ; General preferences
    G90 ; send absolute coordinates...
    M83 ; ...but relative extruder moves
    M550 P"BLV Cube" ; set printer name
    M669 K1 ; select CoreXY mode

    ; Network
    M552 S1 ; enable network
    M586 P0 S1 ; enable HTTP
    M586 P1 S0 ; disable FTP
    M586 P2 S0 ; disable Telnet

    ; Drives
    M569 P0 S0 ; physical drive 0 goes backwords - X
    M569 P1 S0 ; physical drive 1 goes backwards - Y
    M569 P2 S0 ; physical drive 2 goes backwards - Z right side
    M569 P3 S1 ; physical drive 3 goes forwards - Exturder
    M569 P4 S0 ; physical drive 4 goes backward - Z left side
    M569 P5 R-1 ; disable error warnings on driver 5
    M584 X0 Y1 Z2:4 E3 ;two Z Motors connected to driver outputs Z and E1
    M671 X-20:310 Y0:0 S2 ;Leadscrew at left (connected to Z) and right connected to E1) of X axis
    M350 X16 Y16 Z16 E16 I1 ; configure microstepping with interpolation
    M92 X100.61 Y100.61 Z400.42 E2754.00 ; set steps per mm
    M566 X500.00 Y500.00 Z100.00 E40.00 ; set maximum instantaneous speed changes (mm/min)
    M203 X10000.00 Y10000.00 Z6000.00 E8000.00 ; set maximum speeds (mm/min)
    M201 X800.00 Y800.00 Z30.00 E120.00 ; set accelerations (mm/s^2)
    M906 X1400.00 Y1400.00 Z800.00 E500.00 I30 ; set motor currents (mA) and motor idle factor in per cent
    M84 S30 ; Set idle timeout

    ; Axis Limits
    M208 X-15 Y-15 Z0 S1 ; set axis minima to compensate for skew
    M208 X300 Y340 Z300 S0 ; set axis maxima

    ; Endstops
    M574 X1 S1 P"xstop" ; configure active-high endstop for low end on X via pin xstop
    M574 Y1 S1 P"ystop" ; configure active-high endstop for low end on Y via pin ystop
    M574 Z1 S2 ; configure Z-probe endstop for low end on Z

    ; Z-Probe
    M950 S0 C"duex.pwm1" ; create servo pin 0 for BLTouch
    M558 P9 C"" H3 F120 T4800 ; set Z probe type to bltouch and the dive height + speeds
    G31 P25 X30 Y-10 Z.85 ; set Z probe trigger value, offset and trigger height
    M557 X25:300 Y30:285 P4:4 ; define mesh grid
    M376 H10

    ; Heaters
    M308 S0 P"bedtemp" Y"thermistor" T100000 B4138 R4700 ; configure sensor 0 as thermistor on pin bedtemp
    M950 H0 C"bedheat" T0 ; create bed heater output on bedheat and map it to sensor 0
    M307 H0 A64.4 C593.3 D14.4 S1.00 V23.9 B0 ; results from PID
    M140 H0 ; map heated bed to heater 0
    M143 H0 S120 ; set temperature limit for heater 0 to 120C
    M308 S1 P"e0temp" Y"thermistor" T100000 B4725 C7.06e-8 ; configure sensor 1 as thermistor on pin e0temp
    M950 H1 C"e0heat" T1 ; create nozzle heater output on e0heat and map it to sensor 1
    M307 H1 A572.7 C283.7 D6.9 S1.00 V23.5 B0 ; results from PID
    M143 H1 S300 ; Set temperature limit for heater 1 to 300C

    ; Fans
    M950 F0 C"fan0" Q500 ; create fan 0 on pin fan0 and set its frequency
    M106 P0 S0 H-1 ; set fan 0 value. Thermostatic control is turned off
    M950 F1 C"fan1" Q500 ; create fan 1 on pin fan1 and set its frequency
    M106 P1 S1 H1 T45 ; set fan 1 value. Thermostatic control is turned on
    M950 F3 C"duex.fan3" Q1000 ; create Fan 3 is connected to duex fan3 pin, PWM at 1000Hz
    M106 P3 S0 H-1 ; set fan 1 value. Thermostatic control is turned off

    ; Fan control for MCU
    M308 S3 Y"mcu-temp" A"MCU" ; configure sensor 3 as thermistor on MCU
    M950 F4 C"duex.fan4" Q1000 ; create fan 4 on pin duex fan4, PWM at 1000Hz
    M106 P4 H3 T30 ; set fan 4 value.
    M950 F5 C"duex.fan5" Q1000 ; create fan 5 on pin duex.fan5, PWM at 1000Hz
    M106 P5 H3 T40 ; set fan 5 value

    ; Tools
    M563 P0 S"E3D_V6" D0 H1 F0 ; 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

    ; Calibrated MCU temp
    M912 P0 S-11

    ; XY scale adjustment
    M579 Y1.003 ; adjust the X, Y, and Z axis scales. if it should be 100mm but it is 100.3 set Y0.997 (= 100/100.3)

    ; Custom settings are not defined
    ;M501 ; Load saved parameters from non-volatile memory

    I use a macro to switch to laser mode:

    ; Switch to Laser control

    ;M452 C"duex.pwm2" R255 Q20000 ; laser uses pwm2 pin, PWM frequency 20000Hz
    M452 C"duex.fan6" R255 Q20000 ; laser uses fan6 pin, PWM frequency 20000Hz

    That is where I try either the fan or the pwm.

    And here is a sample of an etching file:

    ( PicEngrave Pro 6 - 3D Laser Gcode )
    ( Date/Time: 10-04-2019 at 09:32:52 )
    ( Image File: PicLaser Grey Scale )
    ( Image size in mm: 33.88w x 19.91h )
    ( Pixel Resolution: 0.11 mm )
    ( Max. Cut Depth: 255 mm )
    ( Min. Cut Depth: 0 mm )
    ( 3rd Axis Safe Position: 0 mm )
    ( Start Position: image center )
    ( Horizontal Axis Offset: 150 mm )
    ( Vertical Axis Offset: 150 mm )
    ( Engraving Angle: Left 45 degrees )
    ( Metric Mode )
    ( X Axis Align = 0 )
    ( Y Axis Align = 0 )
    ( Laser Commands on Same Line )
    G1 X150.0 Y150.0
    G1 F3000
    G1 X133.06 Y140.045
    M3 S0.0
    G1 X133.06 Y140.045
    G1 X133.06 Y140.045 M3 S247
    G1 X133.17 Y140.045 M3 S250
    G1 X133.06 Y140.155 M3 S252
    G1 X133.06 Y140.265 M3 S246
    G1 X133.17 Y140.155 M3 S0
    G1 X133.28 Y140.045 M3 S247
    G1 X133.39 Y140.045 M3 S245
    G1 X133.28 Y140.155 M3 S3
    G1 X133.17 Y140.265 M3 S0
    G1 X133.06 Y140.375 M3 S251
    G1 X133.06 Y140.485 M3 S248
    G1 X133.17 Y140.375 M3 S3
    G1 X133.28 Y140.265 M3 S0
    G1 X133.39 Y140.155 M3 S3
    G1 X133.5 Y140.045 M3 S255
    G1 X133.61 Y140.045 M3 S249
    G1 X133.5 Y140.155 M3 S0
    G1 X133.39 Y140.265 M3 S0
    G1 X133.28 Y140.375 M3 S1
    G1 X133.17 Y140.485 M3 S0

  • No one?
    Nobody can give me some advice or guidance?

  • Hi,

    I'm still using v2 firmware so I cannot be of much help.


  • I believe duex PWM pins need to be inverted.
    If you use duex.fan6 and set it to on, does it turn off?

    I believe this should help you

  • @jay_s_uk said in Can I check output of pwm channel?:

    I believe duex PWM pins need to be inverted.
    If you use duex.fan6 and set it to on, does it turn off?

    I believe this should help you

    Thanks for that link. Looks exactly like what I have. I responded there as it looks like @radiomodell has it working.

  • @jay_s_uk said in Can I check output of pwm channel?:

    I believe duex PWM pins need to be inverted.
    If you use duex.fan6 and set it to on, does it turn off?

    I believe this should help you

    No, that is the problem. It will only stay on. Will not turn off or change power at all.

Log in to reply