Config for Spindle or Laser
-
Hi there,
Moved my machine from an old RAMPS1.4 running Marlin to a Duet2 Wifi.
On the RAMPS1.4 I just ran a PWM out from one of my GPIO pins to the speed controller (with common ground to board) and that worked absolutely fine.
The plan here is to have two ports on the Z carriage allowing me to quickly swap between my spindle and laser. I'll have a macro that tells the system it's using the spindle (M453) and another to change that to laser instead (M452). In spindle mode it just controls "!fan1" to PWM control the speed controller. For laser I'm cheating and hooking the PWM signal pin up to "!fan0" but also the power input to the heated bed output, so will be disabled on startup and avoid the power blip issue associated with controlling a laser this way.I'm now currently trying to set up my config file to get M3 to work properly literally just for the spindle and having issues with it. I'm not seeing any example files around but have followed what I can find on the wiki. Still, I get no signal out on my spindle PWM pin (fan1).
I've removed all the laser stuff for now while I focus on getting my spindle to literally just turn on.; CNC and Laser M453 ; CNC mode M950 R0 C"!fan1" Q31372 L12000 ; configure spindle pins, fan1 is 5V PWM ; C = PWM pin, Q = frequenc(Hz), L = max speed M563 P0 S"Spindle" R0 ; assign spindle 0 to tool 0 T0 P0
I then tried selecting tool 0 and setting it to 12000RPM:
T0 M3 S12000
But no voltage change on "fan1" pin.
I had this exact board up and running my laser via fan0 previously and that was working fine, the code is minimally different, so I'm a bit lost as to what I'm doing (or not doing) wrong. Any advice really appreciated, thanks!
-
@SamanthaJaneyCake
Maybe it's related to theT0 P0
line? ==> Change tool, but don't run toolchange macros
Have you triedM3 P0 S12000
?...just shooting from the hip,,, it's early sunday morning
-
@SamanthaJaneyCake Not sure if you have seen the Duet docs on how best to connect a laser to the various duet boards: https://docs.duet3d.com/User_manual/Machine_configuration/Configuration_laser
Remember that fan (and heater outputs) are not simple gpio pins, they are actually a mosfet output that is switching the negative connection between "floating" and ground (rather than driving a positive and negative output like a gpio pin will do). This works fine for fans and heaters (which is what it is designed for), but may not work for some other devices. In particular you may not get a usable reading if you are trying to measure the output of the fan between the output pin and negative/ground. You may be able to make it usable by adding a pull up resistor to the mosfet output, or by using the output pin and a positive voltage - (like +5v).
-
@o_lampe early Sunday mornings indeed! No, I’ve tried variations with and without the T0 line, run M3 P0 S12000 and tried setting them up as GPIO and addressing them with M42. I eventually ended up taking all the tool connections off, sticking a small 5V fan on and sanity checking the pins actually work (they do), so challenge for today is to troubleshoot what I’m doing wrong
-
@gloomyandy morning, thanks for checking that with me. I read all the docs to do with laser control thoroughly when I was using this board for my laser cutter. At the time I’d ordered the expansion board to do it properly but the delivery guy marked it as “left in outhouse” (we don’t have an outhouse) and I never saw it again. In the end I connected it to fan0 as a 5V capable PWM and I’ve had almost perfect control over the laser prior to this setup.
The one issue I got was it powering up for a second at initialisation, I had figured that to solve that I could set bedheater as a GPIO and essentially use it as my power control for the laser. This in testing has worked fine but one of my tests today will be to decouple that and run the laser directly from the PSU like it was previously just to sanity check that setup that I know ought to work.For the spindle I could try feeding it a 5Vref from the fan0 connector to the speed controller, good shout. Laser I don’t have that option unfortunately.