Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Alternate switching of 2 relays

Status
Not open for further replies.
Chris_P said:
Stupid question .... if I use latching relays, how will I determine the previous state with my microcontroller?

Just treat them like switch inputs. On the relay you have the switch common pin, the contact "a" pin and contact "b" pin. Connect the switch common to ground and contact "a" to a uC input pin. Use a pull-up resistor (like 10K) on contact "a" (either external or, if your uC supports it, activate an internal pull-up).

When the switch common is connected to contact "a", your uC input will read 0; when it is connected to contact "b", your uC input will read 1 (pulled-up to Vcc by the resistor).

I would use the latching relay to store the state and have the nozzles controlled by ordinary relays which themselves are controlled by the uC.
 
Last edited:
ericgibbs said:
hi Chris,
I would suggest that you get a mains powered 'ac' motorised cam.

Set up the cams so that it operates the cam microswitch lever.
Connect the common pole of the microswitch to sprinkler supply input.
Use the n/o and n/c contacts of the microswitch to select alternate sprinklers.

By setting the cams it should be possible to set the sprinkler #1 and #2 times
so that both beds get watered one after the other, then it waits for the next sprinkle period.

You can get a decent S/H cam timer from an old washing machine.
and you could buy a simple 7 day timer to control the cam motor on time, 24/7 handsfree!


What do you think?

Eric
I'll have a look into that, thanks Eric. He is using very short cycles for the sprayers, ie a couple of seconds each minute. Whatever I make has to handle thousands of switches a day.
 
pc88 said:
Just treat them like switch inputs. On the relay you have the switch common pin, the contact "a" pin and contact "b" pin. Connect the switch common to ground and contact "a" to a uC input pin. Use a pull-up resistor (like 10K) on contact "a" (either external or, if your uC supports it, activate an internal pull-up).

When the switch common is connected to contact "a", your uC input will read 0; when it is connected to contact "b", your uC input will read 1 (pulled-up to Vcc by the resistor).

I would use the latching relay to store the state and have the nozzles controlled by ordinary relays which themselves are controlled by the uC.
Thanks pc88. Sounds simple enough. That is obviously a 2 coil relay. I was looking at some I can get last night, but they were 1 coil and you have to reverse the polarity to them to set and release them. I think they would be more difficult to use. I'll look around for some 2 coil ones.

I have some good ideas to try out now. I'll post what I come up with. Thanks for all the help. Much appreciated.
 
Re: two coil vs. one coil relays

with a microcontroller it's easy to reverse the current - just connect the coil between two output pins X and Y. First set X=1, Y=0. To reverse the current set X=0, Y=1.
 
blueroomelectronics said:
Why not use a latching relay?
I thought he was already using one of those.

Chris_P said:
I already have a heap of non-latching relays so I don't want to have to buy any others if I don't have to. I have never used latching relays before. How do they work?
I suppose it's just hard luck then.

I suppose you could use non-latching relays but you need a small rechargable battery to keep them powered when the power turns off.

You can reduce the current requirements for keeping the relays on though by useing a shotky diode in reverse parrallel and a low duty cycle.
 
pc88 said:
Re: two coil vs. one coil relays

with a microcontroller it's easy to reverse the current - just connect the coil between two output pins X and Y. First set X=1, Y=0. To reverse the current set X=0, Y=1.
This has a serious problem. The back EMF from the coil will blow the PIC.

A 2 coil latching relay would be a better option. It will be easier to protect the PIC from the back EMF if you use a 2 coil relay.
 
ljcox said:
This has a serious problem. The back EMF from the coil will blow the PIC.

That's why you add protection diodes, as with any relay switching - but for a reverseable coil you would need four diodes - think H-Bridge, which is what it actually is - in fact you might need an H-Bridge to supply enough current?.
 
Well if you use a PIC that's an entirely different ball of wax.
Even though the EEPROM is good for at least 1,000,000 writes (per byte) on the teeny PIC12F629. With 128 bytes a clever programmer could write to a different byte each time extending the duration. So everytime power is applied it sets/resets a bit in EEPROM.
OR (I assume from your posts you're building a timer)
a 12F508 with a 32768Hz crystal and a relay with a set of long lasting batteries 3xAA could be programmed to run for ages, a simple pushbutton could set the clock once in awhile lets say for noon (it'll drift about the same a good watch, they're the same crystals used in watches).
 
I think Bill (blueroom) is on the right track.

Why can't this 1 bit "memory" or "flip-flop" relay driver device remain powered? Could it be powered continuously and simply energize alternate relays when it detects a "power" output signal from your friends controller/timer? This would eliminate the need to use EEPROM.

As for power, I'm fascinated by Bill's use of a "Super Cap" in one of his recent projects. I wonder if something like that could be used in place of batteries (or other power source) to power the "flip-flop" relay driver device between relay power cycles? The relay power cycle would provide the power needed to energize the relays and could charge the Super Cap at the same time. Yes, no, maybe, huh?

Mike
 
Last edited:
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top