- Posts: 19311
- Thank you received: 4655
Temperature Control
8 years 7 months ago #107631
by andypugh
Replied by andypugh on topic Temperature Control
You can do something like this in G-code
linuxcnc.org/docs/2.7/html/gcode/o-code.html#ocode:looping
Code:
#1 = 220
O100 DO
M66 E0
G4 P1
O100 WHILE [ #5399 LT #1]
linuxcnc.org/docs/2.7/html/gcode/o-code.html#ocode:looping
Please Log in or Create an account to join the conversation.
8 years 7 months ago #107643
by rodw
Replied by rodw on topic Temperature Control
Just a thought.
Nothing moves in LinuxCNC until the spindle is at speed.
Consider using the motion.spindle-at-speed pin to tell the system when the print head is at temperature
It might be easier to use spindle S commands to set the temperature which you could read on motion.spindle-speed-out
Nothing moves in LinuxCNC until the spindle is at speed.
Consider using the motion.spindle-at-speed pin to tell the system when the print head is at temperature
It might be easier to use spindle S commands to set the temperature which you could read on motion.spindle-speed-out
Please Log in or Create an account to join the conversation.
8 years 7 months ago #107654
by B9T
Replied by B9T on topic Temperature Control
Both of those options look interesting, I'll have to experiment with them. Thank you
Please Log in or Create an account to join the conversation.
7 years 3 months ago #140169
by superman
Replied by superman on topic Temperature Control
Hi all,
maybe is a late reply to this topic but I havea similar problem. I am trying to adjust the temperature of my 3d printer extruder. For this I have LinuxCNC and the Mesa 7i76.
I have set the first 4 pins of the GPIO to analog inputs and I have plugged in my 100k thermocouple in one of them. Besides I have one digital output connected to a controller like this
In other thread I was recommended to use the lincurve command to convert the voltage to °C, so I did and it works great.
The problem comes now with the PID and PWM parameters. I know that setting up a PID takes time but I think there are some other parameters that must be first set like maxerror, maxoutput, pwm.freq, pwm.scale, etc.
I have set the PID output to PWM value and I know depending on "value" the duty cycle is calculated. One example problem that I have is I set pwm.scale and pid.maxoutput to 255 and this occurs:
- When warming up there is a moment when feedback is bigger than command (Overshoot) –> negative error!
Negative error leads to negative output –> pwm.value = 0 –> dc = 0 –> pin is closed
This is acceptable I guess, but:
- Although pin is closed, feedback from sensor is rising for a while until reached a certain value, so that the error reach negative maxoutput in the end (-255)
- The temperature starts decreasing and output value is bigger but still negative, so when the extruder should be warmed up it is not, and temperature continues decreasing until reaching a difference around 20°C
- By this time pid output is positive and extruder starts to warm up again
My .hal file looks like this:
maybe is a late reply to this topic but I havea similar problem. I am trying to adjust the temperature of my 3d printer extruder. For this I have LinuxCNC and the Mesa 7i76.
I have set the first 4 pins of the GPIO to analog inputs and I have plugged in my 100k thermocouple in one of them. Besides I have one digital output connected to a controller like this
In other thread I was recommended to use the lincurve command to convert the voltage to °C, so I did and it works great.
The problem comes now with the PID and PWM parameters. I know that setting up a PID takes time but I think there are some other parameters that must be first set like maxerror, maxoutput, pwm.freq, pwm.scale, etc.
I have set the PID output to PWM value and I know depending on "value" the duty cycle is calculated. One example problem that I have is I set pwm.scale and pid.maxoutput to 255 and this occurs:
- When warming up there is a moment when feedback is bigger than command (Overshoot) –> negative error!
Negative error leads to negative output –> pwm.value = 0 –> dc = 0 –> pin is closed
This is acceptable I guess, but:
- Although pin is closed, feedback from sensor is rising for a while until reached a certain value, so that the error reach negative maxoutput in the end (-255)
- The temperature starts decreasing and output value is bigger but still negative, so when the extruder should be warmed up it is not, and temperature continues decreasing until reaching a difference around 20°C
- By this time pid output is positive and extruder starts to warm up again
My .hal file looks like this:
Code:
loadrt lincurve count=1 personality=16
loadrt pwmgen output_type=0,0
addf lincurve.0 servo-thread
addf extruder-pid.do-pid-calcs servo-thread
addf pwmgen.make-pulses servo-thread
addf pwmgen.update servo-thread
# Link analog inputs from 7i76 card to lincurve.0 input
net extruder-sensor-raw lincurve.0.in <= hm2_5i25.0.7i76.0.0.analogin0
#*******************
# EXTRUDER SETTINGS
#*******************
setp lincurve.0.x-val-00 0.65
setp lincurve.0.y-val-00 0
setp lincurve.0.x-val-01 1.54
setp lincurve.0.y-val-01 20
setp lincurve.0.x-val-02 1.83
setp lincurve.0.y-val-02 25
setp lincurve.0.x-val-03 3.06
setp lincurve.0.y-val-03 40
setp lincurve.0.x-val-04 5.11
setp lincurve.0.y-val-04 60
setp lincurve.0.x-val-05 7.17
setp lincurve.0.y-val-05 80
setp lincurve.0.x-val-06 8.84
setp lincurve.0.y-val-06 100
setp lincurve.0.x-val-07 9.99
setp lincurve.0.y-val-07 120
setp lincurve.0.x-val-08 10.73
setp lincurve.0.y-val-08 140
setp lincurve.0.x-val-09 11.18
setp lincurve.0.y-val-09 160
setp lincurve.0.x-val-10 11.46
setp lincurve.0.y-val-10 180
setp lincurve.0.x-val-11 11.64
setp lincurve.0.y-val-11 200
setp lincurve.0.x-val-12 11.75
setp lincurve.0.y-val-12 220
setp lincurve.0.x-val-13 11.82
setp lincurve.0.y-val-13 240
setp lincurve.0.x-val-14 11.87
setp lincurve.0.y-val-14 260
setp lincurve.0.x-val-15 11.9
setp lincurve.0.y-val-15 280
setp extruder-pid.enable 1
setp extruder-pid.Pgain 1
setp extruder-pid.Igain 0
setp extruder-pid.Dgain 0
setp extruder-pid.maxoutput 255
setp extruder-pid.maxerror 255
setp extruder-pid.command 180
setp extruder-pid.FF0 0
setp extruder-pid.FF1 0
setp extruder-pid.FF2 0
setp pwmgen.0.enable 1
setp pwmgen.0.scale 255
setp pwmgen.0.pwm-freq 8
net extruder-sensor-interp lincurve.0.out => extruder-pid.feedback pyvcp.extruder-sensor
#*************************
# EXTRUDER VALUES PYVCP
#*************************
net extruder-sensor-raw => pyvcp.extruder-voltage
net extruder-pwm extruder-pid.output => pwmgen.0.value pyvcp.extruder-output
net extruder-error extruder-pid.error => pyvcp.extruder-error
net extruder-heater pwmgen.0.pwm => hm2_5i25.0.7i76.0.0.output-05
Please Log in or Create an account to join the conversation.
7 years 3 months ago #140284
by andypugh
Replied by andypugh on topic Temperature Control
You have a system where a negative PWM has no meaning (you don't have active cooling)
I am slightly surprised to find that there is no way to force the PID to be single-sided built in to the component.
So, the answer is probably to add a limit HAL component between the PID output and the PID input..
You might need to limit the I error in the PID to prevent wind-up in the I term when over setpoint.
I am slightly surprised to find that there is no way to force the PID to be single-sided built in to the component.
So, the answer is probably to add a limit HAL component between the PID output and the PID input..
You might need to limit the I error in the PID to prevent wind-up in the I term when over setpoint.
Please Log in or Create an account to join the conversation.
2 years 6 months ago #297461
by lkavan
Replied by lkavan on topic Temperature Control
Hallo,
I have similar problem with temperature control and I would like to ask if you have found a solution. I need to control selective soldering wave. I have used 7I96S to control machine and 7I87 to measure temperature with thermocouple to voltage amplifier. I have used hal components pid and pwmgen to control the heater. Well, it works somehow. But I have the same problem with negative output from pid. I think, limit between pid out and pwm in will not solve it. Have anybody found better solution? It seems there is still not pid component with positive output only. And the second problem - I would like to have a signal, that temperature is OK, to block the tin pump (connected as a spindle) when tin temperature is too low and it is not liquid.
Thanx a lot.
I have similar problem with temperature control and I would like to ask if you have found a solution. I need to control selective soldering wave. I have used 7I96S to control machine and 7I87 to measure temperature with thermocouple to voltage amplifier. I have used hal components pid and pwmgen to control the heater. Well, it works somehow. But I have the same problem with negative output from pid. I think, limit between pid out and pwm in will not solve it. Have anybody found better solution? It seems there is still not pid component with positive output only. And the second problem - I would like to have a signal, that temperature is OK, to block the tin pump (connected as a spindle) when tin temperature is too low and it is not liquid.
Thanx a lot.
Please Log in or Create an account to join the conversation.
Time to create page: 0.061 seconds