Controlling AC Aquarium pump
-
@bearer Thank you so much for those tips and links. Hope that helps me make it work.
-
@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?
-
should probably connect -Fan to one of the pins that can work with pulseIn() and in the
setup()
callpinMode(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)
-
@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. -
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) -
@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
-
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.
-
@bearer Anyway, thanks for your help. I will try to sol that issue with the Arduino community. I think I'm missing something.
-
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!
-
@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.
-
@zapta Yes