Duet3D Logo Duet3D
    • Tags
    • Documentation
    • Order
    • Register
    • Login

    Pressured air cooling controlled with servo and ball valve

    Scheduled Pinned Locked Moved
    General Discussion
    11
    61
    3.7k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • o_lampeundefined
      o_lampe
      last edited by

      You have written servoout and also servo_out.

      MaxGyverundefined OwenDundefined 2 Replies Last reply Reply Quote 0
      • MaxGyverundefined
        MaxGyver @o_lampe
        last edited by

        @o_lampe said in Pressured air cooling controlled with servo and ball valve:

        You have written servoout and also servo_out.

        Nope, this did not cause the error... 😕

        "Error: Failed to read code from macro config.g: Failed to parse major G-code number (lobal) in line 4"

        ;Valve Control
        ; Set up scaling variables {(output_end - output_start) / (input_end - input_start)}
        M950 S1 C"io4.out"  ; assign GPIO port 1 to heater4 on expansion connector, servo mode
        global InputStart = 0 
        global InputEnd = 1
        global OutputStart = 0
        global OutputEnd = 90
        global ScaleFactor = (global.OutputEnd - global.OutputStart) / (global.InputEnd - global.InputStart) ; no need for the math in this instance but it makes it clear how you arrive at the value.
        global ServoOut = floor(global.ScaleFactor * (fans[0].actualValue - global.InputStart) + 0.5) + global.OutputStart ; calculate position required on sevo - use floor() to apply rounding
        M280 P1 S{global.ServoOut} ; adjust valve position to reflect fan speed.
        
        OwenDundefined o_lampeundefined 2 Replies Last reply Reply Quote 0
        • OwenDundefined
          OwenD @MaxGyver
          last edited by

          @maxgyver
          @maxgyver
          I'm assuming you are running the correct versions on DWC, etc etc
          We are both running RRF3.3b2 and it works for me.
          I'm on a Duet 2 wifi.
          I don't have a duet 3, but I suspect it's actually coming from your M950 command on the previous line.
          Either that are it's one of this SBC specific issues.

          What happens when you run those commands individually from the console command line?

          MaxGyverundefined 1 Reply Last reply Reply Quote 0
          • OwenDundefined
            OwenD @o_lampe
            last edited by

            @o_lampe
            That was actually my error in the original.

            1 Reply Last reply Reply Quote 0
            • o_lampeundefined
              o_lampe @MaxGyver
              last edited by

              @maxgyver said in Pressured air cooling controlled with servo and ball valve:

              G-code number (lobal)

              Your parser believes global is the beginning of a move command and it can't parse "lobal" as number (0,1,2,3,4 expected)
              I'm with @OwenD it might be related to SBC issues.

              1 Reply Last reply Reply Quote 0
              • MaxGyverundefined
                MaxGyver @OwenD
                last edited by

                @owend said in Pressured air cooling controlled with servo and ball valve:

                (...)I suspect it's actually coming from your M950 command on the previous line.
                Either that are it's one of this SBC specific issues.

                It's not the M950 command (I have checked by commenting out this line)

                @owend said in Pressured air cooling controlled with servo and ball valve:

                What happens when you run those commands individually from the console command line?

                I get the same error message.

                -Max

                MaxGyverundefined 1 Reply Last reply Reply Quote 0
                • MaxGyverundefined
                  MaxGyver @MaxGyver
                  last edited by

                  @maxgyver

                  After upgrading to Beta3.3 the error message has changed to the following:

                  Error.PNG

                  the code in config.g:

                  ;Valve Control
                  ; Set up scaling variables {(output_end - output_start) / (input_end - input_start)}
                  M950 S1 C"io4.out"  ; assign GPIO port 1 to heater4 on expansion connector, servo mode
                  global InputStart = 0 
                  global InputEnd = 1
                  global OutputStart = 0
                  global OutputEnd = 90
                  global ScaleFactor = (global.OutputEnd - global.OutputStart) / (global.InputEnd - global.InputStart) ; no need for the math in this instance but it makes it clear how you arrive at the value.
                  global ServoOut = floor(global.ScaleFactor * (fans[0].actualValue - global.InputStart) + 0.5) + global.OutputStart ; calculate position required on sevo - use floor() to apply rounding
                  M280 P1 S{global.ServoOut} ; adjust valve position to reflect fan speed.
                  

                  and deamon.g

                  set global.ServoOut = floor((global.ScaleFactor * (fans[0].actualValue - global.InputStart)) + 0.5) + global.OutputStart ; calculate position required - use floor() to apply rounding to nearest whole number
                  ;echo {global.ServoOut}
                  M280 P1 S{global.ServoOut} ; adjust valve attached to servo on P1 to reflect scaled fan speed. 
                  

                  -Max

                  OwenDundefined 1 Reply Last reply Reply Quote 0
                  • OwenDundefined
                    OwenD @MaxGyver
                    last edited by OwenD

                    @maxgyver
                    Try removing all the spaces around the variable names and in the equations
                    I'm pretty sure I read another post where that was an issue on SBC
                    There is also a 3.3RC1+2 binary you might try.

                    Also note that daemon.g only runs once every 10 seconds now, so there's going to be a delay between setting the fan and the servo reacting.
                    Moot until you get it working again of course.

                    MaxGyverundefined 1 Reply Last reply Reply Quote 0
                    • MaxGyverundefined
                      MaxGyver @OwenD
                      last edited by

                      @owend said in Pressured air cooling controlled with servo and ball valve:

                      Also note that daemon.g only runs once every 10 seconds now, so there's going to be a delay between setting the fan and the servo reacting.

                      I recon this would make this solution almost useless considering the motion of the servo itself introduces another small delay.

                      I will submit a Firmware Feature request to add Stepper/RC-Servo Support for M106

                      -Max

                      1 Reply Last reply Reply Quote 0
                      • dc42undefined
                        dc42 administrators @jay_s_uk
                        last edited by

                        @jay_s_uk said in Pressured air cooling controlled with servo and ball valve:

                        @MaxGyver can you not use the L and X commands of M106 to do that?

                        Lnnn Set the minimum fan speed (0 to 255 or 0.0 to 1.0) when a non-zero fan speed is requested.
                        Xnnn Set the maximum fan speed (0 to 255 or 0.0 to 1.0) when a non-zero fan speed is requested. (supported in RRF >= 2.02)
                        

                        Yes that should work.

                        Duet WiFi hardware designer and firmware engineer
                        Please do not ask me for Duet support via PM or email, use the forum
                        http://www.escher3d.com, https://miscsolutions.wordpress.com

                        MaxGyverundefined 1 Reply Last reply Reply Quote 0
                        • MaxGyverundefined
                          MaxGyver @dc42
                          last edited by

                          @dc42

                          I have already tried using the L and X factor of M106 as suggested by @Phaedrux and @jay_s_uk in this thread.

                          @maxgyver said in Pressured air cooling controlled with servo and ball valve:

                          @Phaedrux

                          I have already tried this. The L and X factor of M106 will not scale the range but rather set the minimum and maximum fan speed.

                          With this configuration the valve will stay in the same slightly open position at a fans peed of 5-80%. So I still only have real control over the flow from 80-90% fan speed.

                          I did play around with different values for L and X again just yesterday without success.
                          To my understanding the L and X factor only define the start and endpoint of the usable range between S=0-255.
                          But in order to work with a servo I need to scale every point in between S=0-90 (0°-90° servo angle) to have linear control. Or am I missing something here?

                          -Max

                          OwenDundefined 1 Reply Last reply Reply Quote 0
                          • OwenDundefined
                            OwenD @MaxGyver
                            last edited by

                            @maxgyver
                            I guess as a work around (for print files) you could use a post processing script in your slicer to replace all M106 to a macro
                            So if you replace M106 S125 with
                            M98 P"0:/macros/valve control.g" S125
                            Then in your macro do all your math and set valve
                            You can get the speeds using param(S)
                            e.g
                            Var Speed=param(S)

                            1 Reply Last reply Reply Quote 0
                            • First post
                              Last post
                            Unless otherwise noted, all forum content is licensed under CC-BY-SA