More commands to control coolant than just M7 and M8

More
4 years 9 months ago #231459 by gerrg
Hello! So I just started playing with coolant stuff (air blast and mist coolant) and I'm trying to find a way to add different setups for coolants. currently i have my airblast set to turn on when M8 is sent, and mist to turn on when M7 is sent, but was thinking it might be handy to have more options, so maybe commands to turn on the following options as an example:

1) airblast on full
2) mist on full
3) airblast on/off in 1 a second pulses
4) mist on/off in 1 a second pulses

Is there an easy way to do this? my only though it user defined M codes (M100-M199 i think), but I haven't messed with any of those yet. Anyways, just figured i'd ask. Thanks!

Please Log in to join the conversation.

More
4 years 9 months ago #231460 by andypugh
You could set up a software PWM in HAL, enabled by the iocontrol.0.coolant-mist and iocontrol.0.coolant-flood pins.
Then set the duty cycle to either 100% or 50% (or something else) using either an user M-code, remapped-G-code or a G-code analogue output (M68).

linuxcnc.org/docs/2.8/html/gcode/m-code.html#mcode:m100-m199
linuxcnc.org/docs/2.8/html/remap/remap.html (I see that M80, M81 etc are available)
linuxcnc.org/docs/2.8/html/gcode/m-code.html#mcode:m68

I think that a remap would need to be configured on top of one of the others options (as a convenience feature) unless you wanted to use a Python remap.

I would suggest M100 P50 to set the duty cycle for both, then M7 and M8 for on and off, I think.

Please Log in to join the conversation.

More
4 years 9 months ago #231469 by BigJohnT
That would be easy to setup in ClassicLadder a 1 second on/off timer circuit.

linuxcnc.org/docs/2.8/html/ladder/ladder-examples.html
gnipsel.com/linuxcnc/ladder/index.html

JT

Please Log in to join the conversation.

More
4 years 9 months ago #231711 by gerrg
the hal PMW sounds like a nice way to do it. So far I have 2 files (a hal file, and an ngc file) that I think will do it. I believe i'd also add a remap line to my ini file like below:

ini file addition:

Code:
[RS274NGC] USER_M_PATH = /home/<username>/linuxcnc/configs/<config_name>/m_codes/


hal file:

Code:
#setup PWM generator loadrt pwmgen ouput_type=0 addf pwmgen.update servo-thread  addf pwmgen.make-pulses servo-thread ### ---mist signals start--- #configure PWM signals #set to a scale from 0 to 100, and over a 2 second period setp pwmgen.0.enable 1 setp pwmgen.0.scale 100 setp pwmgen.0.pwm-freq .5 setp pwmgen.0.value 55 #mist coolant stuff loadrt and2 count=2 addf or2.1   servo-thread addf and2.0 servo-thread #setup our three inputs (physical button, M7 command, and pwm signal) net mistOnButton <= hm2_7i76e.0.7i76.0.0.input-31  net mistOnCmd <= iocontrol.0.coolant-mist net mistOnPWM <= pwmgen.0.pwm #make M7 command act on PWM signal net mistOnCmd => and2.0.in0 net mistOnPWM => and2.0.in1 #make output signal based off PWM signal or button net mistOnButton => or2.1.in0 net and2.0.out => or2.1.in1 net mistOutOn <= or2.1.out net mistOutOn => hm2_7i76e.0.7i76.0.0.output-09 ### ---mist signals end---

and then my remapped M code command in a file called "M100", and added to the "m_codes" folder that i made in my config folder:
Code:
#!/bin/bash #Intended to be run as a remapped M100 command. Used to set the pmw value for the mist system pwmValue=$1 halcmd setp pwmgen.0.value $pwmValue exit 0

does that look like the right way to go about it? I'm not sure if i'm doing the custom M code correctly, or maybe getting that and the remap confused... anyways, that's my first stab at it. Let me know what you think. Thanks!

Please Log in to join the conversation.

More
4 years 9 months ago #231785 by gerrg
So I've almost got things working... I've got it setup so that my mist comes up with a 50% duty cycle using using the M7 code, (or when i push a physical button connected to an input), and I think I set the M100 code up correct, but I can't seem to get it to update the pwm duty cycle.

using the HAL meter I can see the starting value for the pwm (with a scale of 100) is set to 55, but when I use the command "M100 P20" for example, it doesn't change the pwm value, and actually the mist turns off for some reason.... any thoughts on what i might be doing wrong? Thanks again for your help!

Please Log in to join the conversation.

Time to create page: 0.087 seconds
Powered by Kunena Forum