Weird Laser Mode
-
Hi
I attached a Chinese Laser to my Duet2 Wifi with the circuit described here.
Everything worked fine, Laser did what it should do...
Until I upgraded firmware to:RepRapFirmware for Duet 2 WiFi/Ethernet version 3.2-beta3.2
I unplugged the Laser PWM Circuit to measure the output of the HEATER3 Pin (8) directly with my multimeter with respect to GND.
After powering the Duet I measure 3,276V (mode FFF).
If I then issue:M452 C"exp.heater3" R255 F1000
I read 0,006V...
That would, if I connect my laser and pwm circuit to it power it fully on...
Why is that?
Then if I issue aM3 S0
nothing happens, still 0,006V
and withM3 S255
the same, and the same with
M5
nothing happens.
Whats wrong here?
Any ideas?Thats my config.g:
M584 X0 Y1 Z2:3 U3 E4 P3 G90 ; send absolute coordinates... M83 ; ...but relative extruder moves M550 P"PaulsPrinter" ; set printer name ; 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 back M569 P1 S0 ; physical drive 1 goes back M569 P2 S1 ; physical drive 2 goes forwards M569 P3 S1 ; physical drive 3 goes forwards M569 P4 S1 ; physical drive 3 goes forwards M350 X16 Y16 Z16 U16 E16 I1 ; configure microstepping with interpolation M92 X80.02 Y80.07 Z398.00 U398.00 E92.60 ; set steps per mm M566 X900.00 Y900.00 Z12.00 U12.00 E12.00 ; set maximum instantaneous speed changes (mm/min) M203 X4000 Y4000 Z360.00 U360.00 E1200 ; set maximum speeds (mm/min) M201 X2000.00 Y2000.00 Z50.00 U50.00 E250.00 ; set accelerations (mm/s^2) M906 X1200 Y1200 Z1200 U1200 E1200 I30 ; set motor currents (mA) and motor idle factor in per cent M84 S10 ; Set idle timeout ; Axis Limits M208 X-115 Y-107.5 Z0 U0 S1 ; set axis minima M208 X107.5 Y107.5 Z205 U205 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 S1 P"!zstop" ; configure active-high endstop for low end on Z via pin zstop M574 Z1 S1 P"!e0stop" ; Z-Probe M558 P0 H40 F120 T3000 ; disable Z probe but set dive height, probe speed and travel speed M557 X-107:107 Y-107:107 S20 ; define mesh grid ; Heaters M308 S0 P"bedtemp" Y"thermistor" T100000 B4725 C7.06e-8 ; 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 R0.430 C483.3 D1.01 S1.00 V12.3 B0 M140 H0 ; map heated bed to heater 0 M143 H0 S90 ; set temperature limit for heater 0 to 90C 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 R2.838 C175.3 D10.39 S1.00 V12.5 B0 ; PID tuning ; 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 ; Tools M563 P0 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 ; Custom settings are not defined ; Miscellaneous M575 P1 S1 B57600 ; enable support for PanelDue
-
So instead of using M3 commands checking the heater3 pwm output I just tried it with this command:
G1 X5 S255 F50
and surprise surprise, while X is moving I get 3,27V on the pin, so I guess all M3,M5 commands have no effect and I need to invert the heater3 logic...
-
Okay, using
M452 C"!exp.heater3" R255 F1000
to set Laser mode now changes the initial heater3 voltage from 3,276V to 3.302V and all G1 Snnn commands seem to create a legit pwm voltage.
Still I have no idea why "M3 Snnn" "M5" has absolutely no effect.
Tomorrow I will attach the Laser inverter pcb again and see if it works again.
-
@pauledd said in Weird Laser Mode:
RepRapFirmware for Duet 2 WiFi/Ethernet version 3.2-beta3.2
What firmware were you using before?
-
@Phaedrux said in Weird Laser Mode:
@pauledd said in Weird Laser Mode:
RepRapFirmware for Duet 2 WiFi/Ethernet version 3.2-beta3.2
What firmware were you using before?
2.03
-
Ok that's quite a large firmware version gap. I'm pretty sure in between there somewhere there has been some changes to how laser mode behaves.
From the 2.05 notes
In laser mode (M453), M3 never turns on the laser immediately. Instead it sets the default laser power for following G1/G2/G3 commands. Likewise, M5 does not immediately turn off the laser, it sets the default laser power for following G1/G2/G3 commands. If a subsequent G1 command has a S parameter, the value of that parameter becomes the default laser power for that command and subsequent G1/G2/G3 commands.
From the 2.04 notes
In Laser mode, if sticky laser power mode is selected, the power set by the S parameter in a G1 command is remembered across G0 moves to the next G1 move
-
Thanks for the clarification, I was a bit too lazy regarding keeping my Duet up to date true to the motto "never change a running system"
So now there is no way of turning the laser on without a movement G1 command? Thats quite sad, because I frequently used the laser to position my PCB's by reference marks...
-
Perhaps a feature request? I'm not certain but I think it was a safety thing.
-
@Phaedrux said in Weird Laser Mode:
In laser mode (M453), M3 never turns on the laser immediately. Instead it sets the default laser power for following G1/G2/G3 commands. Likewise, M5 does not immediately turn off the laser, it sets the default laser power for following G1/G2/G3 commands. If a subsequent G1 command has a S parameter, the value of that parameter becomes the default laser power for that command and subsequent G1/G2/G3 commands.
So this code should set laser power to 1 and the laser should go on when the laser is moving:
M452 C"!exp.heater3" R255 F1000 ; enable LASER mode G90 M3 S1 G1 X20 F200 G1 X0 F200 G1 X20 F200 G1 X0 F200 G1 X20 F200 G1 X0 F200 G1 X20 F200 G1 X0 F200 G1 X20 F200 G1 X0 F200 M451 ; enable FFF mode
But it doesnt. I found out that the S parameter in G1 seems mandatory to get the laser ON while moving... This makes the M3 command totally useless.
Furthermore software like FlatCam outputs gcode that uses M3 exclusively to set Laser Power before and after movements of the laser.So if my understanding is correct you either use "G1 .. Snnn .. " commands or you are lost... or contact every developer of other gcode producing software to adapt this G1 Snnn command...
Then I would really consider to go back to RRF 2.03
-
That's from the 2.03 release notes, which is the version you were running before, wasn't it?
Laser mode: for safety, the G1 S parameter is no longer sticky by default. You can make it sticky by adding parameter S1 to the M452 command.
From 2.04
In Laser mode, if sticky laser power mode is selected, the power set by the S parameter in a G1 command is remembered across G0 moves to the next G1 move
@pauledd said in Weird Laser Mode:
M452 C"!exp.heater3" R255 F1000 ; enable LASER mode
You're missing the S1 on your M452 command to enable laser mode.
https://duet3d.dozuki.com/Wiki/Gcode#Section_M452_Select_Laser_DeviceMode
-
@Phaedrux said in Weird Laser Mode:
That's from the 2.03 release notes, which is the version you were running before, wasn't it?
Laser mode: for safety, the G1 S parameter is no longer sticky by default. You can make it sticky by adding parameter S1 to the M452 command.
From 2.04
In Laser mode, if sticky laser power mode is selected, the power set by the S parameter in a G1 command is remembered across G0 moves to the next G1 move
@pauledd said in Weird Laser Mode:
M452 C"!exp.heater3" R255 F1000 ; enable LASER mode
You're missing the S1 on your M452 command to enable laser mode.
https://duet3d.dozuki.com/Wiki/Gcode#Section_M452_Select_Laser_DeviceMode
Thanks to your post my laser is now up and running on duet wifi rrf 3.1.1 .
Thank you very much -
@Phaedrux said in Weird Laser Mode:
You're missing the S1 on your M452 command to enable laser mode.
Thanks, I totally missed that somehow...
Still I dont know how to focus my laser while it is moving could be
a little bit trickyMaybe I'll heft my function generator to the laser module to enable it to 1/255th pwm for focusing
I opened a issue regarding the M3 command... -
@pauledd said in Weird Laser Mode:
Still I dont know how to focus my laser while it is moving could be
a little bit trickyI found a way to do it without moving it, assigning laser pin to a free fan pin and control it via M106 command:### DOES NOT WORK ### ; disable Laser Mode M451 ; assign laser pin to a free fan Number M950 F2 C"!exp.heater3" Q1000 ; enable laser with 1/255th power M106 P2 S1 ; do the focusing stuff ; disable laser M106 P2 S0 ; free heater3 again for use in laser mode M950 F2 C"nil" ### DOES NOT WORK ###
Just found out something is wrong again, after setting "M106 P2 S1" the heater3 pwm goes to 0,491V but it should read 0,02V...
Also the voltage does not change from pwm 1 to 25.
At 26 I then read 0,5V, at 27 0,52V and so on up to 254.
I dont get it, I'll give up for now, using my function generator... -
-
-
Does that make a difference to your attempt?
-
No, the command was just there IN CASE I still have the laser mode enabled.
If laser mode was not enabled the wrong command would have no effect anyway... -
@pauledd said in Weird Laser Mode:
after setting "M106 P2 S1"
I wonder if this is because S1 is the same as S255?
S1 or S0 for on and off, or S0.1 to S1 in decimal values to act as a percentage, or 2-255 as an 8bit value.
I wonder if it would behave differently if it was configured as a servo i/o pin and controlled with M42 instead.
https://duet3d.dozuki.com/Wiki/Gcode?revisionid=HEAD#Section_M42_Switch_I_O_pin
-
@Phaedrux said in Weird Laser Mode:
I wonder if it would behave differently if it was configured as a servo i/o pin and controlled with M42 instead.
That is definitely worth a try, I'll test that tomorrow, thanks.
-
@pauledd said in Weird Laser Mode:
exp.heater3
I'm not sure if it would matter either but there are other expansion heater pins to try. I don't know if all are created equal.