Pwm output on Fan 0
-
Hi all
I’ve been asked to come here by E3D to see if you can help, I’m trying to output a pwm signal via Fan 0 on my Duet WiFi.
I’ve been using a 24v fan before I attach my laser But can’t get the pwm signal to fan 0 to start.
I’ve put this into my config.g file
M555 P2;set Marlin output mode
M452 C”!fan0” Q100 ; configure fanAnd I’m using M106 s255 commanding the console but But I cannot get the fan to spin up
I’ve checked the voltage readings From the pins on the board but there is no voltage change when a command is sent.
Thanks in advance for any heop
-
What firmware? Anyway, M452 puts your printer in laser mode, using fan0 pins.
"But I cannot get the fan to spin up" - what fan? Arent your laser connected to that pin?
-
@Sp00kie13 Which firmware version are you using? I'm assuming RRF 3.x due to the formatting of your M452 command.
See https://duet3d.dozuki.com/Wiki/Gcode#Section_M452_Select_Laser_Printer_Mode
I've just tested this, typing the commands into the console. First, I have a fan defined on fan0, so I had to disable it with
M950 P0 C"nil"
Then, I send the following, but make sure you use use straight quotes, not curly quotes (your text above has curly quotes, using them gives an error "Error: M452: string expected")
M452 C"!fan0" Q100
This should give the response "Laser mode selected" in the console. Inverting fan0 with "!" causes the fan to come on full power. You can't control it using M106; it's G1 moves that control the PWM amount. See the gcode dictionary I posted above.
Edit: also see https://duet3d.dozuki.com/Wiki/Laser_PWM_control
Ian
-
@droftarts said in Pwm output on Fan 0:
@Sp00kie13 Which firmware version are you using? I'm assuming RRF 3.x due to the formatting of your M452 command.
See https://duet3d.dozuki.com/Wiki/Gcode#Section_M452_Select_Laser_Printer_Mode
I've just tested this, typing the commands into the console. First, I have a fan defined on fan0, so I had to disable it with
M950 P0 C"nil"
Then, I send the following, but make sure you use use straight quotes, not curly quotes (your text above has curly quotes, using them gives an error "Error: M452: string expected")
M452 C"!fan0" Q100
This should give the response "Laser mode selected" in the console. Inverting fan0 with "!" causes the fan to come on full power. You can't control it using M106; it's G1 moves that control the PWM amount. See the gcode dictionary I posted above.
Edit: also see https://duet3d.dozuki.com/Wiki/Laser_PWM_control
Ian
Thanks for the reply Ian
I assume I’m using the current version of the firmware as I did an upgrade on the board when I got it 2 week ago, so I presume it is RRF 3.x.
The reason I’m using a fan is just as a test, as all in need to know is off the terminal is putting out a signal before I try my laser
I’ve tried adding M950 P0 C"nil" To the config.g but this proved unsuccessful
I’ve also tried out putting to fan 1 and 2 without any success, although the fan did spin up momentarily on start up when connected to fan 1, but I’m assuming that this is because natively this terminal is programmed this way. -
@Sp00kie13 please post your full config.g.
If you have no fans defined, you probably don’t have anything to disable. The main point is to type the commands in directly to the Gcode console, to check they are working, before adding them to the config.g. Are you resetting the Duet each time you change the config? Or you can send M98 P"config.g" in the console, which will run the config, and also show up any errors.
Ian
-
@droftarts said in Pwm output on Fan 0:
@Sp00kie13 please post your full config.g.
If you have no fans defined, you probably don’t have anything to disable. The main point is to type the commands in directly to the Gcode console, to check they are working, before adding them to the config.g. Are you resetting the Duet each time you change the config? Or you can send M98 P"config.g" in the console, which will run the config, and also show up any errors.
Ian
Hi Ian, I’ve taken the lines out of the config.g and then entered them manually into the console, but still nothing
-
@Sp00kie13 what firmware version are you using? Send M115 and post the reply. And you get no response or message when you enter the M452 command into the console? Have you checked the fan works by plugging it into the always-on fan header?
And please post your config.g
Ian
-
@droftarts the firmware is
M115
FIRMWARE_NAME: RepRapFirmware for Duet 2 WiFi/Ethernet FIRMWARE_VERSION: 2.03 ELECTRONICS: Duet WiFi 1.02 or later FIRMWARE_DATE: 2019-06-13b2Config.g
; Configuration file for Duet
; executed by the firmware on start-up
; WorkBee Firmware Version 1.0.7; Configure Connection - ENABLE ONLY ONE OF THE BELOW THREE
M552 S1 ; Enable Wifi Network
;M552 S2 ; Enable Access Point Mode
;M552 S1 P192.168.0.15 ; Enable Ethernet - Change IP Address to suit; - - - - - - - - - - - - - - - - - - - -
; DO NOT CHANGE ANY OF SETTINGS BELOW
; TO MAKE A CHANGE, COPY THE LINE OF CODE, PASTE IT INTO customconfig.g. THE CHANGE CAN THEN BE MADE IN customconfig.g
; ANY ADDITIONAL SETTINGS SHOULD BE PUT IN customconfig.g; General preferences
M453 ; Put the machine into CNC Modes
M550 PWorkBee CNC Machine ; Set machine name
G90 ; Set absolute coordinates; Network
M586 P0 S1 ; Enable HTTP
M586 P1 S0 ; Disable FTP
M586 P2 S0 ; Disable Telnet; Configure Drives
M569 P0 S0 ; Drive 0 goes forwards
M569 P1 S1 ; Drive 1 goes forwards
M569 P2 S0 ; Drive 2 goes forwards
M569 P3 S1 ; Drive 3 goes forwards
M584 X0 Y1:3 Z2 ; Apply drive mapping to axes; Configure Axes
M92 X398.073 Y401.541 Z400 ; Set steps per mm
M350 X16 Y16 Z16 I1 ; Configure microstepping
M566 X500 Y500 Z500 ; Set maximum instantaneous speed changes (mm/min)
M203 X2500 Y2500 Z2500 ; Set maximum speeds (mm/min)
M201 X150 Y150 Z150 ; Set accelerations (mm/s^2)
M906 X2400 Y2400 Z2400 I100 ; Set motor currents (mA); Configure Axis Limits
M208 X0 Y0 Z0 S1 ; Set axis minima
M208 X304 Y760 Z80 S0 ; Set axis maxima; Configure Endstops
M574 X2 Y2 Z2 S1 ; Set active low endstops; Other Settings
M140 H-1 ; Disable heated bed
M564 S0 H0 ; Disable jog commands when not homed
M911 S21.0 R23 P"G91 G1 Z3 F1000" ; Configure power loss resume
M501 ; Load Stored Parameters
M98 Pcustomconfig.g ; Execute custom config settings -
Yes I have tried the fan in the always on terminals
-
FIRMWARE_VERSION: 2.03
Well, that largely explains it. I think you have a WorkBee machine, and if you are using their firmware, they use the older version 2 RepRapFirmware. The commands you’re sending are for RRF v3, and what I was testing. What you need is the command in RRF 2. You need to know the fan PIN number, disable its default fan assignment, then assign it to the laser. See https://duet3d.dozuki.com/Wiki/Using_servos_and_controlling_unused_IO_pins which shows the PIN numbers. So try:
M106 P20 I-1 ; disable fan0 assignment M452 P20 I1 F100 ; laser uses fan0 pin, PWM frequency 100Hz
Let me know if that works.
Edit: you still can’t control the pin with M106. The laser should fire with G1 moves, but I’m not sure with firmware v2.03. See the laser guide I posted earlier. If you can give feedback, I’ll update the guide.
Ian