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

    Storing temperature values to log file?

    Scheduled Pinned Locked Moved
    Using Duet Controllers
    7
    22
    1.5k
    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.
    • whopping pochardundefined
      whopping pochard
      last edited by

      Maybe M928? Could that also log temp pings? If so I could just log everything and parse after.

      1 Reply Last reply Reply Quote 0
      • T3P3Tonyundefined
        T3P3Tony administrators
        last edited by

        It should be fine to use the logging command;
        https://duet3d.dozuki.com/Wiki/Gcode#Section_M929_Start_stop_event_logging_to_SD_card

        You can have it set to log as little as possible (while still logging)

        M929 P"mytemplog.txt" S1 ; start logging and only log warnings by default
        

        That file is created in /sys, you can use the full path to put it somewhere else, e.g. in your gcodes directory if that's easier (0:/gcodes/mytemplog.txt)

        Then send the temperatures using the M118 command set to write to the log when its only a level S1

        https://duet3d.dozuki.com/Wiki/Gcode#Section_M118_Send_Message_to_Specific_Target

        M118 S{"Temp 1: " ^ sensors.analog[1].lastReading ^ " C"} L1
        

        Obviously format that to work best with whatever you will be using to parse the file.

        www.duet3d.com

        whopping pochardundefined stefundefined 2 Replies Last reply Reply Quote 2
        • whopping pochardundefined
          whopping pochard @T3P3Tony
          last edited by

          @T3P3Tony brilliant!! Thanks so much!

          1 Reply Last reply Reply Quote 0
          • whopping pochardundefined
            whopping pochard
            last edited by

            Thanks for your help, everyone! We have automated heatbreak profiling! Woo!!

            Screen Shot 2021-03-17 at 11.07.43 PM.png

            Adamfilipundefined 1 Reply Last reply Reply Quote 2
            • Adamfilipundefined
              Adamfilip @whopping pochard
              last edited by

              @T3P3Tony anyway to log temps when printer is sitting idle?, not running a gcode file?

              T3P3Tonyundefined 1 Reply Last reply Reply Quote 0
              • T3P3Tonyundefined
                T3P3Tony administrators @Adamfilip
                last edited by

                @adamfilip you could use daemon.g with a while loop to log in the same manner as above. make sure you have a G4 P500 each time the loop goes round to hand control back to the main process.

                www.duet3d.com

                Adamfilipundefined 1 Reply Last reply Reply Quote 1
                • Adamfilipundefined
                  Adamfilip @T3P3Tony
                  last edited by

                  @t3p3tony Thank you

                  1 Reply Last reply Reply Quote 0
                  • stefundefined
                    stef @T3P3Tony
                    last edited by

                    @T3P3Tony Just to confirm both the M929 and M118 lines would be added to config.g, correct?

                    T3P3Tonyundefined 1 Reply Last reply Reply Quote 0
                    • T3P3Tonyundefined
                      T3P3Tony administrators @stef
                      last edited by

                      @stef M929 sets up logging and that makes sense to be in config.g assuming you want to log the whole time the printer is on.

                      M118 is the command to write explicitly to the log so that needs to be wherever you want to take the measutrement and insert into the log.

                      If you want it to happen every <n> seconds no matter what else is happening you can use deamon.g (with a while loop with G4 P500 or longer in between to ensure control is passed back).

                      www.duet3d.com

                      stefundefined 1 Reply Last reply Reply Quote 0
                      • stefundefined
                        stef @T3P3Tony
                        last edited by

                        @T3P3Tony Got it, thank you

                        Dizzwoldundefined 1 Reply Last reply Reply Quote 0
                        • Dizzwoldundefined
                          Dizzwold @stef
                          last edited by

                          @stef @T3P3Tony @Adamfilip @engikeneer @jay_s_uk @whopping-pochard

                          M122
                          === Diagnostics ===
                          RepRapFirmware for Duet 3 MB6HC version 3.4.6 (2023-07-21 14:11:38) running on Duet 3 MB6HC v1.01 (standalone mode)
                          Board ID: 0JD2M-999AL-D25SW-6J9D0-3SD6M-9PY70
                          Used output buffers: 1 of 40 (20 max)

                          Hi Guys,

                          I appreciate this is an old thread and I'd like to do something similar, but not sure I fully understand it.

                          What I would like to do is take temperature readings every 20 seconds (or so), from a thermistor on (temp1), for the duration of a print and save them to a log/file or something like the heightmap.csv to look over at a later date. I only really need the temperatures.

                          I've tried putting both the suggested lines above in Config.g but all that seamed to do when I clicked save was immediately creat the file in /sys then start then stop a log.

                          Can I ask for your advice of what should actually go where or if there's another method to use?

                          Dizzwold.

                          jay_s_ukundefined 1 Reply Last reply Reply Quote 0
                          • jay_s_ukundefined
                            jay_s_uk @Dizzwold
                            last edited by

                            @Dizzwold

                            M929 P"mytemplog.txt" S1 ; start logging and only log warnings by default
                            

                            would go in config.g

                            something like

                            while true && state.status == "processing"
                                M118 S{"Temp 1: " ^ sensors.analog[1].lastReading ^ " C"} L1
                                G4 S20
                            

                            would go in daemon.g

                            That would only log the temperature while printing a file

                            Alternatively, BtnCMD allows you to setup a graph and export whatever it reports to a log file

                            Owns various duet boards and is the main wiki maintainer for the Teamgloomy LPC/STM32 port of RRF. Assume I'm running whatever the latest beta/stable build is

                            T3P3Tonyundefined 1 Reply Last reply Reply Quote 0
                            • T3P3Tonyundefined
                              T3P3Tony administrators @jay_s_uk
                              last edited by

                              @Dizzwold as @jay_s_uk outlines uses the built in logging function. Alternatively if you want just the temperatures and never want any other warnings or other things that could be logged you can echo to a file from daemon.g in the same way:

                              https://docs.duet3d.com/en/User_manual/Reference/Gcode_meta_commands#echo-command

                              while true && state.status == "processing"
                                  echo >>"templog.csv" {"Temp 1: " ^ sensors.analog[1].lastReading^ " C"} L1
                                  G4 S20
                              

                              (Or similar, not checked)

                              www.duet3d.com

                              Dizzwoldundefined 1 Reply Last reply Reply Quote 1
                              • Dizzwoldundefined
                                Dizzwold @T3P3Tony
                                last edited by

                                @T3P3Tony @jay_s_uk

                                Hi Guys,

                                Thank you for your direction I'll give them a try.

                                I'd already promised previously to look into the BtnCMD, but I really just haven't had the time. This is actually going to be my first print with the Cast Toolplate I've been on about for the last 2 if not 3 years.

                                Daemon.g;
                                I know very little about this, but with a quick goggle I understand it's to do with running a clock from the MCU in the background.
                                So this has to be called "daemon.g in the /sys directory?
                                Can you have more than one daemon.g in the /sys directory as I've seen it mentioned before with something else I read, and would you just number them?
                                daemon1.g
                                daemon2.g
                                etc

                                I don't even know if your need more than one to be fair, just asking?

                                jay_s_ukundefined 1 Reply Last reply Reply Quote 0
                                • jay_s_ukundefined
                                  jay_s_uk @Dizzwold
                                  last edited by

                                  @Dizzwold you can only have one daemon.g file

                                  Owns various duet boards and is the main wiki maintainer for the Teamgloomy LPC/STM32 port of RRF. Assume I'm running whatever the latest beta/stable build is

                                  Dizzwoldundefined 1 Reply Last reply Reply Quote 0
                                  • Dizzwoldundefined
                                    Dizzwold @jay_s_uk
                                    last edited by

                                    @jay_s_uk

                                    Okay, thank you.

                                    Hmm, It's working but seems to be reading the wrong sensor. Temp1, which is what it is reading and documenting, is this T1 in my config.g?
                                    It's basically reading the nozzle temp in the log at around 203˚C. I have the sensor I want to read in-between the fan and the heatsink on my Matrix extruder, "(he chamber heater below). In the graph it shows as around 40 ish ˚C ?
                                    Screen Shot 2024-02-28 at 10.50.52.png
                                    Screen Shot 2024-02-28 at 10.50.30.png

                                    I have the following in my config.g on my 6HC board;

                                    ; Heaters
                                    M308 S0 P"temp0" Y"thermistor" T100000 B4138       ; configure sensor 0 as thermistor on pin temp0
                                    M950 H0 C"out0" T0                                 ; create bed heater output on out0 and map it to sensor 0
                                    M307 H0 R0.187 K0.192:0.000 D1.89 E1.35 S1.00 B0   ; disable bang-bang mode for the bed heater and set PWM limit
                                    M140 H0                                            ; map heated bed to heater 0
                                    M143 H0 S120                                       ; set temperature limit for heater 0 to 120C
                                    M308 S1 P"121.temp0" Y"thermistor" T100000 B4138       ; configure sensor 1 as thermistor on pin temp1
                                    M950 H1 C"121.out0" T1                                 ; create nozzle heater output on out1 and map it to sensor 1
                                    M307 H1 R2.498 K0.275:0.349 D6.79 E1.35 S1.00 B0 V24.0  ; disable bang-bang mode for heater  and set PWM limit
                                    M143 H1 S280                                       ; set temperature limit for heater 1 to 280C
                                    
                                    ; Sensors
                                    M308 S2 P"temp1" Y"thermistor" A"Chamber Temp"T100000 B4138
                                    

                                    The very bottom "sensor" temp1 chamber heater is what I'd like to read.

                                    But hey, I'm printing again and with my cast toolplate with pei sheet and mains heater. Hip-Hip-Hooray
                                    It is printing so sweet.
                                    It's not fully trammed yet, as I can't afford the new framework yet to enable doing so, but it's the best I can do for now.
                                    ![Screen Shot 2024-02-28 at 11.00.20.png](Request Entity Too Large)

                                    Dizzwold

                                    jay_s_ukundefined T3P3Tonyundefined 2 Replies Last reply Reply Quote 0
                                    • jay_s_ukundefined
                                      jay_s_uk @Dizzwold
                                      last edited by

                                      @Dizzwold you can check which sensor is what in the object model using the object model plugin

                                      Owns various duet boards and is the main wiki maintainer for the Teamgloomy LPC/STM32 port of RRF. Assume I'm running whatever the latest beta/stable build is

                                      1 Reply Last reply Reply Quote 0
                                      • T3P3Tonyundefined
                                        T3P3Tony administrators @Dizzwold
                                        last edited by

                                        @Dizzwold said in Storing temperature values to log file?:

                                        M308 S2 P"temp1" Y"thermistor" A"Chamber Temp"T100000 B4138

                                        thats temperature sensor number 2

                                        www.duet3d.com

                                        Dizzwoldundefined 1 Reply Last reply Reply Quote 0
                                        • Dizzwoldundefined
                                          Dizzwold @T3P3Tony
                                          last edited by Dizzwold

                                          @T3P3Tony @jay_s_uk

                                          Hi Guys,

                                          Thank you for that.

                                          Ah, okay, so I'm taking the information for the sensor from the S2 part of the config.g rather than the actual board input connection "Temp1".
                                          Edit.
                                          Which I beleieve means changing;
                                          M118 S{"Message to Show: " ^ sensors.analog[1].lastReading ^ " C"} L1
                                          to
                                          M118 S{"Temp 2: " ^ sensors.analog[2].lastReading ^ " C"} L1
                                          Thank you again for your help and advice.

                                          Dizzwold.

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