Pages: [1]   Go Down
Author Topic: Does input via optocoupler need a pullup resistor ?  (Read 2229 times)
0 Members and 1 Guest are viewing this topic.
South Africa
Offline Offline
Sr. Member
****
Karma: 2
Posts: 416
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

A recent discovery of a floating wire got me thinking along these lines :

A input from an external sensor, that connects Ground to the Input wire when triggered, is connected to an optocoupler ( see attached pic ).

If the external sensor is not triggered, then the wire would effectively be floating.

However, the Arduino on-board pull-up resistors are of little use, as the wire from the sensor is effectively isolated from the Arduino.

My initial thought was that each of the different sensor wires would need a separate 10K pull-up resistor to keep it high. But with the optocoupler, the 390ohm resistor between 5V+ and the 4N25 pin 1 ( anode ) and the connection from pin 2 ( cathode ) to the floating / "not connected to ground" sensor wire, should keep the floating wire at a high level ? - or is the floating cathode wire not connected to anything until it is connected to Ground and current starts to flow ?

Does this sound correct ?


* floating1.jpg (12.58 KB, 375x277 - viewed 309 times.)
Logged

The Netherlands
Offline Offline
Edison Member
*
Karma: 51
Posts: 1729
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

An optocoupler is most of the times used for isolation of circuits.
If you wired it up anything close to that drawing, the optocoupler can as well be replaced by some transistor (which saves you some money).
The power lines from the transistor output of the opto and that of the LED are to be separated.
Leave one end of the LED to some level (through a resistor), and control (/switch) it at the other side, exactly as drawn.
Just leave the LED and the transistor separated.
Logged

Have a look at "blink without delay".
Did you connect the grounds ?
Je kunt hier ook in het Nederlands terecht: http://arduino.cc/forum/index.php/board,77.0.html

South Africa
Offline Offline
Sr. Member
****
Karma: 2
Posts: 416
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

An optocoupler is most of the times used for isolation of circuits.
If you wired it up anything close to that drawing, the optocoupler can as well be replaced by some transistor (which saves you some money).
The power lines from the transistor output of the opto and that of the LED are to be separated.
Leave one end of the LED to some level (through a resistor), and control (/switch) it at the other side, exactly as drawn.
Just leave the LED and the transistor separated.


Thanks.

So you are saying that the 5V+ and the Ground should be separated / split between the Arduino and the external sensor.

I can understand the logic for that.

However, my concern is still the floating wire between pin 2 ( cathode ) and the external switch / sensor / button / whatever - until the switch / sensor is activated, the wire would float and could cause false signals ?
« Last Edit: April 25, 2013, 04:26:11 pm by DaveO » Logged

Offline Offline
Edison Member
*
Karma: 37
Posts: 1354
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
So you are saying that the 5V+ and the Ground should be separated / split between the Arduino and the external sensor.
If there is any electrical connection between either side of the opto-isolator, it's not isolated.   

It can "work", but the LED-side of the optoisolator needs it's own separate power supply and it's own separate ground, or else you're not electrically isolated. 

Quote
However, the Arduino on-board pull-up resistors are of little use, as the wire from the sensor is effectively isolated from the Arduino.
The internal pull-up should work fine with the optoisolator.

If your "sensor" is shown accurately as a pair of contacts (and if you don't need isolation) the sensor should also work directly into the Arduino with the internal pull-up (and no other components).  i.e. If it can pull-down the LED inside the optoisolator and turn it on, it should be able to pull-down the (internally pulled-up) Arduino-input.   It's actually "easier" to pull-down the Arduino input than to turn-on the optoisolator's LED (it takes less current).

If it's truly a relay and there are no other connections to the contacts, it's already isolated.   A relay provides mechanical isolation, since there is no connection between the relay-coil and the relay-contacts.
« Last Edit: April 25, 2013, 05:07:59 pm by DVDdoug » Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 362
Posts: 17307
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

 As stated that drawing is an incorrect example of using an opto-isolator in that both sides of the circuit are using the same +5vdc and ground bus. If you break the +5vdc and ground bus and have each half of the circuit powered from seperate +5vdc power supplies then the opto-isolation would be realized. And as already stated if the sensor's output is actually a 'dry contact' output then there in no need for the opto-isolator in that isolation is already being realized by the relay output of the sensor.

 And finally to your question of if can having the input to an opto-isolator 'floating' cause a problem the answer is no. The led input represents a pretty low impedance input and and 'floating input noise' would not be enough to ever turn on the input led.

Lefty
Logged

Fort Worth
Offline Offline
Newbie
*
Karma: 0
Posts: 21
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Under No Circumstances Should the opto-coupler input anything be tied to the output anything!!!!!! smiley-eek
An old 4N35 opto-coupler has about a isolation voltage of more than 1kv! see the datasheet. http://measure.feld.cvut.cz/groups/edu/osv/4n35.pdf  so you would have to bring both connections that is the led's anode and cathode out to your connector then in the other side of the world thats where both the power (yes pulled up) and the contact back to the other worlds ground.

me I drive aircraft lights at 24vdc. via the 4n35 so I have a power supply that delivers 24vdc and it goes to the collector and emitter junctions. while the anode and cathode gets driven via my logic.
you can find out more stuff like this at:
http://www.element14.com

enjoy
Cris H.  smiley-cool

Logged

Offline Offline
Faraday Member
**
Karma: 66
Posts: 2588
Now, More Than Ever
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Dave,

You don't have to "worry" about "floating" the input/IRED.  It's not "floating", with the relay contacts open - it's open circuit.  No more subject to "false signals" than a flashlight.  That IRED/LED won't go on without a solid connection to Ground.

The input and output of the optocoupler don't have to be "isolated" either, unless for some reason that's required.
The Arduino Gnd could be in common with a separate power source's Gnd, with an optocoupler "between" them.
Logged

"Hello, I must be going..."
"You gotta fight -- for your right -- to party!"
Don't react - Read.
"Who is like unto the beast? who is able to make war with him?"

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 362
Posts: 17307
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
The Arduino Gnd could be in common with a separate power source's Gnd, with an optocoupler "between" them.

It will work having a common ground connection but it defeats the purpose of using a optocoupler in the first place. It makes little sense to use an optocoupler and then defeat the isolation via sharing a voltage or ground connection between the input to output circuits.

Lefty
Logged

Offline Offline
Faraday Member
**
Karma: 66
Posts: 2588
Now, More Than Ever
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

From the looks of it, the opto bit isn't necessary, as the input and the output are working from the same +5 and Ground.
So, I just answer questions, allay fears - suggesting re-designs can be a touchy matter.
Logged

"Hello, I must be going..."
"You gotta fight -- for your right -- to party!"
Don't react - Read.
"Who is like unto the beast? who is able to make war with him?"

South Africa
Offline Offline
Sr. Member
****
Karma: 2
Posts: 416
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Many Thanks to all again for the feedback. Really appreciated and I am learning so much from you experts.

My 12V supply powers most of the external components ( sensors, sirens, etc ). It then also goes to an LM7808 Voltage Regulator, and then the output from there to an LM7805 regulator.

The 8v is supplied to the Arduino Mega 2560 ( Vin pin ).

The 5V is used for the optocouplers, power for 2 x 8 relay boards, powering LCD display, one-wire temperature sensors, etc.

But all 3 of the above ( 12, 8 and 5 V ) all share a common Ground.

My reasoning for using the optocouplers was that the cables from my central board to the sensors can be up to 40 meters ( 120 ft ) and I was concerned about anything that could happen over that distance, and what quality of signal could be returned to the Arduino. In addition, any shorts or faulty sensors that suddenly send 12V down the line, would be prevented from damaging the Arduino by the opto.  I have already seen monkeys chewing wiring in the area, so must plan for that possibility.

However, from the posts received, and from my understanding, any commonality between the 3 'systems' is not good and virtually nullifies any protection by the opto.

Question :  Would the voltage regulators on the positive line contain reverse blocking characteristics, thereby protecting the Arduino's 8V supply from anything that happens in the 5V system ?  If so, is the common Ground then my only weak point, and is it possible to 'plug the hole' with a diode or similar component to separate the Ground in the 3 systems ?
Logged

Offline Offline
Full Member
***
Karma: 2
Posts: 121
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

the cables from my central board to the sensors can be up to 40 meters ( 120 ft ) and I was concerned about anything that could happen over that distance, and what quality of signal could be returned to the Arduino. <snip> I have already seen monkeys chewing wiring in the area, so must plan for that possibility.
Raising the voltage might be beneficial for both of these situations.  smiley-twist

Sorry, couldn't help myself.... smiley-red
Logged

South Africa
Offline Offline
Sr. Member
****
Karma: 2
Posts: 416
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I did see a few move a bit faster when they discovered the new electric fence a few months back, so that definitely gets their attention.

Do you think that 8000V to the Arduino would be a problem  smiley ?
Logged

Offline Offline
Full Member
***
Karma: 2
Posts: 121
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Not if you use the opto coupler correctly.  smiley-grin
Logged

Pages: [1]   Go Up
Jump to: