Trying to control relays through fan connections
I have tried now for some hours to understand what am I doing wrong here and running out of ideas for a solution. I have a 24v relay module connected to the same PSU with the Duet. I assumed boldly that I just have to connect the + wires from the fan connectors into the relay module's inputs, type M106 (P0-2) S255 and watch the relays pull on.
No. When I connect the cable from the fan +pin to the relay module input (what ever channel) the particular relay starts to pull immediately what ever the status of the fans. When measuring 0 volts in the cables from the fan pins the relays get latched just by connecting the cable. What ever M-code I send the connected relay stays on as long as the cable is connected.
I have tried to connect the fan negative wire side by side into the relay module's power in negative wire but no difference in the behaviour.
Is the PWM of the fanout causing issues here or what? is the PWM 255 real DC? If it would be about the PWM I would expect the opposite problems, the relays not working at all... but now they are always on if connected.
Is it the negative side of fanouts that is controlled by the M-codes? how should I connect the relay module if that's the case?
hopefully this gets solved as my project is stuck.
fcwilt last edited by
The + fan connection on the Duet is just tied to the board supply voltage.
The - fan connection is the one that is switched (to ground).
I would think that a PWM setting of 255 would be a constant state, no pulsing.
We need more information about your relay module.
deckingman last edited by
@propellerhat It's the negative side of the fan connectors that gets switched and controlled by PWM, not the positive side. BUT, I don't think it's a good idea to connect relays directly to fan connectors. It's not my area of expertise so no doubt someone else will jump in and confirm or correct me if I'm wrong. It has something to do with back EMF when the magnetic field of the coil collapses and I think you need to use fly back diodes or some such (but I could be wrong).
Bummer.... Tried already a heater channel for the same with same results.
The module is a no brand optocoupled one.
And oh, after confirming the relay module is optoisolated I tried also desperately poking the relay module's control input with the negative wire from fan out and heater out, and also that caused the relay to activate This doesn't compute at all for me.
What ever I connect to the module that relay starts pulling right away and the state can not be altered with any command even though my multimeter shows the voltage being what expected in every case.
How about the expansion header's heater outputs? Are these positive or negative connections (Heater 3-7)?
Before today I would have expected that every heater connection is positive and switched, and the - of every heater is connected directly to ground.
Maybe a 3.3v relay module connected in the expansion header's heater pin and ground would do it..?
Stephen6309 last edited by Stephen6309
@propellerhat Did you try setting the input for the relay channel on the board to expect a low signal? The photo shows they are all set to high.
Yes I tried that too, when setting the fan out into 5 volts :I
What are they exactly, the HIGH and LOW input voltages?
Just did a few tests with the cheapo relay module. I cut a trace on the negative side of the optocoupler's input and fed external 2 volts into it and the relay latched as I was hoping. Probably gonna try to get the expansion header's 3,3v I/0 to control the optocouplers similarly directly (bypassing the control connectors of the module) if you guys don't throw better ideas :I
getting the 3,3V from the header's pins 8 and 42 without setting the heater3 on. Doesn't look good, surprisingly.
fcwilt last edited by
I don't understand why setting the relay boards input(s) to the low setting didn't work.
Of course it would be good to know what the voltage levels expected at these input are. You would not want to apply too much voltage.
Perhaps the inputs don't have pull-up resistors to pull the input up into the "off" state.
If you do need a pull-up resistor you could place a resistor (say 1000 ohms) connected to the two fan outputs and then feed the fan- output to the relay input.
If you need to limit the voltage to the relay board add a second resistor of a suitable value between fan- and ground.
For example if your board is powered with 12 VDC two 1000 ohm resistors would limit the voltage to the relay module to 6 VDC.
A 1000 ohm resistor and a 560 ohm resistor would limit the voltage to appx 4 VDC.
You should not need to be cutting any traces.
You can drive a relay (not a relay module) directly from a fan output, if the relay coil voltage is the same as VFAN.
To drive a relay module, use a spare heater output on the expansion bus. The heater outputs are active low, so to make the relays be off at power up, connect the optically isolated input of your relay module between +3.3V and the heater output pin on the expansion connector.
Make sure your relay module really does have optically isolated inputs, and take great care not to short +3.3V to anything else.
PropellerHat last edited by
Thanks for the tips
I have been out the workshop a couple of days but connected already the other day one relay directly to the fan pins and looks like it's the no-brainer way to go, at least now.