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

    Controlling AC Aquarium pump

    Scheduled Pinned Locked Moved
    Duet Hardware and wiring
    4
    21
    886
    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.
    • uk25undefined
      uk25 @A Former User
      last edited by

      @bearer said in Controlling AC Aquarium pump:

      If the goal is to adjust the speed based on a fan setting when printing then something like pulseIn() will suffice to interface the Duet and Arduino.

      I forgot to ask about wiring. Is it correct that I have to connect one of VFAN pins to one of the Digital Arduino pins, and then connect +5v and GND pins from Expansion Duet header with the same on Arduino to power it?

      1 Reply Last reply Reply Quote 0
      • A Former User?
        A Former User
        last edited by

        should probably connect -Fan to one of the pins that can work with pulseIn() and in the setup() call pinMode(pin, INPUT_PULLUP) for that pin.

        should be okay to power the Arduino with 5v from the expansion header yeah, not much current needed at all, and the open drain output of the fan will not be damaged by the 5v pull up on the Arduino.

        (if you were to use a 3.3v arduino you could use a pin on the expansion header and save the fan output for something else)

        1 Reply Last reply Reply Quote 0
        • uk25undefined
          uk25 @A Former User
          last edited by

          @bearer said in Controlling AC Aquarium pump:

          something like pulseIn()

          I have tried pulseIn() in code bellow, Arduino D7 was connected to Duet FAN0-

          int pin = 7;
          unsigned long duration;
          
          void setup() {
            Serial.begin(9600);
            pinMode(pin, INPUT_PULLUP);
          }
          
          void loop() {
            duration = pulseIn(pin, HIGH);
            Serial.println(duration);
          }
          

          But when I tried to change fan speed in DWC nothing happens.
          Serial monitor always shows weird readings between 6 and 7.

          1 Reply Last reply Reply Quote 0
          • A Former User?
            A Former User
            last edited by

            Does the duration not change when you adjust the fan speed in DuetWebControl?

            It could be you'll have to adjust the fan frequency to give you usable values for the high duration of the pulse in microseconds to map to the dimmer input.

            If you set the fan frequency say 1000hz that should give you a peroid of 1000us, and the value of the fan speed in percent should be a factor of 10. I.e. 50% fan speed should give you 500us for the duration?

            which you then could map to the dimmer function with outVal = map(duration, 0, 1000, 100, 0) (or just divide duration by 10)

            uk25undefined 1 Reply Last reply Reply Quote 0
            • uk25undefined
              uk25 @A Former User
              last edited by

              @bearer said in Controlling AC Aquarium pump:

              Does the duration not change when you adjust the fan speed in DuetWebControl?

              Yep, nothing changes when I try to adjust the fan speed in DWC.

              If you set the fan frequency say 1000hz that should give you a peroid of 1000us, and the value of the fan speed in percent should be a factor of 10. I.e. 50% fan speed should give you 500us for the duration?

              I have tried to change fan frequency by M106 p0 F1000, but that also didn't help. The serial monitor still shows the same duration readings between 6-7 .

              7
              6
              7
              7
              7
              7
              7
              6
              6
              7
              
              1 Reply Last reply Reply Quote 0
              • A Former User?
                A Former User
                last edited by

                Hm, thats odd, maybe i missed something.

                I'm not sure the arduino is strictly necessary, but couldn't find any mention of how the MOC3021 deals with pwm input. Maybe someone else have something to add.

                uk25undefined 1 Reply Last reply Reply Quote 0
                • uk25undefined
                  uk25 @A Former User
                  last edited by

                  @bearer Anyway, thanks for your help. I will try to sol that issue with the Arduino community. I think I'm missing something.

                  1 Reply Last reply Reply Quote 0
                  • A Former User?
                    A Former User
                    last edited by

                    Can help to tell them the Duet fan output is a pwm controlled open drain output, where you can adjust the duty cycle as well as configure the frequency as you've already done.

                    Good luck!

                    1 Reply Last reply Reply Quote 0
                    • zaptaundefined
                      zapta @uk25
                      last edited by zapta

                      @uvarovkv said in Controlling AC Aquarium pump:

                      Yes, I want to get it as dimmer for an AC pump controlled through Duet web-UI.

                      Are you sure your AC motor is compatible with dimmers? Dimmers are typically use for resistive loads (e.g. heaters) and are incompatible with some loads.

                      uk25undefined 1 Reply Last reply Reply Quote 0
                      • uk25undefined
                        uk25 @zapta
                        last edited by

                        @zapta Yes

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post
                        Unless otherwise noted, all forum content is licensed under CC-BY-SA