Sciencemadness Discussion Board
Not logged in [Login ]
Go To Bottom

Printable Version  
Author: Subject: optocouplers
sodium_stearate
Hazard to Others
***




Posts: 160
Registered: 22-4-2011
Location: guard duty at the checkpoint
Member Is Offline

Mood: "may we see your papers, please?"

[*] posted on 16-12-2018 at 13:17
optocouplers


Yes, by all means the use of an optoisolator
(also known in the industry as an optocoupler) will
provide a solution to your situation.

A plain ordinary optocoupler such as 4N35, which is a 6-pin
DIP, can be used.

The input side is an infa-red LED. That is on pins 1 and 2.
Pin 3 is not connected. Pins 4 and 5 are the emitter and
collector of the output's phototransistor. Pin 6 is the base
of the phototransistor. Pin 6 is not often needed so most
applications just leave pin 6 open.

Here is what I'd try first:

Operate the input LED from the 24 volt side using
about a 10k series resistance. That will allow about
2.4 milliamps to flow, which should be sufficient to
shine across and turn on the phototransistor.

One the output side which is connected to your 5 volt
supply, ground pin 4 to the negative terminal.

Connect pin 5 to the +5 volt side through series resistance
of 10 k. When the output transistor is turned on, the
voltage at pin 5 will be quite close to zero. When the
transistor is turned off, pin 5 will be pulled to +5 volts.

From there, you can connect pin 5 to the input side
of a 4049, or a 4050 cmos buffer ic, depending upon
what sort of output (high when on or low when on)
you want. From there the output of the buffer can
be connected to the gate of a mosfet, which has its source
grounded and it's drain connected to a small 5 volt relay
coil the other side of which is connected to +5 volts.

I use mosfet BS-170 for this. small 5 volt relays can
be found which have coil resistance of around 180 ohms
for a few dollars.

NOTE! There MUST be a reverse-biased diode across
the relay coil to snub out the reverse-polarity "kick"
that the coil makes each time it is shut off. Without the
snubber diode, the coil kick will instantly destroy the mosfet
the first time it turns off. A small signal diode such
as 1N4148 or 1N914 works well for this. Also a 0.1 microfarad
capacitor across the relay coil helps to reduce that spike.
I always use both of those across any relay coil operated
by a mosfet.

The optocoupler operates the relay via the buffer and
the mosfet.
Meanwhile, your 5 volt side and your 24 volt side
remain completely electrically isolated.

The above scheme has been used here for many years
on many various applications. It is highly reliable.

More info available if needed.

[Edited on 16-12-2018 by sodium_stearate]




"Opportunity is missed by most people
because it is dressed in overalls and it
looks like work" T.A. Edison
View user's profile View All Posts By User
Intergalactic_Captain
Hazard to Others
***




Posts: 228
Registered: 4-9-2004
Location: somewhere where i don\'t know where i am
Member Is Offline

Mood: frabjous

[*] posted on 17-12-2018 at 09:19


Excellent! Way more information than I thought I needed to know. I wish you didn't hit the wrong button, else I would have caught this before I replied to my thread.

Can you elaborate on the buffer scheme though? I had not thought that my design would require that previously, but on second thought all those milli-volts/amps/ohms could add up to bite me in the ass.

MODS - Please merge this with "I need help with optoisolators"

[Edited on 12-17-18 by Intergalactic_Captain]




If you see me running, try to keep up.
View user's profile View All Posts By User
Photonic
Harmless
*




Posts: 36
Registered: 29-5-2016
Member Is Offline

Mood: No Mood

[*] posted on 14-4-2019 at 11:34


Depending on the optocoupler used you may not need a buffer. Typically relays use a significant amount of current which is much higher than what is required to drive a logic device such as a microcontroller.

What is a buffer? A buffer in this context is a device that takes a small signal such as that provided by a microcontroller, and allows outputting higher power levels such as those required to drive a rfelay.

Buffers can help protect delicate outputs, they can be used to provide isolation (protect from high voltages, safety, etc). There are many types of buffers. A transistor could also be considered a buffer.

Why would you want a buffer? We will use the microcontroller for examples. In an arduino you have a maximum limit of current that you can source (send out), or sink (take in, short to ground). You typically have several "absolute limits". Maximum current per device, per bank of outputs, and per individual output. If you exceed this you could let the proverbial magic smoke out and it will destroy the device or channel/output/pin.

This is where the buffer comes in. You send that small signal to the buffer and the buffer handles the heavy lifting.

Now on to driving the relay. Why do you care about adding protection to it? Well an electro-mechanical relay uses a magnetic coil to actuate the mechanism. This presents an inductance to the device switching the signal. Inductors resist changes in current by generating a voltage. What does this mean? that means that when you turn it off you will get a voltage proportional to the change in current over time (dI/dT) multiplied by the inductance. If not snubbed, or protected with a reverse polarity diode this too can also blow up your input.

The typical method to handle a typical relay is just to throw a diode i.e. 1N4007 or similar reversed against the coil. (So it only conductors when a reverse voltage is present.

This back-EMF (electro-motive force) is also how switch mode power supplies work. Capacitors have similar yet opposite mode of operation (resist changes in voltage by generating a current). They too can also be used for power conversion (charge pumps).
View user's profile View All Posts By User

  Go To Top