Unsolved Create a virtual temp. sensor based on average of multiple?
-
Hi,
Since I have a very large bed I want to use multiple thermistors to more accurately measure the average temperature of the bed.
I have tried to make a macro that calculates the average, but I cannot find how I can set a new thermistor without a pin, but that uses a variable as output;
; average_temp.g ; Define thermistors on mainboard M308 S1 P"temp0" Y"thermistor" T100000 B3950 A"Thermistor1" M308 S2 P"temp1" Y"thermistor" T100000 B3950 A"Thermistor2" M308 S3 P"temp2" Y"thermistor" T100000 B3950 A"Thermistor3" ; Get the temperatures of S1 and S2 var temp1 = sensors.analog[1].lastReading var temp2 = sensors.analog[2].lastReading var temp3 = sensors.analog[3].lastReading ; Calculate the average temperature var avgTemp = (var.temp1 + var.temp2 + var.temp3) / 3 ; Update the virtual sensor S4 with the average temperature M308 S4 P"nil" Y"virtual" A"AverageTemp" V{var.avgTemp}
Is there a way to do this??
-
-
@SanderLPFRG The only way i can think of off the top of my head is to use daemon.g to update a global variable and then use BtnCmd to display the value
-
Thanks for the reply. I am not familiar with the BtnCmd and editing in daemon.g...
What exactly is this and how do I do it? -
@SanderLPFRG this is BtnCmd https://github.com/MintyTrebor/BtnCmd
It can be used to create your own interfaces for DWC so its only showing the information you're interested on one or multiple tabsdaemon.g is by default executed every 10 seconds although it could be made to run more quickly.
Theres some more information here https://docs.duet3d.com/en/User_manual/Tuning/Macros#daemong -
another option would be to wire the sensors in parallel and adjust the reference resistance accordingly (halving it if my memory of Ohm slaw is correct).
-
@oliof said in Create a virtual temp. sensor based on average of multiple?:
another option would be to wire the sensors in parallel and adjust the reference resistance accordingly (halving it if my memory of Ohm slaw is correct).
If you want to go that route - then maybe 4 thermistors. Two in series and then wire those two in parallel. That way the nominal resistance would be the same as just one.
I do have to ask though: what is your objective (in real day-to-day terms)?
With reasonable stable conditions (i.e. no breeze across the bed) you'd expect the bed to reach a steady-state and more-or-less have a consistent distribution of temperature.
Is the complexity you are considering providing an advantage compared with (say): Manually take the temperature at different parts of the bed and compare to the desired temperature - create a simple lookup table. Use that knowledge (moving forward) to infer the average temperature from the reported temp given by a single sensor.
-
Expanding on what @stuartofmt has said, it's unlikely that there would be a significant difference in temperatures if your bed conducts heat well (which it should). But in the unlikely event that there are significant differences, then cold spots would likely cause problems with first layer adhesion whereas hot spots are unlikely to cause any significant issues. Therefore, it would make more sense to use a single temperature sensor located at a known cold spot.