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

    Controlling AC Aquarium pump

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

      Are you planning on running this as a dimmer/speed control or just on/off?

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

        @FelixH said in Controlling AC Aquarium pump:

        @uvarovkv Why don't you use an arduino to control the fan as well?.

        But I don't want to get just a separate dimmer, my main goal to make it work with Duet.

        @bearer said in Controlling AC Aquarium pump:

        Are you planning on running this as a dimmer/speed control or just on/off?

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

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

          Its isolated so no problem connecting it to the Duet, but as its a separate zero cross detector and triac/driver its not as easy to use as f.ex. an SSR directly with the duet.

          To use an adruino in between makes sense to take care of the speed control, read the pwm duty cycle from the fan output and control the triac accordingly.

          Which method is best suited to control the pump I'll defer to some analouge electronics wizzard.

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

            @bearer It sounds easy enough, but as I mentioned before I'm not an expert in electronics.

            It is definitely clear from that module documentation how to make it work with an Arduino... but how to make Arduino work with a Duet board.

            It looks like I have to get some readings from a 2-pin fan header, but I'm not sure what exactly... do I need just a voltage measurement or get some kind of a PWM signal?

            If you know more about that or how to do that in the best way, or even can give any links for tutorials which can help me to handle that I will appreciate that a lot.

            FelixHundefined 1 Reply Last reply Reply Quote 0
            • FelixHundefined
              FelixH @uk25
              last edited by

              @uvarovkv said in Controlling AC Aquarium pump:

              @bearer It sounds easy enough, but as I mentioned before I'm not an expert in electronics.

              It is definitely clear from that module documentation how to make it work with an Arduino... but how to make Arduino work with a Duet board.

              I think you're a bit confused. You don't actually need any Duet. You can drive everything with an arduino. For such a small endeavor, a Duet is way overkill.

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

                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.

                And replacing analogRead() with pulseIn() in the dimmer expample should get you 80-90% there.

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

                  @bearer Thank you so much for those tips and links. Hope that helps me make it work. 👍

                  1 Reply Last reply Reply Quote 0
                  • 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