Arduino Forum

Using Arduino => Project Guidance => Topic started by: Mikie_lomas on Nov 20, 2016, 01:11 pm

Title: Dual latch Relay Circuit Setup
Post by: Mikie_lomas on Nov 20, 2016, 01:11 pm
Hi Guys,

I will apologise straight off for the lack of circuit diagram. But I will explain what I am trying to do as best as possible.

https://www.omron.com/ecb/products/pdf/en-g5rl_uk.pdf

I have the dual altching relay model of this relay. I am trying to configure it so that I can both latch it either way with my arduino. A wise person on this forum has guided me to understand that in the diagram. I think 5v is applied to the + pin and then when setting or resetting the relay, I have to set either side to low? Is this correct?

I have also read that I should employ  resistors and diodes to protect the arduino from getting fried.

Any help on how I would set this circuit up would be much appreciated.  Thank you for your time.
Title: Re: Dual latch Relay Circuit Setup
Post by: DrDiettrich on Nov 20, 2016, 02:55 pm
First of all open the data sheet and find your specific relay description (section Dimensions), to identify the coil connectors and polarity. Eventually the same information is printed near the relay pins. Or give the full type ID of your relays, so that we can find the essential details pertaining to exactly that type.

In either case you need at least 2 transistors, better a H-bridge, to drive such a relay. The Arduino outputs are incapable of sourcing that much current or voltage as required to toggle the relays.
Title: Re: Dual latch Relay Circuit Setup
Post by: dave-in-nj on Nov 20, 2016, 03:13 pm
lots more data is needed.

latching relays on that data sheet offer either a single coil. you use an H-bridge to revere power
and it shows two coils. one to set one direction, the other for the second direction.

-U is a single coil, you alter ground and power
-K is 2 coil, you need to bring one to ground to make that side work.

very easy to use two coils. but you need two pins from your Arduino.

YOU CANNOT POWER DIRECTLY from the Arudino.
at 5V each coil uses 150 mA.
you must use a transistor.  very easy, couple of cents for a transistor, resistors and the required diode.

power goes to the relay coils, always hot.
you only close the circuit on the coil you want to power.
only needs a few ms to power the coil.

(http://www.electroschematics.com/wp-content/uploads/2013/07/arduino-control-relay-schematic.png)
Title: Re: Dual latch Relay Circuit Setup
Post by: dave-in-nj on Nov 20, 2016, 03:21 pm
for a single coil, you need to use an H-Bridge.

(http://fritzing.org/media/fritzing-repo/projects/h/hbridge-with-transistors/images/hbridge.jpg)

pins from the Arduino are on the left.
you need 4 transistors, 2 are to be PNP, and two NPN
or use an h-bridge on a chip.
Title: Re: Dual latch Relay Circuit Setup
Post by: rpt007 on Nov 20, 2016, 05:00 pm
H-bridge is the magic word.
But, there is a BUT ...

Building this circuit with discrete devices you will have to make absolutely sure, that certain conditions won't happen if you don't want to fry the transistors in the circuit. As the transistors need a time (ok, pretty short, but they are fast) to switch from ON-OFF or OFF-ON you might run into a situation where the current is shortened through two transistors with any load in between which will fry at least one, maybe both transistors.

There for my recommendation is to use a special IC for that which is designed to avoid that shortening situation.
A suitable H-Bridge IC is the L293D, which is pretty common in the Arduino world and pretty cheap, coming with internal protection diodes and it's inputs can be directly connected to the Arduino outputs without addt'l resistors.

The following links give you some more detailed information how to use the circuit; in your project just replace the motor with the single coil of your latched relay - polarity of the coil is irrelevant as you can switch the state back and forth by the Arduino.

http://www.me.umn.edu/courses/me2011/arduino/technotes/dcmotors/L293/L293.html (http://www.me.umn.edu/courses/me2011/arduino/technotes/dcmotors/L293/L293.html)
and
http://www.robotplatform.com/howto/L293/motor_driver_1.html (http://www.robotplatform.com/howto/L293/motor_driver_1.html)

Title: Re: Dual latch Relay Circuit Setup
Post by: DrDiettrich on Nov 20, 2016, 11:48 pm
I'd wait for feedback about the really used relay. If it has separate set and reset coils, two transistors will be perfectly sufficient, a full H-bridge is required only for a single coil relay. For insiders: just the same difference as with unipolar and bipolar stepper motors :-)
Title: Re: Dual latch Relay Circuit Setup
Post by: dave-in-nj on Nov 21, 2016, 02:34 am
For insiders: just the same difference as with unipolar and bipolar stepper motors :-)
yes, once you get familiar with a coil, you soon realize that a solenoid, a relay a stepper, are all just coils and are treated the same basic way
Title: Re: Dual latch Relay Circuit Setup
Post by: DrDiettrich on Nov 21, 2016, 02:56 am
yes, once you get familiar with a coil, you soon realize that a solenoid, a relay a stepper, are all just coils and are treated the same basic way
Right, but as we know from resistors in parallel and in series, multiple coils can be combined in several ways, with distinct behaviour ;-)
Title: Re: Dual latch Relay Circuit Setup
Post by: dlloyd on Nov 21, 2016, 03:39 am
Separate 5V supply is needed but H-bridge is not needed (I've used these). Only 2 outputs needed. Remember to use a pulse (HIGH) to set or reset the relay (do not leave the outputs continuously high). A pulse duration of 40ms works well.

(http://i.imgur.com/WXgfS87.png)
Title: Re: Dual latch Relay Circuit Setup
Post by: Wawa on Nov 21, 2016, 04:20 am
For a single coil you can use a "poor man's H-bridge"
Title: Re: Dual latch Relay Circuit Setup
Post by: Mikie_lomas on Nov 21, 2016, 05:04 am
Wow thank you so much for all your replies everyone. I am sorry for not making it clear. The relay i am using is the double Latch Relay.

It is the G5RLk1EDC5

it takes 5v. I also have some of the single coil, although I am pretty sure that the double altch will be more suitable for my project.

From the datahseet it has 9 pins. 6 pins for the current that is being switched. That is 2 pins for NC, 2 for C, and 2 for NO.

It also has a + a reset and set.



I have TIP120s and  2n3904 transistors..probably more lying around. Would these be sufficient. I have also ordered some from china..

I am pretty sure that the way I connect it is:

5v to the +, then make Reset and set outputs which I pulse into either state. I just have to be careful with backflush EMF and alot of the other things you guys mentioned.

I have diodes and transistors and resistors. Is there any sure fire way of selecting the right one or is it setup the circuit and test current and voltage?

Arduino 5v - > middle pin

Arduino output pin --> Diode ->transistor --> reset


Arduino output pin --> Diode ->transistor --> set

Is this the right setup for a double latching relay?
Title: Re: Dual latch Relay Circuit Setup
Post by: dlloyd on Nov 21, 2016, 05:58 am
Quote
Is this the right setup for a double latching relay?
The diodes need to be connected across the center tapped coil as shown in the diagram.

Diode 1: Anode to relay pin 1, cathode to relay pin 9.
Diode 2: Anode to relay pin 8, cathode to relay pin 9.

Here's a simple test script:

Code: [Select]
const byte ledPin = 13;            // LED pin (shows relay status)
const byte setPin =  6;            // connect to relay coil "S" pin
const byte resetPin = 7;           // connect to relay coil "R" pin

void setup() {
  pinMode(ledPin, OUTPUT);
  pinMode(setPin, OUTPUT);
  pinMode(resetPin, OUTPUT);
}

void loop() {
  // Set the relay
  digitalWrite (setPin, HIGH);
  delay (40);
  digitalWrite (setPin, LOW);
  digitalWrite (ledPin, HIGH);

  // Wait 1 second
  delay(1000);

  // Reset the relay
  digitalWrite (resetPin, HIGH);
  delay (40);
  digitalWrite (resetPin, LOW);
  digitalWrite (ledPin, LOW);

  // Wait 1 second
  delay(1000);
}
Title: Re: Dual latch Relay Circuit Setup
Post by: Mikie_lomas on Nov 21, 2016, 06:24 am
Quote
The diodes need to be connected across the center tapped coil as shown in the diagram.

Diode 1: Anode to relay pin 1, cathode to relay pin 9.
Diode 2: Anode to relay pin 8, cathode to relay pin 9.
Thank you for your reply.

I do not currently have the transistor that you specified , but I do have 2n3904. Will these work until I can source the ones specified?

Thank you so much for the test script, it is exactly what I needed.

Will any cathode do? Does the downwards arrow mean to ground, except we do not want the arduino and the 5v to have common ground?

you have provided the diagram for a single latch relay. Will the same script and circuit work for the double latch?

Thank you for your continued response.
Title: Re: Dual latch Relay Circuit Setup
Post by: dlloyd on Nov 21, 2016, 07:13 am
Yes, the 2N3904 should work OK. Most any diode would do ... IN4448, 1N914, IN4004, 1N4005, 1N4006, 1N4007 and others.

Quote
Does the downwards arrow mean to ground, except we do not want the arduino and the 5v to have common ground?
for any diode, this is the anode side -----l>|------ this is the cathode side

The long line side does not mean "to ground". In this application, this end of the diode (cathode) connects to the center pin of the relay coil (+5V).

Quote
you have provided the diagram for a single latch relay. Will the same script and circuit work for the double latch?
No, it's for the double-winding Latching Type.

You may have a different relay contact configuration. The SPDT (single pole double throw) type "1C" (form-C). Yes, it will work for this type also.
Title: Re: Dual latch Relay Circuit Setup
Post by: Mikie_lomas on Nov 21, 2016, 07:22 am
Thank you again for your response, I will attempt to make something following your guidelines after i finish work tonight.

I was referring to the hollow white downward arrow, is this ground?

If not I was curious as to how the circuit is grounded? I am a beginner at this stuff, but from the diagram you provided it looks as if the current from the high pulse will trail back out the left pin of the opposite transistor?

Once again thank you for your time.
Title: Re: Dual latch Relay Circuit Setup
Post by: Mikie_lomas on Nov 21, 2016, 08:01 am
After looking over the diagram further.

Does the white hollow arrow mean 5v? That would mean that 5v goes into the collecter, then the base is pulsed and the emitter delivers the current towards either reset or set? then the back flush of emf travels through the diode back into the centre pin?
Title: Re: Dual latch Relay Circuit Setup
Post by: DrDiettrich on Nov 21, 2016, 10:52 am
You better use the circuit diagram in #8. The H-bridge circuit in #3 is too specialized and simplified, will work only under certain conditions. The weakest point is the restriction of the supply voltage, which is supposed to equal the logic HIGH voltage of the driving output pin, under load. Even then the top transistors may not turn fully on, due to the voltage drop in the base resistors. If a base current of only 1mA is required, this will drop 1-3V on the 1-3k base resistors, another 0.7V on B-E, and 0.4V on the C-E of the bottom transistors, so that less than 3V is left for the coil :-(
Increasing +V doesn't help, because the emitter voltage can not exceed the base voltage, which is determined by the connected controller output pin. In practice the top transistors should be PNP, with another NPN transistor driving their base.

The hollow arrows mean ground. The diodes let the back flush rush into the power source.
Title: Re: Dual latch Relay Circuit Setup
Post by: Mikie_lomas on Nov 21, 2016, 12:29 pm
Thank you for your reply. I am building the circuit now. Is the external 5v supply mandatory or is this the only way doing it this method?

Would this mean I would need two power supplies for every one of my projects? Would it be possible to have 1 main external supply that feeds all of the relays around the house through cat6? I know there would be a voltage drop, so you would up the voltage at the start, is there anyway however to ensure that 5v  goes into the circuit at the end?

Thank you so much for your guidance
Title: Re: Dual latch Relay Circuit Setup
Post by: Mikie_lomas on Nov 21, 2016, 02:13 pm
Hi There,

Quote
You better use the circuit diagram in #8.
I attempted the circuit. I have enclosed pictures but will describe as best as possible

arduino pin 6 -> 470 resitor to base of transistor, with left pin leading to ground and right pin leading a common line which splits off into 1 pin of relay (of the 3 pins), the other is a diode pointing towards a line that is fed 5v from an external power source. This is repeated for pin 7.

I then used the script your provided, no clicking noise when hot is not attached and no switching when it is.

I feel i have possibly confused myself somehow and done things wrong. The bit that worries me the most is around the input area. I have attached pictures to attempt to assist my explanation.


Thank you
Title: Re: Dual latch Relay Circuit Setup
Post by: DrDiettrich on Nov 21, 2016, 02:41 pm
Test your circuit by disconnecting the base resistors from the controller, and connect them momentarily to Vcc to switch the relay. You can also add a LED (+resistor) to the output pins, for visual feedback.
Title: Re: Dual latch Relay Circuit Setup
Post by: dlloyd on Nov 21, 2016, 03:28 pm
I was thinking something similar as DrDiettrich. If the LEDs alternately blink, then replace the relay test circuit with the actual relay. Here's an updated diagram:

(http://i.imgur.com/q7cH0fQ.png)

I'm a little concerned that the 2N3904 will not be strong enough to switch the relay coil. May need to replace with PN2222A or other.

EDIT: In the code, you may need to temporarily change the pulse interval from 40ms to 100ms to see the LEDs blink (pulse) a bit brighter.
Title: Re: Dual latch Relay Circuit Setup
Post by: Mikie_lomas on Nov 21, 2016, 03:40 pm
Quote
I'm a little concerned that the 2N3904 will not be strong enough to switch the relay coil. May need to replace with PN2222A or other.
I have ordered 50 PnAAAA weeks ago, but they have not arrived. I also have:

2NAAAA will these work?

I understand this circuit a little better than the other. Does the led go in series after the diodes to the far right?

Once again thank you so much for your continued correspondence.

Title: Re: Dual latch Relay Circuit Setup
Post by: DrDiettrich on Nov 21, 2016, 03:48 pm
The 5V coils draw 120mA, should not be a problem with any transistor.
Title: Re: Dual latch Relay Circuit Setup
Post by: dlloyd on Nov 21, 2016, 03:48 pm
Quote
2NAAAA will these work?
If you mean 2N2222A, then yes.

Quote
I understand this circuit a little better than the other. Does the led go in series after the diodes to the far right?
The LEDs go in series with the 330 ohm resistors. The common connection point of the resistors is the 5V relay supply voltage.
Title: Re: Dual latch Relay Circuit Setup
Post by: Mikie_lomas on Nov 22, 2016, 01:02 am
Quote
EDIT: In the code, you may need to temporarily change the pulse interval from 40ms to 100ms to see the LEDs blink (pulse) a bit brighter.
I just followed the code you provided originally and there was a 40 - 1000 ms delay change. So i assumed this was what you meant.

With the revised LED test circuit and changing the transistors I have managed to get the LED circuit working as I would imagine the relay circuit would. I think I understand the circuit better now.

Now I just replace the whole relay test driver section with a relay, or do I need to swap the resistors back to the oldies.

Thank you so much for your help so far.
Title: Re: Dual latch Relay Circuit Setup
Post by: DrDiettrich on Nov 22, 2016, 01:08 am
I'd leave the test LEDs in place, also the long delay. Then change resistor values if required, and finally clean up.
Title: Re: Dual latch Relay Circuit Setup
Post by: Mikie_lomas on Nov 22, 2016, 01:13 am
Quote
I'd leave the test LEDs in place, also the long delay. Then change resistor values if required, and finally clean up.
It looks alot nicer than last time.

How would i add the relay to this?

Thank you for all your help DrDiettrich
Title: Re: Dual latch Relay Circuit Setup
Post by: Mikie_lomas on Nov 22, 2016, 01:40 am
I tried adding the relay, 1 pin to 5v before the LED's resistors , then the two outer pins to common line before the diodes.

It seemed to flash one side, then both at the same time. No clicking noise.
Title: Re: Dual latch Relay Circuit Setup
Post by: Mikie_lomas on Nov 22, 2016, 03:24 am
Hi Guys,

I have removed the revised circuit from within the area entitled test relay circuit and replace that with the relay. This allow me to latch the relay either way, it kept its state after power off!!!

I am almost ready to put this onto a perfboard. Can you guys recommend any last minute things I should add or do to the circuit?

I was using the 330 resistors when I got it working, should I change this back to the 470s?

Out of curiosity and please forgive my ignorance. I was wondering if it is possible to perform this operation without the external power supply? By using an external ground? (I am new to all of this). Say for example if I had an arduino Nano, which has the job of pulse switching 1-3 relays.

Thank you so much, I am so happy I managed to get the circuit working

PS. my PN22222A's arrived today.
Title: Re: Dual latch Relay Circuit Setup
Post by: dave-in-nj on Nov 22, 2016, 03:30 am
each coil uses 150mA
if you use the Arduino power, you may have a dip in voltage.
however, there is a away to trickle charge a cap to use that for the power dump to the coil.
you cannot change state before it charges, and you cannot energize two at the same time  unless you size the caps properly.
Title: Re: Dual latch Relay Circuit Setup
Post by: DrDiettrich on Nov 22, 2016, 03:37 am
Continue with the 330R. Current is only drawn as long as the relays are triggered.

It may be possible to drive the relays from the Arduino 5V, but only with big caps (>=1000µF) added, or you risk controller resets or other malfunction. But if you already have a 5V supply, you can power both the Arduino and relays from that supply.
Title: Re: Dual latch Relay Circuit Setup
Post by: Mikie_lomas on Nov 22, 2016, 03:43 am
Quote
each coil uses 150mA
if you use the Arduino power, you may have a dip in voltage.
however, there is a away to trickle charge a cap to use that for the power dump to the coil.
you cannot change state before it charges, and you cannot energize two at the same time  unless you size the caps properly.
Thanks for the reply. But I am not exactly sure what you mean.

The option is to have latching relays all around my house, which is powered through cabling in the wall.

I had a thought that I could have a main 15v 3-4A power supply fed throughout the house via phone cabling (to account for voltage drop), it should drop down to an acceptable 6-12 V by the time it hits the arduinos. I would then use the regulated 5v supply to latch the relays. If I cant power from the nanos, i basically have two options.

Option 1: Input wall cavity power sockets and then use AC - DC 5v 1A USB sockets which I plug into the nanos and then a separate 5v supply for the relays

or

Option 2: Send a higher voltage through the phone cabling all around the house and then attempt to regulate the voltage down to 5v at the end for the relay...Not sure on that one.

Any guidance would be very much appreciated. thank you in advance

Quote
Continue with the 330R. Current is only drawn as long as the relays are triggered.

It may be possible to drive the relays from the Arduino 5V, but only with big caps (>=1000µF) added, or you risk controller resets or other malfunction. But if you already have a 5V supply, you can power both the Arduino and relays from that supply.
Does this mean I can do either the main external power supply for everything through phone cabling or a single 5v in each wall as said above and then I activate a plus and a negative on a board such as this:

http://www.ebay.com.au/itm/Protoboard-Plus-Tiny-Premium-DIY-Protoboard-Perfboard-for-Arduino-AVR-PIC-/331627685381?hash=item4d368ce605:g:m5YAAOSwT6pVzF6S

and this would be an acceptable method of powering both units?

Thankyou for your time
Title: Re: Dual latch Relay Circuit Setup
Post by: Mikie_lomas on Nov 22, 2016, 04:20 am
I just looked up voltage drops and although 15v 3-4A is quite considerable...

5v at 20ma is very minimal indeed. Maybe it would be better to have a main controlling arduino that sends signals through cat 6.

If I were to feed the main arduino 7-12 volts, but then send the reset and set , arduino 5v and power supply ground out on 4 different cat 6 inner cables. Would this work by any chance?
Title: Re: Dual latch Relay Circuit Setup
Post by: dlloyd on Nov 22, 2016, 04:54 am
Quote
I just followed the code you provided originally and there was a 40 - 1000 ms delay change. So i assumed this was what you meant.
The 40ms is the pulse duration. The 1000ms is the timing between Set and Reset. When looking at the LEDs in the test circuit, the Set LED will give a very quick blink, then 1 second later the Reset LED will quickly blink, then this repeats forever.

So basically, the control signal (quick pulse) toggles back and forth from the Set pin to the Reset pin. The relay contacts do not pulse. They will close continuously for about 1 second, then open continuously for 1 second, and repeat like this forever.

Quote
I have removed the revised circuit from within the area entitled test relay circuit and replace that with the relay. This allow me to latch the relay either way, it kept its state after power off!!!
Yep. That's why its called a "latching relay". It has memory. This is the main advantage of this type of relay ... it only takes minimum 30ms of power to the coil to change the status of the contacts. In the test code, the relay coil draws no power whatsoever 96% of the time.

Quote
each coil uses 150mA
if you use the Arduino power, you may have a dip in voltage.
Note that Set and Reset are never activated at the same time. So 150mA is the peak current, but only for the pulse duration (30ms minimum). Most of the time the coil is disconnected. A capacitor could help if the supply can't handle a 150mA impulse, but I doubt this would be a problem.
Title: Re: Dual latch Relay Circuit Setup
Post by: dlloyd on Nov 22, 2016, 05:02 am
Quote
The option is to have latching relays all around my house, which is powered through cabling in the wall.
How many relays? Note that you'll need 2 digital outputs per relay.

Can the relays be Set or Reset sequentially? If so, all that's needed is 150mA. If you have 25 relays and your impulse is 40ms, then it will only take 1 second to update all 25 relays with only 150mA of current.
Title: Re: Dual latch Relay Circuit Setup
Post by: Mikie_lomas on Nov 22, 2016, 05:09 am
Quote
Can the relays be Set or Reset sequentially? If so, all that's needed is 150mA. If you have 25 relays and your impulse is 40ms, then it will only take 1 second to update all 25 relays with only 150mA of current.
If I am understanding what you mean is current then this is amazing news!

I looked up voltage drop for phone line (i think: 22-24 gauge). With .15 A and 5v there is only a very small voltage drop.

From this, I feel the best way to control it is:

From one main arduino Mega in a central location that sends pulses via cat6 into the roof, into the wall cavities housing the relay circuit?

Does this sound like it would work? That way I could also have a 5v power supply at the main source which I can send out with the cat 6 through the cables.

Thank you for your time.
Title: Re: Dual latch Relay Circuit Setup
Post by: Mikie_lomas on Nov 22, 2016, 05:34 am
Hi thre guys,

Just a side note question:

Hypothetically, if i did go down the supplying 5v current through cat 6 around my house, could I use the module featured in the below link to:

Receive voltage which would have dropped from 5v-(4.9 - 4.6) depending on the distance sent (between 5-25 metres). Then regulate it up to 5v at 500ma.

What are your thoughts guys?

Step Up Module - Ebay (http://www.ebay.com.au/itm/192002495957?_trksid=p2060353.m2749.l2648&var=491620166703&ssPageName=STRK%3AMEBIDX%3AIT)
Title: Re: Dual latch Relay Circuit Setup
Post by: dlloyd on Nov 22, 2016, 05:46 am
Quote
From this, I feel the best way to control it is:
From one main arduino Mega in a central location that sends pulses via cat6 into the roof, into the wall cavities housing the relay circuit?
Does this sound like it would work?
Yes, this could work.

Quote
That way I could also have a 5v power supply at the main source which I can send out with the cat 6 through the cables.
Something to consider:
I'm quite sure it's possible to use just one supply for everything. I would consider using a 7.5V (regulated) DC supply that can be used to power the Arduino through Vin and also provide power to all the relays. For relay power, just use one 1N4004 or 1N4007 diode in series with the 7.5V. This essentially creates a separate 6.8V supply for the relays.

This will not be a problem because of the voltage drop across the transistor (0.3V) and the voltage drop through the wiring which would leave something less than 6.5V. Note that the rated voltage of the relay coil is 130% max = 6.5V.
Title: Re: Dual latch Relay Circuit Setup
Post by: Mikie_lomas on Nov 22, 2016, 06:02 am
Quote
I'm quite sure it's possible to use just one supply for everything. I would consider using a 7.5V (regulated) DC supply that can be used to power the Arduino through Vin and also provide power to all the relays. For relay power, just use one 1N4004 or 1N4007 diode in series with the 7.5V. This essentially creates a separate 6.8V supply for the relays.
I have an adapter split and a screw terminal end, so I could power the arduino through the jack as normal, then have it split off into screw terminal, then into ground and then hot to diode and then a common hot line?

Is it perhaps better to have the diode at each of the cat 6 end points or would that make the voltage too unreliable on account of voltage drop in different distances of cabling?

I am starting to get excited about all of this.

Will it limit the longevity of the relays possibly putting them at the end of their tethers for the entire life at 6.5v or is it more like to be less and within the range is within the range?

Would a main arduino and a common 5v power supply , which I step up to a solid 5v -> 500ma at the end of the circuit be better for the life of my project or is there issues with using cheap chinese step up modules.

Should I employ an opto-isolator?

Sorry about all the questions, thank you so much for your responses. i am learning alot
Title: Re: Dual latch Relay Circuit Setup
Post by: dlloyd on Nov 22, 2016, 06:21 am
Quote
I have an adapter split and a screw terminal end, so I could power the arduino through the jack as normal, then have it split off into screw terminal, then into ground and then hot to diode and then a common hot line?
If the adapter is 7 to 7.5V, then yes. At the screw terminal with 7.5V connect the anode of the diode. Then use the other end of the diode (stripe end) for your 6.8V supply.

Quote
Is it perhaps better to have the diode at each of the cat 6 end points or would that make the voltage too unreliable on account of voltage drop in different distances of cabling?
No advantage ... only one diode required at the main power supply point.

Quote
Will it limit the longevity of the relays possibly putting them at the end of their tethers for the entire life at 6.5v or is it more like to be less and within the range is within the range?
No ... its within specifications. The main thing that would shorten life span is having the pulse duration too long. This overheats the coil.

Quote
Would a main arduino and a common 5v power supply , which I step up to a solid 5v -> 500ma at the end of the circuit be better for the life of my project or is there issues with using cheap chinese step up modules.
The main problem here is that you would need a separate module for each relay if the relays are at different locations. Also, more components, more chances of component failure.

Quote
Should I employ an opto-isolator?
Good question. There are definitely advantages with this. Note that it would make the circuit somewhat more complex. You'll probably need to design your own relay module for this.

EDIT: This darlington photocoupler (http://www.cel.com/pdf/datasheets/ps2562.pdf) could directly drive the relay coil (no extra transistor required).
Title: Re: Dual latch Relay Circuit Setup
Post by: Mikie_lomas on Nov 22, 2016, 07:13 am
Thank you so much for your time. It is beyond appreciated.


Quote
Good question. There are definitely advantages with this. Note that it would make the circuit somewhat more complex. You'll probably need to design your own relay module for this
Yes, I am a bit confused as to how they work..or send a signal. But I do know they can and maybe should be used to isolted relay circuits from microcontrollers?

If it has 4 pins, surely that means two inputs and two outputs. Could a whole bunch of 4 pin opto-isolators be used to send the set and reset message, perhaps I am mistunderstanding how they work.

Basically, yeah I plan to mount this on a perfboard. The only factor stopping me current is that although the 6 - > NC, C and NO fit on a normal spacing, the 3 input pins do not fit on anything unless diagonal, which really does not work.. Not sure what the best method to deal with that conundrum is

Quote
No ... its within specifications. The main thing that would shorten life span is having the pulse duration too long. This overheats the coil.
I just looked at voltage drop from 24 gauge with a load of .125, the cable needs to be atleast 14 metres long. Otherwise it will be over 6.5v. Will there be other ways in the transport process that voltage will be lost or should I employ a power supply that is less than 7v?

Thank you for your time.
Title: Re: Dual latch Relay Circuit Setup
Post by: dlloyd on Nov 22, 2016, 07:57 am
Don't forget that the transistor drops 0.3V. So, directly connected we have 7.5 - 0.7 - 0.3 = 6.5V. This is within specifications. In a different application, I have many 12V latching relays that use an 18V pulse (150%) and have been in service without any failures for about 15 years.

EDIT: Could use 2 diodes in series if you're concerned (5.8V).
Title: Re: Dual latch Relay Circuit Setup
Post by: Mikie_lomas on Nov 22, 2016, 08:03 am
Quote
Don't forget that the transistor drops 0.3V. So, directly connected we have 7.5 - 0.7 - 0.3 = 6.5V. This is within specifications. In a different application, I have many 12V latching relays that use an 18V pulse (150%) and have been in service without any failures for about 15 years.
Awesome news, this will be a much better option than running a whole bunch of arduino nanos!

I have ordered some of these:

Optocoupler (http://www.ebay.com.au/itm/251396748066?_trksid=p2060353.m2749.l2648&ssPageName=STRK%3AMEBIDX%3AIT)

Hopefully they shouldnt be too difficult to figure out once they arrive and they are sufficient.

Thank you for your help my friend.
Title: Re: Dual latch Relay Circuit Setup
Post by: DrDiettrich on Nov 22, 2016, 08:50 am
I'm not happy with your installation plans. What looks good for a breadboard model, is not normally applicable in a larger area.

Inside a car (5m) 12V are used, for longer distances 24V. These higher voltages will reduce currents, and consequently power consumption and losses. Consider to use such voltages with a central power supply, and break the voltage down in every node of your home automation network. Don't forget fuses, or you risk failure of your entire installation on a local problem.

How do you intend to control the many relays? Individual lines to every relay will sum up into a huge number of wires. Better were a bus system with addressable nodes (I2C, CAN, Ethernet...), that also can be extended at any time. Line drivers are almost required, for secure signal transmission, so that I2C can not be used across a house.

I'd not try to build a cheap and unreliable home automation system, unless I want to make my living from service and repair.
Title: Re: Dual latch Relay Circuit Setup
Post by: dlloyd on Nov 22, 2016, 04:06 pm
Using an opto would provide high reliability and could handle long cable runs. However, you'll need a separate power supply. Yeah, there'll be a practical limit to how many relays you would want to control like this due to the increased wiring and digital outputs required.

(http://i.imgur.com/6IgTA6o.png)

EDIT: The relay coil voltage (not counting voltage drop through cable) when pulsed would be about:
7.5V - 0.7V (diode) - 1.5V (Vce) = 5.3V
Title: Re: Dual latch Relay Circuit Setup
Post by: CrossRoads on Nov 22, 2016, 04:41 pm
I'd suggest RS485 from the master out to the remotes, with the remotes having intelligence to receive a serial message and manage the relays from there. Way less wiring, each remote can be powered locally. Remotes can then report status too if you want to set up sensors, or have light switches that can be turned on manually at the remotes sites, temperature, etc.
Can make a little custom card with equivalent of a Promini, RS485 chip (MAX488 perhaps), wallwart for power, relay driver (shift register like TPIC6B595) and that can also control other things, some sensors, etc.
Title: Re: Dual latch Relay Circuit Setup
Post by: Mikie_lomas on Nov 22, 2016, 11:52 pm
Quote
How do you intend to control the many relays? Individual lines to every relay will sum up into a huge number of wires. Better were a bus system with addressable nodes (I2C, CAN, Ethernet...), that also can be extended at any time. Line drivers are almost required, for secure signal transmission, so that I2C can not be used across a house.
I have a few options:

1. Individual ethernet shields per light switch, which i control from main respberry pi via firmata and C# programming

2. One main arduino mega and ethernet shield, connected to each relay module via ethernet shield from raspberry pi via firmata. As it is only sending small pulse with low current the voltage drop will be minimal.

Quote
I'm not happy with your installation plans. What looks good for a breadboard model, is not normally applicable in a larger area.
Can you elaborate, Obviously this solutiojn would be soldered onto a perfboard. I have tested latching the circuit through ethernet lines running through my house already and I was successful in both sending the message through the lines and sending the message through firmata.

Quote
Don't forget fuses, or you risk failure of your entire installation on a local problem.
Where would fuses be added to the circuit?

Quote
I'd suggest RS485 from the master out to the remotes, with the remotes having intelligence to receive a serial message and manage the relays from there. Way less wiring, each remote can be powered locally. Remotes can then report status too if you want to set up sensors, or have light switches that can be turned on manually at the remotes sites, temperature, etc.
Can make a little custom card with equivalent of a Promini, RS485 chip (MAX488 perhaps), wallwart for power, relay driver (shift register like TPIC6B595) and that can also control other things, some sensors, etc.
This is all a bit above my head...But it sounds similar to an idea I had, which I am not sure on its quality until I receive parts in the mail. But I brought a whole bunch of enc28j60 and arduino nano. One option i had was to firmata control the nanos in each wall cavity, that way I would run the cat 6 into the internet hub rather than an arduino mega and program my raspberry pi to connect to each specific nano based on the command/.

Quote
Using an opto would provide high reliability and could handle long cable runs. However, you'll need a separate power supply. Yeah, there'll be a practical limit to how many relays you would want to control like this due to the increased wiring and digital outputs required.
I like the circuit and it doesnt seem that much harder than the current one. Would you recommend implementing something like this? What do you mean on practical limit to how many relays I want to control like this?

From our original plan, it does look like I need to use another line for grounding.

So in a 3 gang switch, I would need 1 x hot, 1 x adapter ground, 1 x arduino ground, 2 pins x 3 = 9 lines, its a shame cat 6 only has 8. Maybe i can send arduino things through cat 6 and external power supply through phone cable?

Thank you for your time





Title: Re: Dual latch Relay Circuit Setup
Post by: DrDiettrich on Nov 23, 2016, 12:50 am
If you use Ethernet or some other kind of a network for communication, any controller with an Ethernet module can act as a server or client in such a network. Downside is the requirement of a controller on every node, that translates the commands into outputs to the actuators. It's up to you to specify the number of actuators, connected to each network node. Here a practical limit is the number of wires, and their length, required to drive the actuators. It may be handier to use multiple small controllers in a network, instead of one big Mega. No network cable and connectors are required to attach sensors and actuators to a controller, you can use whatever cable fits your needs. Control cables with more than 50 wires are available, but they are not very handy and useful when finally relays in different places shall be connected.

Next comes the power source for each node, for operating the controller, Ethernet shield, relays etc.  PoE is possible, but only with one voltage and limited current. AFAIK it also requires a splitter, to separate the power from the signal lines. In this case every node should have a fuse on its power line, so that an inadvertent short does not shut down the entire network supply. If higher voltage or current is required by an actuator, a local power supply is required on such nodes, at least a step-up or step-down regulator, or a wall wart or other mains supply.
Title: Re: Dual latch Relay Circuit Setup
Post by: Mikie_lomas on Nov 23, 2016, 01:05 am
Quote
Next comes the power source for each node, for operating the controller, Ethernet shield, relays etc.  PoE is possible, but only with one voltage and limited current. AFAIK it also requires a splitter, to separate the power from the signal lines. In this case every node should have a fuse on its power line, so that an inadvertent short does not shut down the entire network supply. If higher voltage or current is required by an actuator, a local power supply is required on such nodes, at least a step-up or step-down regulator, or a wall wart or other mains supply.
I am at a crossroads as the two most helpful people on this thread are giving differing advice.

It would be useful to have a controller in each wall cavity, as I could add things like temp sensors (even to monitor the project), currents sensors to check the state of the switches. But it definitely does complicate the whole situation. As opposed to sending the pulses from the controller and treating the cat 6 as just a long reliable signal and power cable.

As lloyd said, each pulse only requires .125 A, with 7 volts the voltage drop will lower to acceptable standards for the relay.

I originally had the idea of shooting a strong voltage through the line and stepping up or stepping down at the end depending on what was required, but it is relying on too many indivudal modules.

LLoyds idea seems solid of the main arduino, but you have wigged me out a bit with the requirements of fuses.

I am a bit lost on this, do you mean I just get a fuse which is rated for the Lowest Amp of any part within my system and place it in series. Ergo it busts before any of the aprts reach their rated limit? Are fuses that meet the requirements expensive?
Title: Re: Dual latch Relay Circuit Setup
Post by: dlloyd on Nov 23, 2016, 02:40 am
Quote
I like the circuit and it doesnt seem that much harder than the current one. Would you recommend implementing something like this?
Yes, I recommend using opto drivers, especially if using one main Arduino that controls "dumb" (non-MCU) relay modules at various distant locations.

Quote
What do you mean on practical limit to how many relays I want to control like this?
I just meant that there's a practical limit on how many wires you'd have to deal with.

Quote
So in a 3 gang switch, I would need 1 x hot, 1 x adapter ground, 1 x arduino ground, 2 pins x 3 = 9 lines, its a shame cat 6 only has 8. Maybe i can send arduino things through cat 6 and external power supply through phone cable?
Yes, that's a good possibility. Also, the phone cable would be totally isolated from the cat6 (the cat6 wiring is the input side of the opto, the phone cable is the relay coil +DC and ground).

Quote
I am at a crossroads as the two most helpful people on this thread are giving differing advice.
Could use a hybrid solution. One master MCU communicating with slaves that cover an area (room or floor/level). Each slave MCU would would control how many relays are required for each area through cat6.

You'll need to think of your overall project and what's important ... future expansion, controlling other sensors, status indicators, installation issues, cost, reliability, safety, etc.
Title: Re: Dual latch Relay Circuit Setup
Post by: Mikie_lomas on Nov 23, 2016, 03:26 am
Quote
Yes, I recommend using opto drivers, especially if using one main Arduino that controls "dumb" (non-MCU) relay modules at various distant locations.
So basically they work with the same script, just by using the circuit you provided recently?

Quote
Yes, that's a good possibility. Also, the phone cable would be totally isolated from the cat6 (the cat6 wiring is the input side of the opto, the phone cable is the relay coil +DC and ground).
So if I did go down the master slave design, would I power the arduino and the relay from the same supply line from the phone cable or would I send the arduino power through cat 6 and relay power through phone (if i did go down that route).

Quote
Could use a hybrid solution. One master MCU communicating with slaves that cover an area (room or floor/level). Each slave MCU would would control how many relays are required for each area through cat6.
A.Basically it is down to having a nano for each cavity that controls the relays within its area, with a mini enc28j60 ethernet which i use to control each arduino through firmata signals sent from raspberry pi C# app, where the arduino is powered via phone line cable and and ethernet cable is run which connects to the main internet of the house. This sounds alot safer than having a step down transformer or inner wall cavity mains socket with phone charger to power nano.

or

B. Having the main Mega, connected to firmata through ethernet. Cat 6 to every wall cavity from the arduino, with arduino also plugged in is 7.5v adapter which is sent out through phone cables. Rather than one master raspberry pi sending messages to slaves all around the house. There is one master pi , one slave mega with arms that go around the roof into each wall cavity.

I feel as if B for a simpler and maybe more solid and A should I want to add current sensors and motion sensors and temp sensors.

In this hybrid design. Would a 3 gang be

Ethernet firmata into home internet network + phone line cable 2 of 4 sending arduino current and 2 of 4 sending relay current.

Arduino Hot -> Arduino Ground -> Relay Hot -> Relay ground

thank you for all your help

EDIT: Where do fuses go in circuit?






Title: Re: Dual latch Relay Circuit Setup
Post by: dlloyd on Nov 23, 2016, 04:32 am
Regarding the opto circuit ... its untested. I'd recommend testing a breadboard version with a long cable to see how it performs and see if any revisions or fine tuning is necessary.

Lots of decisions to make. Perhaps make a list of everything you would need to control (outputs) and monitor (inputs). Then create a block diagram showing how everything could interconnect. This would help when working on a more detailed schematic.
Title: Re: Dual latch Relay Circuit Setup
Post by: Mikie_lomas on Nov 23, 2016, 05:58 am
Thank you so much everyone for all your help.

Now i guess i just have to wait the 1-10 weeks for my optos to arrive.

This is a simplified version of one of the options.

Title: Re: Dual latch Relay Circuit Setup
Post by: CrossRoads on Nov 23, 2016, 07:37 am
Where are you and where did you order from? Digikey.com and Mouser.com could have them to you in mere days,
Title: Re: Dual latch Relay Circuit Setup
Post by: Mikie_lomas on Nov 23, 2016, 07:54 am
Yes digi and or mouser are awesome especially mouser. Except I need to order over 60 dollars in order for it to be free.

So i ordered from china. 2-3 x wait time, but free delivery and 1/10 the price.

But when the time comes to make a list of all the parts I need I will be hitting mouser up for sure.
Title: Re: Dual latch Relay Circuit Setup
Post by: Mikie_lomas on Nov 23, 2016, 03:01 pm
I have loaded my current design..

I have decided to see if I can get the modules custom made in china and then delivered. I can not find any board that fits the spacing of my relay.

I am not sure  if you guys will be able to open this, but hopefully you will.

Wouldnt let me save. Changed to png