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

Storing temperature values to log file?

Scheduled Pinned Locked Moved
Using Duet Controllers
7
22
1.4k
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.
  • undefined
    whopping pochard
    last edited by 22 Feb 2021, 11:28

    Hi all! Is there any gcode available to store a temperature to a log file?

    I am working on a test rig for empirically testing hotends, and it would be handy to have some way to store temperature data at discrete time points using a macro. Is this possible?

    Thanks!

    undefined 1 Reply Last reply 22 Feb 2021, 12:37 Reply Quote 1
    • undefined
      engikeneer @whopping pochard
      last edited by 22 Feb 2021, 12:37

      +1 for this. Could also be useful for manually fine tuning PID parameters and better monitoring how stable the temperature is during printing.

      Guessing it might end up being a DWC plugin?

      E3D TC with D3Mini and Toolboards.
      Home-built CoreXY, Duet Wifi, Chimera direct drive, 2x BMG, 300x300x300 build volume
      i3 clone with a bunch of mods

      1 Reply Last reply Reply Quote 0
      • undefined
        jay_s_uk
        last edited by 22 Feb 2021, 12:42

        this could almost be done now using the daemon file and M28/M29.
        Only issue I see is that the file is either created or overwritten. If the M28 functionality could be expanded to include appending information to the end of the file, you should be sorted.
        Maybe one for @dc42 to consider?

        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
        • undefined
          whopping pochard
          last edited by 22 Feb 2021, 17:01

          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
          • undefined
            T3P3Tony administrators
            last edited by 22 Feb 2021, 21:59

            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

            undefined undefined 2 Replies Last reply 22 Feb 2021, 23:44 Reply Quote 2
            • undefined
              whopping pochard @T3P3Tony
              last edited by 22 Feb 2021, 23:44

              @T3P3Tony brilliant!! Thanks so much!

              1 Reply Last reply Reply Quote 0
              • undefined
                whopping pochard
                last edited by 18 Mar 2021, 03:10

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

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

                undefined 1 Reply Last reply 13 Jul 2022, 13:33 Reply Quote 2
                • undefined
                  Adamfilip @whopping pochard
                  last edited by 13 Jul 2022, 13:33

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

                  undefined 1 Reply Last reply 13 Jul 2022, 14:03 Reply Quote 0
                  • undefined
                    T3P3Tony administrators @Adamfilip
                    last edited by 13 Jul 2022, 14:03

                    @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

                    undefined 1 Reply Last reply 13 Jul 2022, 14:32 Reply Quote 1
                    • undefined
                      Adamfilip @T3P3Tony
                      last edited by 13 Jul 2022, 14:32

                      @t3p3tony Thank you

                      1 Reply Last reply Reply Quote 0
                      • undefined
                        stef @T3P3Tony
                        last edited by 5 Nov 2022, 18:57

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

                        undefined 1 Reply Last reply 6 Nov 2022, 15:14 Reply Quote 0
                        • undefined
                          T3P3Tony administrators @stef
                          last edited by 6 Nov 2022, 15:14

                          @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

                          undefined 1 Reply Last reply 8 Nov 2022, 03:19 Reply Quote 0
                          • undefined
                            stef @T3P3Tony
                            last edited by 8 Nov 2022, 03:19

                            @T3P3Tony Got it, thank you

                            undefined 1 Reply Last reply 28 Feb 2024, 08:48 Reply Quote 0
                            • undefined
                              Dizzwold @stef
                              last edited by 28 Feb 2024, 08:48

                              @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.

                              undefined 1 Reply Last reply 28 Feb 2024, 09:04 Reply Quote 0
                              • undefined
                                jay_s_uk @Dizzwold
                                last edited by 28 Feb 2024, 09:04

                                @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

                                undefined 1 Reply Last reply 28 Feb 2024, 09:29 Reply Quote 0
                                • undefined
                                  T3P3Tony administrators @jay_s_uk
                                  last edited by 28 Feb 2024, 09:29

                                  @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

                                  undefined 1 Reply Last reply 28 Feb 2024, 09:47 Reply Quote 1
                                  • undefined
                                    Dizzwold @T3P3Tony
                                    last edited by 28 Feb 2024, 09:47

                                    @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?

                                    undefined 1 Reply Last reply 28 Feb 2024, 09:48 Reply Quote 0
                                    • undefined
                                      jay_s_uk @Dizzwold
                                      last edited by 28 Feb 2024, 09:48

                                      @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

                                      undefined 1 Reply Last reply 28 Feb 2024, 11:01 Reply Quote 0
                                      • undefined
                                        Dizzwold @jay_s_uk
                                        last edited by 28 Feb 2024, 11:01

                                        @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

                                        undefined undefined 2 Replies Last reply 28 Feb 2024, 11:03 Reply Quote 0
                                        • undefined
                                          jay_s_uk @Dizzwold
                                          last edited by 28 Feb 2024, 11:03

                                          @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
                                          • First post
                                            Last post
                                          Unless otherwise noted, all forum content is licensed under CC-BY-SA