Pages: [1] 2   Go Down
Author Topic: Listening to 12V Signals with Optocouplers?  (Read 1272 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 20
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

hi guys,

i am currently trying to figure out if i am doing this correctly or if i am missing something. Goal is to safely listen to various ~12V DC signals in my car. As most people know this voltage can vary quite a bit and i wanted to protect the arduino from any damage with some optocouplers:

I will use Arduinos Input_Pullup function which basically sets the digital PIN to high and put a 22k resistor in line.

my first draft:
the question is if i need indivual Resistors on the 12V side? or if i could simply use a single 10K (or other value?) to limit the current from the 12V lines.





Logged

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

Quote
the question is if i need indivual Resistors on the 12V side? or if i could simply use a single 10K (or other value?) to limit the current from the 12V lines.

Each individual opto needs it's own input current limiting resistor. By the way I would think 1k ohm resistors would be closer to the correct value Vs 10K ohms, but check the opto's datasheet for recommended led forward current operation.

Nice drawing by the way.

Lefty

Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 20
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

this is the alternative and would save a couple of resistors... (need to listen to more than 3 inputs...)

Logged

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

Quote
this is the alternative and would save a couple of resistors... (need to listen to more than 3 inputs...)

No, that way would suck.

Lefty
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 20
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

i have received some fast replies but never one in between my two post of asking one question lol.


the datasheet says:
Forward current IF 60 mA
http://www.vishay.com/docs/83606/cny17.pdf

i am assuming the goal is here to undershoot a little bit? and take into account the voltage fluctuations as well? so lets say for a car maxV = 16 and that should give me about 50mA?
so V = IR
16/0.05 = 320Ohms?

i must say 60mA sure seems high for a tiny little led in an IC?



Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 20
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
this is the alternative and would save a couple of resistors... (need to listen to more than 3 inputs...)

No, that way would suck.

Lefty

figured as much....could you give me some input as to why "it would suck" ..just trying to get my EE straight smiley
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 485
Posts: 18800
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Judging by the table on page 3, 10 to 20 mA should be plenty.
Logged


Global Moderator
Offline Offline
Brattain Member
*****
Karma: 485
Posts: 18800
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Their test conditions quote 10 mA, not 60. I think 60 is the absolute maximum.
Logged


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

i have received some fast replies but never one in between my two post of asking one question lol.


the datasheet says:
Forward current IF 60 mA
http://www.vishay.com/docs/83606/cny17.pdf

i am assuming the goal is here to undershoot a little bit? and take into account the voltage fluctuations as well? so lets say for a car maxV = 16 and that should give me about 50mA?
so V = IR
16/0.05 = 320Ohms?

i must say 60mA sure seems high for a tiny little led in an IC?





No, that 60 ma listed in the absolute maximum rating section and is the value if exceeded would destroy the device. Later in the datasheet showing typical operating conditions it states 'test condition', IF = 10 mA. So that is a good target value to shoot for. So at a nominal 12volt supply voltage resistor would equal to  (12-1.4) / .01 = 1,060 ohms, so my guess at 1K ohm resistors was right on.  smiley-wink

Lefty
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 485
Posts: 18800
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
... so my guess at 1K ohm resistors was right on ...

And that's experience for you! I would have reached for the calculator. smiley-wink
Logged


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

Quote
this is the alternative and would save a couple of resistors... (need to listen to more than 3 inputs...)

No, that way would suck.

Lefty

figured as much....could you give me some input as to why "it would suck" ..just trying to get my EE straight smiley


Current would not be controlled evenly through each individual led, but rather hogged by some and starved from others. It's simply an invalid circuit. A single resistor sets the value of current that is allowed to flow and there is no way to make sure it's divided evenly among the optos that are switched on and even if there was magic balancing somehow, the number of optos active at any time is subject to the users switches so the individual leds would see a different current value depending on how many other optos were switched on, but again leds in parallel don't share nicely anyway so that is kind of mute.

Lefty
« Last Edit: February 14, 2013, 05:58:45 pm by retrolefty » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 20
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
this is the alternative and would save a couple of resistors... (need to listen to more than 3 inputs...)

No, that way would suck.

Lefty

figured as much....could you give me some input as to why "it would suck" ..just trying to get my EE straight smiley


It's simply an invalid circuit.

Lefty


this kinda felt like:



this is one lively forum! Thank you. Ill get on soldering that up and report back with some pictures smiley
Logged

Cumming, GA
Offline Offline
Edison Member
*
Karma: 20
Posts: 1655
Ultimate DIY: Arduino
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes Virginia, it really is possible to design a circuit that basically works and is also a sucky bad design at the same time.  I can make a bicycle wheel out of wood... and it would work,  ( HA! audible pun),  but that doesn't make it a good solution. 

I basically see that there are few very regular discussions here...   one of them is... "Why can't I use fewer resistors?".  I'm not going to answer... I'm just going to say that I am regularly surprised at how much effort is expended to want to pull out a part that costs $0.25 and will make a circuit behave reliably and predictably.  (which should always be the goal of a design)

For the curious:  This web page will start to explain why "so many resistors". http://en.wikipedia.org/wiki/Node_(circuits)
Logged

0
Offline Offline
Shannon Member
****
Karma: 206
Posts: 12179
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Before omitting pull-up resistors on the Arduino side of the opto coupler you need to be aware of several issues:

Internal pullups are poorly specified - could be anything from 20k to 50k

opto isolator photo-transistor will have a leakage current specification

If you multiply the worst-case dark-current leakage by the max internal pull-up value you'll
find out how many volts will be across the pull-up worst case for "off".  If that is a problem (could be
read as a logic LOW) then adding lower value physical pull-ups would be necessary
(in fact I'd add 10k pull ups anyhow, then I could test the opto couplers in situ with a multimeter
whether or not the code remembers to enable pull-ups).
Logged

[ I won't respond to messages, use the forum please ]

Offline Offline
Sr. Member
****
Karma: 9
Posts: 296
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
a part that costs $0.25

Where do you buy your resistors? That's expensive.

1/4w, 1% metal film, $0.02 at Mouser
or $0.07 for 1 Watt.
Logged

Pages: [1] 2   Go Up
Jump to: