How do i Run a Macro at a given temperature
-
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?
-
@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.
-
@chrishamm
Thank thats exactly what i want to do.many thanks
mark -
-
Hi , how can i echo the reading of sensors.analog[3].lastReading in console for debugging?
-
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.
-
Can these conditional statement be in the config.g file ?
-
@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. -
@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 . -
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 ?
-
@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 -
Sorry ,
Duet3 + Mini5 wifi.
firmware 3.4.0i 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
-
@moth4017 said in How do i Run a Macro at a given temperature:
Sorry ,
Duet3 + Mini5 wifi.
firmware 3.4.0i 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 -
ok thanks
so back to the original requestM308 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? -
@moth4017
Go to settings and start the built in object model browser plugin.
You will then see the browser listed
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.