GPIO, Fan tacho and print cancelation
-
This is a two-in-one question.
- On the Connecting and Configuring fans-Page it is described how to connect the tacho-signal of a fan
Tacho wire (whatever wire is left, usually green or yellow): optionally, connect it to the cathode of a small signal diode (1N4148 should be OK) and connect the anode of the diode to pin PB6 on the expansion connector if the Duet WiFi/Ethernet, to provide a reading of the fan RPM.
The gcode documentation to M950 does not mention which ports are usable for the tacho signal.
May I only use
pb6
for the tacho signal of a fan, or are other (GPIO-)pins also usable? (I am using a Duet2Ethernet + Duex5)If
pb6
is the only usable pin for this, how can I feed the tacho-signal of more than one fan into the duet board?- A fan failure will most probably cause a failed print, maybe a cloggend heatsink and maybe more damage to the printer. What is the way to make the printer stop if a fan fails?
-
Since nobody seems to know an answer, I just tested whether GPIO pins are also suitable for the tacho signal.
Turns out, RRF accepts the command
M950 F2 C"duex.fan3+^duex.gp1"
but it does not work. Fan RPM just sticked to 0, even if fan was spinning.Actually there seems to be some current where it is not supposed to, because the fan was (slowly) turning, although fan was set to 0% power. When I pulled the diode, the fan stopped turning.
That means for me: I can at least have the fan speed for the heatsink-fan. So far, so good. But I still do not know how to make duet pause (or cancel) the print if the fan fails.
-
@justus2342 said in GPIO, Fan tacho and print cancelation:
May I only use
pb6
for the tacho signal of a fan, or are other (GPIO-)pins also usable? (I am using a Duet2Ethernet + Duex5)The GPIO pins on the DueX are not usable for tachos. I think you should be able to use duex.cs5 thru duex.cs8 on the daughter board connector, although I have not tested it. You will need to enable the pullup resistors, and use a diode between the tacho output and the pin. You should also be able to use any spare endstop inputs that you have on the main board but no need to enable pullup resistors in this case.
- A fan failure will most probably cause a failed print, maybe a cloggend heatsink and maybe more damage to the printer. What is the way to make the printer stop if a fan fails?
Currently, you would need to monitor the fan RPM in the damon.g file.
-
@dc42 said in GPIO, Fan tacho and print cancelation:
Currently, you would need to monitor the fan RPM in the damon.g file.
As far as I understood, I will need to use gcode meta commands, especially an
if
-statement and compare what the fan should do and what it is actually doing. TheM106 P1
(where 1 is the fan number in my case) should give me the answer to the question what the fan should do, but in the gcode documentation I could not find any command, that gives me information about the actual measurement, what the fan reports via its tacho-signal.Could you (or anyone around here) give me a hint, how to obtain the measured fan speed?
-
@justus2342
As DC42 has said you need to create/edit your daemon.g file and monitor the fan thereSomething like this would cancel if the fan was turned on, heater temp was over50, a job was running and the rpm was zero
if (fans[1].rpm <= 0) && (heat.heaters[1].current > 50) && (fans[1].requestedValue>0) && (job.file.fileName!=null) M0 ; stop G4 S5 ; only check every five seconds
Note this is untested and you need to ensure you're monitoring the correct fans & heaters
Also you may decide to pause rather than cancel, or even shut power off.
Daemon.g runs whether there a print active or not, so you need to allow for conditions outside that or you could get stuck in a loop. -
@OwenD
Thank you very much. I was not aware, that the RRF object model could be accessed this way. Your Post really helped!I tested your code and fixed it. That
requestedValue
seems to be always zero on thermostatic fans. So I replaced it byactualValue
, which should represent what RRF thinks that the fan should do. Furthermore it seems to me, that checking the heater temperature is not really necessary, since we can use theactualValue
-parameter from the fan.
What is the last check(job.file.fileName!=null)
for?if (fans[1].rpm <= 0) && (fans[1].actualValue>0) M118 S"fan should run but actually does not run" ; stop
(Yes I know, the
M118
has to be replaced by something useful. I will do so, when I finished testing and consider the result useful. Then I will post the working code as new reply to this thread.) -
@justus2342
There is a possibility that actualValue does not achieve the requestedValue which is why I chose that logic.
However @dc42 may have to confirm the details.(job.file.fileName!=null) will be true if a print job is loaded.
This stops the code from executing if the machine isn't printing.
As I said, without that there is a possibility (depending on your code) that you could send the system into an endless loop after a print finished and the fans shut down thermostatically.
This is also why I tested temperature. -
-