How many relays until I need to opto isolate?

for the lurkers- Normally transistors need the base(switch) to be connected to a common ground (in some way). One way around this is to use an opto isolator which is just an emitter and photo transistor. The base is for lack of better words "removed" and light turns on the transistor which can isolate one part of your circuit from another given there are two power supplies.

My project is using a 1284p with several components hooked up to it. (humidity, temp, sd, rtc, encoder counting, and 3 reflective IR sensors)

Currently I have 4 relays on the board, I bought a second supply but completely forgot that the grounds still had to be common, which could still cause noise on my power rails and potentially reset the MCU if the voltage drops too much on the active low reset pin.

The relays operate on 5V and draw 50mA. At most I should be turning on 3 relays at a time. The supply (9v cell phone charger through a 5V 7805 regulator) supports 500ma max but I really don't want the relay coils wreaking havoc on my power rails.

My question is this, am I over reacting with the need to opto isolate 4 relays, or should I just risk the safety of the rest of my circuitry and use transistors?

Thanks for your time,

-Jeremy

My question is this, am I over reacting with the need to opto isolate 4 relays,

Yes, there is no need at all to use opto isolators when driving relays.

but completely forgot that the grounds still had to be common,

If you are making the grounds common that defeats to point of using opto isolators in the first place. To correctly use one you need a totally separate supply.

However, if you are getting interference you need to up the power supply decoupling. You do have diodes on the relay coils don't you.

yes flyback diodes are in place. I haven't run into any type of error, I just started this semester and got told by my professor "if the microcontroller keeps resetting don't freak out research opto isolators".

At the moment my Hbridge and 2 other relays are on the board I just have not hooked up power and tested it yet because of the info I got from my professor. My initial response to him was "can't I just filter the noise with a cap between Pwr & Ground?".

and yes, right now I'm using two supplys with relays,transistors,&diodes. The first supply goes to the components the second supply goes to the relays and grounds are common. I would have removed that common ground link between the relays and components when I hooked up the isolators...

My initial response to him was "can't I just filter the noise with a cap between Pwr & Ground?".

You can use inductors as well. http://www.thebox.myzen.co.uk/Tutorial/De-coupling.html

okay I just re-asked that question to my professor and this is what he said.

Lighting strikes on relay attached components stop at the isolator (makes sense).

Mechanical failure of a 120V relay operated by 5V can put 120V into your 5V circuitry.

and then he said decoupling almost always work & opto isolators always work. You have to find the right size capacitor, If it is too big then it won't work, if it is too small it can cause other problems, and the intermittent resets from can be so random that you end up troubleshooting other issues when it is your relay.

Lastly he left me with "opto isolators are the cure all".

penny for your thoughts?

Grumpy_Mike:

My initial response to him was "can't I just filter the noise with a cap between Pwr & Ground?".

You can use inductors as well. http://www.thebox.myzen.co.uk/Tutorial/De-coupling.html

caps oppose changes in voltage, inductors oppose changes in current. I'll stick with caps but thanks for the link ill check it out.

Edit: Good read, this explains what my professor was talking about with "why caps don't always work". Thanks again.

Ok bare in mind I was a University Professor as well as working in consumer electronics for a set top box manufacturer.

Lighting strikes on relay attached components stop at the isolator

No a direct lightning strike will piss through an opto isolator. I had to design antenna system front ends with much more isolation than an opto isolator will provide.

Mechanical failure of a 120V relay operated by 5V can put 120V into your 5V circuitry.

I can't see how that can possibly happen.

If it is too big then it won't work,

No that is an over simplification, too big is not a problem. However if your only capacitor is too big then the high frequency response will suffer.

the intermittent resets from can be so random that you end up troubleshooting other issues when it is your relay.

That can be true, but this is a controller not a micro processor.

aps oppose changes in voltage, inductors oppose changes in current.

You need both.

However, at the end of the day he is making your work and if he believes he is right then he is not likely to believe you and some random guy off the internet. However this is my CV http://www.thebox.myzen.co.uk/Site/About_Me.html

Is this 'device' going to be flying around during storms? or sit in a tree? Perhaps lighting will fry your components, but the probability of this happening is negligable in most cases (unless you asnwered 'yes' to my first questions). It sounds like the 9V DC power supply you are using is likely powered from the same 120V lighting-accessible circuit.

  1. What has the supply limitation of 500mA? The 9V DC Adaptor, or the 5Volt regulator? You are able to use the 9V directly if you use a resistor in series with the relay coil. Any voltage fluctuation at the input of the regulator should be reduced at the output.

The relays operate on 5V and draw 50mA.

Personally, I would say that, if you're gonna be controlling large voltages like the power mains, then use optoisolators from the getgo.

Secondly, in regards driving 5V relays from Arduino [ref, quote], I'd say it's probably an if-fy situation to try and drive 50mA loads. You should probably drive an NPN inverter with the Arduino I/O pin, and the 5V relay with the inverter.

Thirdly, now you're stuck with the situation of having to power the 5V relays from a separate power source than the Arduino, otherwise the optoisolators are useless. Maybe better to use the optoisolators to switch Triacs that switch the 120VAC loads, and forget the relays.

Fourthly, you still need additional protection [bypass caps and maybe transzorbs] on your Arduino I/O lines, if used in such a situation as described.

How many relays until I need to opto isolate?

Fifthly, I don't see that anything in the above messages has to do with the name of this thread. Optoisolation normally has to do with protection, not with how many relays are being driven.

eh its my senior project, the design is my baby not his and his expectations have been met twice over. We are engineering tech, a BS degree not a ES degree so we tend to simplify things(and he did refer me to another professor for the over simplification part). I also tend to do my research before I ask my professor questions. He is a good friend and we sit after class sometimes and chat for hours.

he is however a micro processor man before he is a micro controller man. I see what your saying about troubleshooting.

and he did admit decoupling would work, he just didn’t mention it the first time around.

p.s. I said lighting strike not direct lighting strike :grin: so that point does have some merit.

and Jonny, I have the components to make over 20 arduinos so a 7805 is easily on hand and lets me be lazy by avoiding ohms law and voltage dividers… I would want to use a voltage divider by the way with two resistors, how do you plan on doing it with one in series?

and oric you cant drive 40ma loads with the arduino. You control a transistor which drives the load. Its okay with the 2 supplies I’ve owned many cell phones in my day and save the chargers… and eh, triacs are expensive and its on a breadboard. I don’t mind troubleshooting relays… why would i need bypass caps and transzorbs on an I/O pin that is only connected to the emmitter(LED) of an opto isolator

and no it stays outside next to trees and monitors/controls my garden.

lets me be lazy by avoiding ohms law and voltage dividers... I would want to use a voltage divider by the way with two resistors, how do you plan on doing it with one in series?

Do not power anything using a voltage divider, it is a bad move. This is because to get any sort of regulation the current down the chain has to be at least 10 times the current you plan on extracting from the chain. This is not only very wasteful, requires big resistors that will get hot but also the voltage regulation is very poor.

One series resistor will limit the current but again will provide very poor voltage regulation. Using a 7805 is not lazy it is the right way to do it.

I did not say to power from voltage divider...I'm suggesting to remove the relay coils from the 5Volt regulator circuit (which I'm assuming your microcontroller is powered from) and move it to the 9Volt regulator; Use a resistor in series with the coil at this point to create the proper voltage drop for the relay. Any transient events introduced by the relays at this point do not effect the arduino's power rail. I am assuming that you had the relay coil powered from the same 5V regulator as the microcontroller.