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

    GPIO, Fan tacho and print cancelation

    Scheduled Pinned Locked Moved Solved
    Duet Hardware and wiring
    tacho gpio fan speed fan signal pwm input
    3
    7
    783
    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.
    • justus2342undefined
      justus2342
      last edited by

      This is a two-in-one question.

      1. 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 pb6is the only usable pin for this, how can I feed the tacho-signal of more than one fan into the duet board?

      1. 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?

      Tevo Little Monster (Duet2, Smart Effector, lin Rails, Magb. Arms)
      Anycubic Delta Linear Plus (Duet2, Smart Effector, Magb. Arms)
      Two Trees Sapphire Pro (MKS Robin, Marlin 2.x, D. Extruder)

      dc42undefined 1 Reply Last reply Reply Quote 0
      • justus2342undefined
        justus2342
        last edited by

        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.

        Tevo Little Monster (Duet2, Smart Effector, lin Rails, Magb. Arms)
        Anycubic Delta Linear Plus (Duet2, Smart Effector, Magb. Arms)
        Two Trees Sapphire Pro (MKS Robin, Marlin 2.x, D. Extruder)

        1 Reply Last reply Reply Quote 0
        • dc42undefined
          dc42 administrators @justus2342
          last edited by dc42

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

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

          Duet WiFi hardware designer and firmware engineer
          Please do not ask me for Duet support via PM or email, use the forum
          http://www.escher3d.com, https://miscsolutions.wordpress.com

          justus2342undefined 1 Reply Last reply Reply Quote 0
          • justus2342undefined
            justus2342 @dc42
            last edited by

            @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. The M106 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?

            Tevo Little Monster (Duet2, Smart Effector, lin Rails, Magb. Arms)
            Anycubic Delta Linear Plus (Duet2, Smart Effector, Magb. Arms)
            Two Trees Sapphire Pro (MKS Robin, Marlin 2.x, D. Extruder)

            OwenDundefined 1 Reply Last reply Reply Quote 0
            • OwenDundefined
              OwenD @justus2342
              last edited by OwenD

              @justus2342
              As DC42 has said you need to create/edit your daemon.g file and monitor the fan there

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

              justus2342undefined 1 Reply Last reply Reply Quote 2
              • justus2342undefined
                justus2342 @OwenD
                last edited by

                @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 by actualValue, 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 the actualValue-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.)

                Tevo Little Monster (Duet2, Smart Effector, lin Rails, Magb. Arms)
                Anycubic Delta Linear Plus (Duet2, Smart Effector, Magb. Arms)
                Two Trees Sapphire Pro (MKS Robin, Marlin 2.x, D. Extruder)

                OwenDundefined 1 Reply Last reply Reply Quote 0
                • OwenDundefined
                  OwenD @justus2342
                  last edited by

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

                  1 Reply Last reply Reply Quote 0
                  • justus2342undefined justus2342 has marked this topic as solved
                  • T3P3Tonyundefined T3P3Tony referenced this topic
                  • First post
                    Last post
                  Unless otherwise noted, all forum content is licensed under CC-BY-SA