Storing temperature values to log file?
-
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!
-
+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?
-
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? -
Maybe M928? Could that also log temp pings? If so I could just log everything and parse after.
-
It should be fine to use the logging command;
https://duet3d.dozuki.com/Wiki/Gcode#Section_M929_Start_stop_event_logging_to_SD_cardYou 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.
-
@T3P3Tony brilliant!! Thanks so much!
-
Thanks for your help, everyone! We have automated heatbreak profiling! Woo!!
-
@T3P3Tony anyway to log temps when printer is sitting idle?, not running a gcode file?
-
@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.
-
@t3p3tony Thank you
-
@T3P3Tony Just to confirm both the M929 and M118 lines would be added to config.g, correct?
-
@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).
-
@T3P3Tony Got it, thank you
-
@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.
-
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
-
@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)
-
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
etcI don't even know if your need more than one to be fair, just asking?
-
@Dizzwold you can only have one daemon.g file
-
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 ?
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
-
@Dizzwold you can check which sensor is what in the object model using the object model plugin