Go Down

Topic: 4n35 Optocoupler as Switch (Read 1 time) previous topic - next topic

Tinkering

Hello..

Im working on a project that is going to use a bistable (locking) relay in a 5/12V DC application.  I would like to test if the relay is providing power.  My thought was to use a 4n35 and hook pins 1,2 with proper resistor to the relay power output side.  Can the base and emitter on the 4n35 act as a NO/NC switch that I can test with a digital pin on an esp-12e?

larryd

No technical PMs.
If you are asked a question, please respond with an answer.
If you are asked for more information, please supply it.
If you need clarification, ask for help.

DVDdoug

You also need a pull-up resistor on the output (collector) as shown in Larry's link and the easiest thing is to enable the Arduino's internal pull-up.   Without a pull-up there is no voltage to "switch".  ;)

And you connect to the collector & emitter.   It's a photo-transistor so there's normally no electrical connection to the base.

avr_fred

#3
May 04, 2018, 11:41 pm Last Edit: May 04, 2018, 11:42 pm by avr_fred
What does the opto buy you? You're already got a relay that provides isolation. A resistive divider may be a cleaner solution. All things considered, without a schematic, all you're getting are guesses as to the appropriateness of an optocoupler.

Further, depending upon the relay design, I'd be concerned that's not enough current to ensure proper contact engagement since power relays cannot be counted on to switch microamp signal levels.

Tinkering

What does the opto buy you? You're already got a relay that provides isolation. A resistive divider may be a cleaner solution. All things considered, without a schematic, all you're getting are guesses as to the appropriateness of an optocoupler.

Further, depending upon the relay design, I'd be concerned that's not enough current to ensure proper contact engagement since power relays cannot be counted on to switch microamp signal levels.
I agree the relay is already providing the isolation.  The circuit is pretty straight forward.  esp-12e triggers relay via low pulse (see below), load power is then applied to device I want to control.  Since the relay is latching you never know what position it is in.

https://www.ebay.com/itm/1ch-5V-Latch-Relay-Module-Flip-Flop-Bistable-Self-locking-Trigger-Switch-Board-/112234912755

avr_fred

#5
May 05, 2018, 03:58 pm Last Edit: May 05, 2018, 04:01 pm by avr_fred
Thank you for the link, most helpful.

As with most eBay stuff from China, the reality and the description are two different things. What you have there is a not true bistable/latching relay. No, it's your run of the mill 50 cent 5 volt relay with some mystery four leaded device that does the trigger/hold of the relay. A true bistable relay holds its position without power, the relay you've linked to does not and it will always be off upon power up.

The bad news is that this relay will require 60-80ma at all times when the relay is engaged. If you had intended to use this as a zero power latch for battery operation, it's not going to work.

The good news is that it will most likely not need more than a few milliamperes on the trigger signal pin to get it to change state. You'll need to source current to the trigger pin so given the original connection diagrams, a low digital output to the opto input led will active the relay rather than a digital high.

Edit: You could always read the coil voltage thru a voltage divider to know the relay state, if that matters to you.

Tinkering

#6
May 05, 2018, 04:15 pm Last Edit: May 05, 2018, 04:18 pm by Tinkering
Thank you for the link, most helpful.

As with most eBay stuff from China, the reality and the description are two different things. What you have there is a not true bistable/latching relay. No, it's your run of the mill 50 cent 5 volt relay with some mystery four leaded device that does the trigger/hold of the relay. A true bistable relay holds its position without power, the relay you've linked to does not and it will always be off upon power up.

The bad news is that this relay will require 60-80ma at all times when the relay is engaged. If you had intended to use this as a zero power latch for battery operation, it's not going to work.

The good news is that it will most likely not need more than a few milliamperes on the trigger signal pin to get it to change state. You'll need to source current to the trigger pin so given the original connection diagrams, a low digital output to the opto input led will active the relay rather than a digital high.

Edit: You could always read the coil voltage thru a voltage divider to know the relay state, if that matters to you.
Yes, ebay china stuff isnt all that great.  My first experience with bistable/latching relay.  I wouldve seen its power usage during some tests.  What would you recommend for my car application for a zero power latching relay?  In my parts box I have some of those 5v relays and some 12v car relays.

Lastly the voltage divider/4n35 was going to go on the load power side to detect the relay has switched and NO is providing power.

Next time Ill have a wiring diagram

avr_fred

I'm not necessarily discouraging eBay but many times the stuff isn't what they say it is. It can be a great resource when you're on a budget. Just remember the old phrase "buyer be aware" as it really suits the situation.

Project requirements drive part specs and since you haven't provided any details, there is little point in speculating.

FWIW, here is a DigiKey parametric search of the dual coil relays with contacts above 2 amps, sorted by price. These search tools are the easiest way to find a part for a specific application.

Digikey latching relay search

Tinkering

#8
May 05, 2018, 10:42 pm Last Edit: May 05, 2018, 10:43 pm by Tinkering
I'm not necessarily discouraging eBay but many times the stuff isn't what they say it is. It can be a great resource when you're on a budget. Just remember the old phrase "buyer be aware" as it really suits the situation.

Project requirements drive part specs and since you haven't provided any details, there is little point in speculating.

FWIW, here is a DigiKey parametric search of the dual coil relays with contacts above 2 amps, sorted by price. These search tools are the easiest way to find a part for a specific application.

Digikey latching relay search
I looked through digikey which I have used before.  Didnt find anything that seemed appropriate.  I decided to draw a quick diagram.  Can you look at the below and give any recommendations?

https://imgur.com/p3yvItV

outsider

How do you plan to power the relay coil(s)? Is the esp-12e outputs 5 or 3.3V?

Tinkering

How do you plan to power the relay coil(s)? Is the esp-12e outputs 5 or 3.3V?
3.3v is esp12e.  Was planning on using cars 12vdc for the relay

outsider

So you're going to buy a relay with 12V coil(s), you will need transistor(s) to switch the 12V coil current with the 3.3V esp-12e outputs. Correct?

midiean

#12
May 06, 2018, 04:58 am Last Edit: May 06, 2018, 05:09 am by midiean
I've been using this for my 12v power applications. works pretty good for the lower amperage stuff. still working on figuring out some of my higher amperage projects with it.

newegg

Wawa

I've been using this for my 12v power applications. works pretty good for the lower amperage stuff.still working on figuring out some of my higher amperage projects with it.
Higher, but not too high.
That board uses older style IRF540 mosfets with a rather high 'on' resistance.
Wise to keep the load under 10Amp.
Leo..

TomGeorge

#14
May 06, 2018, 12:39 pm Last Edit: May 06, 2018, 12:41 pm by TomGeorge
Hi,
Welcome to the forum.

Please read the first post in any forum entitled how to use this forum.
http://forum.arduino.cc/index.php/topic,148850.0.html

OPs Circuit;

Can you please post a copy of your circuit as a picture of a hand drawn circuit in jpg, png?
Your hand has more component symbols in it than any CAD or picture program.

Tom.... :)
Everything runs on smoke, let the smoke out, it stops running....

Go Up