Simple relay control... or not?
-
@alankilian
Yep. Just keep an eye out for a big cloud of smoke in SW England. If there is one, it didn't work -
@nightowl999 have you considered using the Laser/VFD output to drive the relay module? It provides a 5V signal.
-
My intention is to 'upgrade' to a milling motor in the not too distant future, @dc42, so I was going to leave the Laser/VFD output for that.
Doing it this way for now will support both my router and dust collector, and just the dust collector when I've saved enough for the MM.
-
@alankilian Ah, perhaps not.
I think I've missed something because, when I send the M3 code from the Console, I get the error:
M3
Error: M3: No P parameter and no active tool with spindle.Am I supposed to configure this elsewhere in the config.g file?
Thank you
-
@nightowl999
From the GCODE page:
"It is an error if there is no tool active or the active tool does not have a spindle assigned and there is no P parameter provided to define which spindle this should be applied to."
Maybe you just need to select a tool using a T command? REFERENCE
Or you need to define a tool using M563 ?
-
@alankilian Oops, well I haven't defined a tool, so that's probably a good starting point!
Would it just be a case of adding a single line like this before the M950 line, then:
M563 P0 R0 S"Makita" ; assign spindle 0 to tool 0 and name it Makita
Thank you
-
I'm still having some difficulty getting this 'simple' thing to work, but I have made some progress, thanks to you guys on here!
I've revisited my config.g file and come up with this to configure the relay:
; Makita and relay configuration
M950 R0 C"out1+out8" ; enable router relay on out8
M563 P0 S"Makita" R0 ; assign spindle 0 to tool 0 and name it Makita
T0 ; select tool 0Now, when entering M3 in the command line I don't any errors at all - but the relay doesn't activate, so nothing happens.
I know I'm getting there, but I must have missed something!
Any further help would be appreciated.
Thank you
-
@nightowl999 try adding
L1
to the M950 and then sendingM3 S1
rather than just M3 -
@nightowl999 Apologies if you have already stated this, I can't see it in the thread, but what firmware version are you on? Send M115 and post the response. Earlier versions of RRF 3.x dealt with assigning spindle outputs differently. See https://docs.duet3d.com/en/User_manual/Reference/Gcodes/M453
Ian
-
Hi @droftarts.
The result is...
m115
FIRMWARE_NAME: RepRapFirmware for Duet 3 MB6HC FIRMWARE_VERSION: 3.4.0 ELECTRONICS: Duet 3 MB6HC v1.01 or later FIRMWARE_DATE: 2022-03-15 18:57:26 -
Tried that, @jay_s_uk, but got the following error:
Error: M3: Requested spindle RPM out of range.
I also tried S0, which didn't produce an error, but didn't operate the relay, either
-
@nightowl999 ok, attempt 2.
Remove theL1
from the M950.
And just send something like M3 S4000 (I know we don't have RPM control) -
Well, that worked @jay_s_uk!
-
@nightowl999 great, so any S value should activate the spindle. So just make sure your gcode has that an you'll be fine.
M5 should then turn it off -
Yep, S1 doesn't work, but S1000 does.
For some reason, and I haven't done anything but add then remove the L1 you suggested earlier, using just M3 works now!
-
OK, so I really don't know what's going on here.
AS per my last post, M3 and M5 activated and deactivated the relay.
Since shutting down and restarting the Duet after lunch, M£ doesn't work again - even combining that with an S1000 or S5000 command.
This is very perplexing!
-
@nightowl999 can you post your full config.g?
Ian
-
Sure can, @droftarts - here you go...
; Configuration file for Duet 3 (firmware version 3.3)
; executed by the firmware on start-up
;
; generated by RepRapFirmware Configuration Tool v3.3.10 on Tue Apr 05 2022 16:17:08 GMT+0100 (British Summer Time); General preferences
M453 ; set machine to CNC mode
G90 ; send absolute coordinates...
M83 ; ...but relative extruder moves
M550 P"Weeble" ; set printer name; Network
M552 P0.0.0.0 S1 ; enable network and acquire dynamic address via DHCP
M586 P0 S1 ; enable HTTP
M586 P1 S0 ; disable FTP
M586 P2 S0 ; disable Telnet; Configure Drives
M569 P0.0 S0 ; physical drive 0.0 goes backwards - X axis
M569 P0.1 S1 ; physical drive 0.1 goes forwards - Y1 axis
M569 P0.2 S1 ; physical drive 0.2 goes forwards - Y2 axis
M569 P0.3 S0 ; physical drive 0.3 goes backwards - Z axis
M584 X0.0 Y0.1:0.2 Z0.3 ; set drive mapping; Configure Motors
M350 X16 Y16 Z16 I1 ; configure microstepping with interpolation
M92 X400 Y400 Z400 ; set steps per mm
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 Z 2400 ; set motor currents (mA) 80% of maximum (3000mA)
M84 S0 ; Disable motor idle current reduction; Axis Limits
M208 X0 Y0 Z0 S1 ; set axis minima
M208 X535 Y787 Z100 S0 ; set axis maxima
; M208 X0:535 Y0:787 Z0:100 S0 ; set axis minima and maxima; Endstops
M574 X1 S1 P"io8.in" ; configure switch-type (e.g. microswitch) endstop for low end on X via pin io8.in
M574 Y2 S1 P"io6.in+io3.in" ; configure switch-type (e.g. microswitch) and dual self-squaring high ends on Y1 via pin io6.in and on Y2 via pin io3.in
M574 Z2 S1 P"io2.in" ; configure switch-type (e.g. microswitch) endstop for high end on Z via pin io2.in; Z-Probe
; M558 P0 H5 F120 T6000 ; disable Z probe but set dive height, probe speed and travel speed
; M557 X15:215 Y15:195 S20 ; define mesh grid; Heaters
; Fans
; Makita and relay configuration
M950 R0 C"out1+out8" ; enable router relay on out8
M563 P0 S"Makita" R0 ; assign spindle 0 to tool 0 and name it Makita
T0 ; select tool 0; AMB spindle configuration
; M950 R0 C"xxx" L0:25000 Q1000 ; create spindle with index 0
; M563 P1 S"Spindle 1" R0 ; create tool 1 with spindle 0 and name it "Spindle 1"
; M453 ; set machine to CNC mode
; T1 ; select tool 1
; M3 S0
; M5 ; stop spindle; Custom settings are not defined
; Miscellaneous
M564 S1 H1 ; Disable jog commands when not homed
; M911 S10 R11 P"M913 X0 Y0 G91 M83 G1 Z3 E-5 F1000" ; set voltage thresholds and actions to run on power loss -
-
-
-
-
-
I've got a bit of an update on this, but I'm not sure if it's me, the firmware of the machine...
When I first start DWC up and send the "M3" command, this shows green in the Console, but the relay doesn't operate. However, if I send "M3 S5000" this also shows green and the relay does operates. Thereafter, entering just "M3" operates the relay. M5 deactivates the relay.
It sounds like I should be adding an M3 S5000 line somewhere in the config.g file, but wouldn't this operate the relay and, ultimately, the router? I suppose I could follow that with an "M5" line, but it doesn't sound good practice to me!Thanks
-
@nightowl999 From the M3 page:
M3 can be called without any parameters and will start the spindle of the current tool turning clockwise at the spindle RPM of that tool.
So I guess you should define a spindle speed for your tool using M568, then select the tool and then do M3 and it should start up.
Give it a try and let us know.