Duet3D Logo

    Duet3D

    • Register
    • Login
    • Search
    • Categories
    • Tags
    • Documentation
    • Order

    How do i Run a Macro at a given temperature

    Gcode meta commands
    3
    14
    287
    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.
    • moth4017
      moth4017 last edited by

      Im looking to monitor the temperature of a stepper motor and then run a macro depending on the temperture , something like this (but this doesnt work)

      M308 S3 Y"Stepper-temp" A"Stepper Motor" ; configure sensor 3 as stepper motor temperature sensor
      M98 P"ItsToHotmacro.g", > T70 ;

      How do i link the Temperature sensor to a Macro?

      <

      chrishamm 1 Reply Last reply Reply Quote 0
      • chrishamm
        chrishamm administrators @moth4017 last edited by

        @moth4017 Do you mean you want to run the macro only if sensor #3 reports more than 70C? In that case

        M308 S3 Y"Stepper-temp" A"Stepper Motor" ; configure sensor 3 as stepper motor temperature sensor
        if sensors.analog[3].lastReading > 70
          M98 P"ItsToHotmacro.g"
        

        should do the trick.

        Duet software engineer

        moth4017 3 Replies Last reply Reply Quote 1
        • moth4017
          moth4017 @chrishamm last edited by

          @chrishamm
          Thank thats exactly what i want to do.

          many thanks
          mark

          <

          1 Reply Last reply Reply Quote 0
          • Moved from Tuning and tweaking by  T3P3Tony T3P3Tony 
          • moth4017
            moth4017 @chrishamm last edited by

            @chrishamm

            Hi , how can i echo the reading of sensors.analog[3].lastReading in console for debugging?

            <

            chrishamm 1 Reply Last reply Reply Quote 0
            • chrishamm
              chrishamm administrators @moth4017 last edited by

              @moth4017

              echo sensors.analog[3].lastReading
              

              Also see https://docs.duet3d.com/en/User_manual/Reference/Gcode_meta_commands and https://github.com/Duet3D/RepRapFirmware/wiki/Object-Model-Documentation or just enable the Object Model plugin in DWC if you want to browse the object model yourself.

              Duet software engineer

              1 Reply Last reply Reply Quote 0
              • moth4017
                moth4017 @chrishamm last edited by

                @chrishamm

                Can these conditional statement be in the config.g file ?

                <

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

                  @moth4017 said in How do i Run a Macro at a given temperature:

                  Can these conditional statement be in the config.g file ?

                  You would need to put it in daemon.g so that the condition is continually checked.
                  You would need to include code or a method to stop in running multiple times most likely.

                  What is the macro going to do?
                  If it's simply to start a fan then just set the fan up as thematically controlled in M950 .

                  Another method might be to set up a thermostatically controlled fan output but connect a relay or mosfet to it.
                  The output of the relay could be connected to a GPIO pin.
                  You would then set up a trigger macro using M581 which would run when the temp reached the target temp.

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

                    @owend
                    Hi im monitoring some of the stepper motors and want to protect them if they get to hot, also monitorng the weight of the spool so want to put up warning when the filament is getting low, ideally would like a way to send an email/txt message .

                    <

                    1 Reply Last reply Reply Quote 0
                    • moth4017
                      moth4017 last edited by

                      @owend

                      Hi im trying to work out how
                      echo "Voltage OK : " ^ boards[0].vIn.current ;

                      how does boards[0] relate to the hardware as it is on "pin 12" labeled ADC1_ANi7 /PB05 on the Micro.

                      is there a list somewhere ?

                      <

                      1 Reply Last reply Reply Quote 0
                      • OwenD
                        OwenD last edited by

                        @moth4017
                        You keep asking questions without giving any sort of context
                        This makes it very hard to provide any meaningful help.
                        Also his question seems at a large tangent to your original question.
                        Did you get that working?

                        It's best to provide the following when you're asking questions...,
                        What hardware?
                        Which version firmware?
                        What have you tried so far?
                        What did you expect to happen?
                        What actually happened?

                        boards[nn]. refers to an array referencing each connected board.
                        boards[0].vIn.current refers to the voltage being supplied to the main board by the power supply at the current moment.
                        I don't know what pin that value is read from.
                        The pins list is hardware dependent.
                        https://docs.duet3d.com/User_manual/RepRapFirmware/Migration_RRF2_to_RRF3#pin-names

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

                          @owend

                          Sorry ,
                          Duet3 + Mini5 wifi.
                          firmware 3.4.0

                          i was using the voltage just to get it working and display in the console and Yes i got the voltage readings to display in the console correctly.

                          Ok so i use the pin names not pin numbers on the Micro .
                          eg IO -IN3 would be "echo "Voltage : " ^ boards[0].IO3.in.current"

                          many thanks for help mark

                          <

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

                            @moth4017 said in How do i Run a Macro at a given temperature:

                            @owend

                            Sorry ,
                            Duet3 + Mini5 wifi.
                            firmware 3.4.0

                            i was using the voltage just to get it working and display in the console and Yes i got the voltage readings to display in the console correctly.

                            Ok so i use the pin names not pin numbers on the Micro .
                            eg IO -IN3 would be "echo "Voltage : " ^ boards[0].IO3.in.current"

                            No, you misunderstand how the object model works.
                            You can only access what has been exposed in the object model.
                            You can use the object model plugin to view what is available or the list here
                            https://github.com/Duet3D/RepRapFirmware/wiki/Object-Model-Documentation

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

                              @owend

                              ok thanks
                              so back to the original request

                              M308 S3 Y"Stepper-temp" A"Stepper Motor" ; configure sensor 3 as stepper motor temperature sensor
                              if sensors.analog[3].lastReading > 70
                              M98 P"ItsToHotmacro.g"

                              is the S3 after M308 referenced [3] in sensors.analog[3].lastReading ?

                              or
                              should it be
                              sensors.analog[temp2].lastReading as temp2 is the RRF3 Pin name?

                              <

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

                                @moth4017
                                Go to settings and start the built in object model browser plugin.
                                You will then see the browser listed
                                Capture.PNG
                                This will let you see the object model and drill down to get the info you need.
                                If you select a value, the correct path can be copied to the clipboard using the copy button at top right.
                                Screenshot 2022-04-03 105251.png

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