Set Temperature A and Temperature B via GCODE or API based on custom GCODE in slicer generated GCODE file? #286
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Is your feature request related to a problem? Please describe.
Not really a problem - just an idea for controlling the exhaust fan on my enclosure based on the bed temperature setting of my print (set higher exhaust fan thresholds for non-PLA materials).
Describe the solution you'd like
I would like to add if/then statements to my slicer-generated GCODE (I think I can figure out this part of the solution) based on the set bed temperature. I would then like these if-then statements to set the values of Temperature A and Temperature B in the "Link PWM to Temperature" section of my PWM output for controlling the speed of the exhaust fan. For example, if bed_temperature setting is less than 75C, I would set the Temp A value to 27C and Temp B to 30C (since this would mean that the material is PLA and I want to keep the enclosure cooler). For bed temp settings above 75C, I would likely set the Temp A and Temp B to much higher values to let the enclosure stay warm (probably 36C and 40C). I don't have a heater, so heat is provided passively by the bed and extruder heaters.
Describe alternatives you've considered
I looked at the options laid out in the GCODE control documentation, and thought maybe the Temperature/Humidity control section might apply, but I can't figure out what it is doing (since it is a separate output than my PWM fan control.
Additional context
I posted a comment on an existing closed issue thread, linked here:
https://github.com/vitormhenrique/OctoPrint-Enclosure/issues/9#issuecomment-581061778
UPDATE: I have worked out a way to identify the material used for the print with a tweak to the custom start GCODE and tested that it works (and placed a bit of placeholder GCODE in the exported code).
So I just need to figure out if there is something that I can put there that would accomplish the intended function.
Thanks!
Sorry for all the added comments, but I just want to clarify things a bit more...
I read through some more of the existing issues here on github and i see one that probably would accomplish what I want to do, but it would require a relay to control my fan rather than using PWM control (which requires no additional hardware).
This is the issue that looks like it would work:
https://github.com/vitormhenrique/OctoPrint-Enclosure/issues/164#
If I understand this right, I could configure a temperature control output pin as Output 2 as "Cooling", set a deadband of a few degrees C, and make it active low (since the relays typically use an active low signal).
Then I could put the following code in my custom start gcode:
`
{if first_layer_temperature[initial_tool] > 225} ;if this evaluates as TRUE, then the material is NOT PLA
ENC O2 W0 S40 ;could also set this higher and effectively cause the fan to remain off
{else}
ENC O2 W0 S30
{endif}`
First of all - is my assumption above correct?
Second, could something like this be implemented as a PWM Temp Control? I realize this would be a new bit of code, but it eliminates hardware (relay) if you have a 4-wire fan. It would effectively combine the PWM output option with the Temperature Control option. It could possibly implement the "temp a" and "temp b" by just taking the temperature setting command from the ENC GCODE command and adding subtracting a value from that set temperature. Then "duty a" and "duty b" could still be configured within the plugin configuration tab in the UI.
A PWM option is also nicer (in my opinion) than a relay because it is quieter and smoother - you don't get a fan cycling on/off all the time - it just varies in speed as needed to maintain temperature.
Finally, thanks for your efforts on this plugin - it is really quite impressive!
One more update...
I have confirmed that the temperature approach above works perfectly using a relay and the GCODE shown. This is now my plan B option, but I need to design an enclosure for the relay and 12v supply for the fan to make this work (it is basically breadboarded for now).
I would still like to know if the PWM approach described above is an option though!
UPDATE: I have implemented this fully now with a small enclosure for the relay board and all is working great.
Thanks again!