HI
Using this relay hfd2/012-s-l2-d at 12 volt dc note this is a dual coil relay.
Looking for a Arduino basic code to test, to reverse output dc voltage say with 2 leds to show both positions.
Could someone help this oldie with a example sketch. Thanks have several already on hand to use. Will once this is working try and H bridge.
Thanks
Definately NOT! One coil is used to close the contacts until the second coil is energized to release the contacts. You will need to use a MOSFET between your Arduino and EACH of the coils.
Surely you can write a pin to turn a digital pin high and low and a second pin high and low.
which was exact except I had 2K2 at the base, so. Forget my sketch, it was drawn with my finger anyway.
I just happen to have a lifetime supply of 2N3904 and 1N4001 parts... ppl like MOSFETs, too.
You need one copy for each coil obviously, and a moment HIGH lasting 5 ms will set (or reset) the relay. One output pin for each relay driver.
A simple test program with that and say 1000 ms between set and reset is trivial extrapolation from the basic blink, plain blink with delay which I think is among the very first examples in the IDE.
You could run the LEDs from the relay contacts. LED, series current limiting resistor like 1K, switching power to that combo wired to ground.
Looking at the data sheet, it states in one of the footnotes that in order to maintain the "set" or "reset" status that the coil needs to be energized for at least 5 times the "set" or "reset" time, which would be about 25mS.
DO NOT energize both coils at the same time. Also do not energize a coil for an extended amount of time, since the relay is latching it may not be able to withstand the heat from a continuously energized coil.
So in actual fact, an H-bridge could be used to operate the relay, being disabled after the operate time; and putting the two coils in series ("+" to "+" and the two "-" to the bridge) would make it functionally equivalent to the single coil version while halving the current drain of using the coils separately.
How exactly is that suppose to work? You are making an assumption about the actual mechanics of how the relay operates, and the data sheet specifically states to only power a single coil at a time, and with the correct polarity.
I was responding to Paul_B's comment about wiring with an H-bridge
I do not see anything in the data sheet that states a reverse-polarity coil will be non-conducting, and if it were non-conducting then wiring the coils in series would seemingly also prevent the other coil from conducting at that point.
If you absolutely have to use an H-bridge, then wiring the coils in parallel, with reversed polarity, and diodes in series with each coil to only allow current flow in the correct direction, might work, but between the diodes and H-bridge the voltage drops are starting to add up.