Duet 3 G31 'Heater Number'



  • My Duet 3 is throwing an error from G31 command stating

    'G31: Cannot set a temperature coefficcient without a valid heater number'

    This is for an induction probe that has temperature compensation it doesnt have and doesn't need a heater. I've defined a temperature sensor for it but I can't get past the above error.

    New parameter H selects the sensor number to use for temperature compensation when the C and S parameters are used

    This is my definition ....

    ; PINDA - Z-Probe
    M308 S2 P"temp2" Y"thermistor" T100000 B4725 C7.06e-8 ; configure sensor 2 as thermistor on pin temp2
    M558 P5 C"!io5.in" H2 F120 T6000                      ; set Z probe type to switch
    G31 P1 X-57 Y-7 Z2.0 C0.2 S40 H2                      ; set Z probe trigger, offset, trigger height, temperature compensation
    

    So I've defined the sensor as sensor 2 - S2 and allocated it as H2 in the G31 but I get the error. I also get the error if I attach it to a sensor that does have a heater as a test.

    I am really struggling with the syntax of these commands, I'm trying to follow examples in dozuki such as this one

    M558

    Example 2 - old code:
    
    M558 P7 H5 F120 T3000  ; Z probe connected to Z endstop input
    
    New code:
    
    M574 Z0 C"nil" ; no Z endstop switch, free up Z endstop input
    M558 P5 C"zstop" H5 F120 T3000  ; Z probe connected to Z endstop input
    

    But I have absolutely no clue why things like P5 or H5 are used or even why F and T are there, in the examples shown a P7 changes to a P5, H5 is always present - but it isn't clear to me where these values come from and what they represent and I think that's why I'm struggling.

    If you add to that the references are clearly relating to inputs on a Duet 2 whilst I'm working on a Duet 3 that uses totally different identification for pins this is getting frustrating.



  • https://duet3d.dozuki.com/Wiki/Gcode#Section_M558_in_RepRapFirmware_Num_3

    • M574 Z0 C"nil" should not be needed. As stated, it will free up a pin... that should not be assigned in your config.g. However, it does not hurt anything, so you can leave it while we work on more serious things.

    • M558 P5 = 5 means it is a normally closed switch, with digital filtering. Since you say you have a pinda, this should be OK.

    • M558 C"!io5.in" means the signal output of your Pinda should be to the pin labeled io5.in on the Duet board. Also, you can get GND and +5V for the pinda from the same connector.

    AND... I believe PINDA probes require a pull up resistor. So this should probably be "^!io5.in". The ^ activates a pull up.

    • M558 H2 is "dive height". The starting height from which it probes. Probably depending on how your probe is mechanically adjusted, this could be any of several numbers. 5 is probably a good place to start.

    • M558 F120 is Feedrate during a probe. Speed. mm/min.

    • M558 T3000 is speed of travel from probe point to probe point. mm/min.

    With the pull up and the 5mm dive, your M558 should be OK

    Regarding the G31 and the problem message: The documentation states "This facility [S and C] is deprecated and likely to be removed in a future version of RepRapFirmware.".

    Therefore, I'd remove the S, C and H from the G31.



  • Makes a little more sense - been at it for days so probably need to take a time out .... read so much I'm going word blind.

    On the G31 I was hoping to make use of the temperature compensation in the probe that I have - a BLTouch takes up too much space and I'd need to redesign my whole X Axis to accommodate so it isn't high on my preference list.

    If you consider my aluminium frame height of 540mm that I intend to enclose the expansion for a 10°C increase in temperature would be 0.11988mm, if I were to raise the temperature 20°C then the increase is 0.23976mm. Of course this occurs over the initial period of the print but I guess you could say that temperatures should be stabilised before you start - then no compensation is required.

    Trying to fix a problem that doesn't really exist I guess if the workflow changes a bit. I'll sleep on it ....


  • administrators

    @Garfield, your config looks OK to me so I don't know why you are getting that message. I will investigate it. I also need to change the error message to say "sensor" instead of "heater" in RRF3.

    I was intending to remove the temperature compensation facility because I didn't think anyone was using it; but when I became aware of Pinda probes with built in thermistors, I changed my mind.



  • @dc42 said in Duet 3 G31 'Heater Number':

    I was intending to remove the temperature compensation facility because I didn't think anyone was using it; but when I became aware of Pinda probes with built in thermistors, I changed my mind.

    Should we remove that statement from the dozuki?


  • administrators

    @Danal said in Duet 3 G31 'Heater Number':

    @dc42 said in Duet 3 G31 'Heater Number':

    I was intending to remove the temperature compensation facility because I didn't think anyone was using it; but when I became aware of Pinda probes with built in thermistors, I changed my mind.

    Should we remove that statement from the dozuki?

    I already have.


  • administrators

    @Garfield, first check that you are getting a sensible temperature reading on sensor 2. Name the sensor in the M308 command using an A parameter, then look in the Extras tab of DWC to see the reading.

    If you do get a good reading but you still get that error message, try adding a short delay between the M308 command that creates sensor 2 and the G31 command that uses it, for example by inserting G4 P500 command between those lines in config.g.

    [Edited]



  • I'm on it - 👍 I shall let you know.



  • Same error with the delay, the sensor is reading - showing 23.9 perhaps a tad high but I hadn't got as far as verifying calibrations but it is definitely reading (called it PINDA) .

    Pinda.png



  • This seems to be working now BUT ....

    It didn't work following a board reset, power cycling the Duet seems to have resolved, the error has disappeared.


  • administrators

    Thanks. I've rewritten that code in RRF 3.1 so that the delay should not be needed.



  • Well unfortunately no code change but the error is now back ... so I still get the error.

    Definition code as confirmation

    ; PINDA - Z-Probe
    M308 S2 P"temp2" Y"thermistor" T100000 A"PINDA" B4725 C7.06e-8 ; configure sensor 2 as thermistor on pin temp2
    G4 P500
    M558 P5 C"!io5.in" H2 F120 T6000                      ; set Z probe type to switch
    G31 P1 X-57 Y-7 Z2.0 C0.2 S40 H2                      ; set Z probe trigger, offset, trigger height, temperature compensation
    

    error has returned ...

    G31 Error.png



  • @Garfield how far did you get with setting up your pinda. I have the v2 installed currently along with the temperature readout. I am seeing huge changes in probe height depending on temperature. Not sure how to get it to actually compensate for the temperature it reads.



  • It is working pretty well now, took a while to dial in. The compensation is done in the G31 line, the C0.2 S40, which is the compensation I'm applying and the temperature I base it on, it seems mostly to work although I do occasionally see glitches in the matrix when it comes to the initial layer. If I use an Aluminium compensation (expansion coeefficient) it doesn't seem to work as well.

    The trigger height, not the Z2.0, but the actual height that triggers the probe does seem to vary regardless of temperature change, as yet I've found no solution. Basically if I run concecutive probes in the same spot the trigger height will change by a very tiny amount until you get to the 10th iteration or so and then it seems to stabilise.

    I know my bed movement is consistent and accurate as I have measured it with a dial test indicator.

    I now have it mostly working so I haven't pursued this much - suppose I should - but the pursuit of perfection is a never ending pursuit



  • @Garfield I am going to see if your c0.2 works for me. I can't find any details on how it is calculated as well as the s40. Right now I left out the C and S command and only home or probe the bed at room temperature. I am also using the the temperature of the pinda as reference. I wonder if it would be best to use the bed. I was hoping to be able to get it to home with at least some heat in the bed. If I try and run another print with the bed still warm I risk the nozzle hitting the bed.



  • The S40 is basically the temperature at which the Z height is correct with no 'adjustment' for temperature - as in the calibration point with no adjustment needed.

    I thought the co-efficient would be the co-efficient of expansion for the bulk of the materials - in my case mostly aluminium but that as a thermal expansion co-efficient of 0.000023 (m/m per Deg C), which I tried but it doesn't function as expected, I keep telling myself to inspect the code and see how the formula is applied but never got around to it.

    Basically what I tried was to set S to my room temp (21), calibrate Z, then heat my bed to 80 Deg C, I expected the trigger height to be reduced by 0.008 (ish) but the trigger height simply isn't repeatable enough to claim any accuracy - and the number so small that I stopped caring to be honest.

    I guess at some point I will circle around to it again.


Log in to reply