CNC Solenoid Control for Air and Cooling Fluid
-
I ordered some 12v solenoids to control on/off for my air and cooling fluid sprayers on my CNC. What is the best way to set them up to open when a job starts and close when the job is finished?I'm running the latest CNC version of 3.3 on a Duet 3 Board. Using Fusion 360 Cam with Workbee post processor .nc
-
@shanian79 I have good experience with a TB6612 quad driver board. It can handle 12V/ 1.2A per channel and has freewheeling diodes to protect the hardware. The solenoids I tested got pretty hot when enabled at full voltage. It was better in my case to run a 24V solenoid at 12V, but of course it wil be weaker, too.
Optionally you can try to lower the voltage after the solenoid switched ON, with a high frequency PWM signal. That's all possible with RRF3.3 and (conditionals) in separate macros or toolchanging macros. -
@shanian79 what voltage are you running the Duet at? What current do the solenoids draw?
-
@shanian79 the usual option would be to use solenoids that are rated for your VIN voltage (so more likely 24V than 12V) and drive them from any of OUT1, OUT2 and OUT3. These outputs are rated at 5A and have built-in flyback diodes. OUT0 does not have a built-in flyback diode.
The OUT4/5/6/7/8/9 outputs also have built-in flyback diodes, but the maximum current is lower, and if you set those outputs to 12V then the maximum total current must not exceed 800mA.
-
@o_lampe 600ma @24V
-
@dc42 Thanks! My main question is how to set the solenoid outputs in the config to turn on when a job starts and shut off when its complete. I don't think I can modify the G-code created by Fusion360 to have starting and ending scripts like with FDM slicer software. I'm using the F360 Workbee post processor.
-
@t3p3tony 24V and draw is 600mah
-
@shanian79 said in CNC Solenoid Control for Air and Cooling Fluid:
My main question is how to set the solenoid outputs in the config to turn on when a job starts and shut off when its complete.
You could write a macro in daemon.g (or create daemon.g in the first place) which checks the "printer" status in the object model.
Depending if it's printing, paused, idle, busy you switch the solenoids accordingly with M42 command. -
@shanian79 said in CNC Solenoid Control for Air and Cooling Fluid:
@dc42 Thanks! My main question is how to set the solenoid outputs in the config to turn on when a job starts and shut off when its complete. I don't think I can modify the G-code created by Fusion360 to have starting and ending scripts like with FDM slicer software. I'm using the F360 Workbee post processor.
You can turn them on in the start.g file and turn them off in the stop.g file. Alternatively, if F360 has the capability to generate the usual CNC GCode commands for controlling coolant, then you can implement those GCode commands as macro files.
-
@dc42 Thanks! How exactly would I do that? Is there a link to a thread that explains how to do this?
-
@dc42 disregard....I figured it out
-
@dc42 How do I setup my config.g to allow the F360 M7 commands to control the solenoid I have on out1? I can't find any documentation for how to allocate M7 to a specific i/o pin.
-
@shanian79 first allocate the IO pin to be a gpio output using M950, in config.g e.g:
M950 P0 C"out2"
That creates an output on P0.
Then assuming F360 can send the M7, M9 commands for controlling coolant you can use the RRF ability to have a macro that matches a gcode to create M7.g and M9.g for example. in your /sys directory
;M7.g M42 P0 S1 ; turn on coolant
;M9.g M42 P0 S0: turn off coolant
M42 is used to control the state of the output pin https://duet3d.dozuki.com/Wiki/M42
If F360 can't do that because it can't generate the commands to control the coolant then you could add them to the start and stop macros:
https://duet3d.dozuki.com/Wiki/Macros#Section_Start_pause_stop_and_power_fail