Interfacing 5V to unknown 10-30V signal

I'm trying to interface a bunch of industrial sensors (that I don't physically have) to a piece of 5V logic. I don't have specs on these sensors, but I am _told_ that they range between 10-30V supply voltage, and they drive low when sensing whatever it is they key on.

So when the sensor is inactive, it will either be driving its output at somewhere between 10-30V, or the output will be open circuit. When the sensor goes active, it will pull the output low.

Does this seem like a reasonable approach to the problem:

formatting link

(The optoisolator is a speced requirement).

Sorry this question is rather vague, but I don't have sufficient information about the topic myself yet to be specific :(

Reply to
larwe
Loading thread data ...

voltage,

at

the

As Jim Thompson says, the circuit will work fine. I'd put the diode in parallel with the transistor's base-emitter junction, rather than in series with the resistor as you have done - you do get some leakage current through the diode, and that could be enough to slowly degrade the gain of the base-emitter junction of the transistor.

Using the diode in shunt avoids this hypothetical problem, at the cost of a steady current drain through the resistor when the sensor is inactive.

If you wanted to avoid this extra current drain you could combine the series diode with a shunt diode, but this is a rather belt-and-braces approach.

------ Bill Sloman, Nijmegen

Reply to
bill.sloman

The "tranny" is redundant unless you need a lot of current gain. Otherwise you're fine.

...Jim Thompson

--
|  James E.Thompson, P.E.                           |    mens     |
|  Analog Innovations, Inc.                         |     et      |
|  Analog/Mixed-Signal ASIC's and Discrete Systems  |    manus    |
|  Phoenix, Arizona            Voice:(480)460-2350  |             |
|  E-mail Address at Website     Fax:(480)460-2142  |  Brass Rat  |
|       http://www.analog-innovations.com           |    1962     |
             
I love to cook with wine.      Sometimes I even put it in the food.
Reply to
Jim Thompson

Where does that 5V supply come from? If it is your logic supply voltage then you have defeated one of the purposes of the opto-coupler, which is to electrically isolate the two systems (the other purpose is to protect the input). Try to get some power from the signal source, or supply your own using a a transformer-isolated supply (or even a battery).

The transistor may be redundant. If your signal source can sink 1 mA or so then try this:

SOURCE +V .--OC---. | R | | '-///---| +ve | | | SIGNAL --|

Reply to
Joseph Legris

Standard MO is to take an NPN transistor (2N2222, 2N2369). Emitter grounded.

3.3K from collector to +5. Another 3.3K from base to ground. Series resistor of 10K from base to your 10 - 30 V signal. The output on the collector will be inverted from the input. If you want to use an opto isolator, drive it from the 10 - 30 V signal directly, through a current limiting resistor.

Tam

Reply to
Tam/WB2TT

1) The optoisolator is not so valuable when it isn't actually isolating. Your use of 5V on the "isolated" side may be doing an end-run around the isolator if that 5V supply is not isolated from the main supply. Putting the transistor (as opposed to driving the LED directly) and relatively high-value resistors in there will make that effect less important, but the isolator really isn't doing much in this case if the supply isn't isolated. 2) As Bill Sloman suggested, I'd put the diode in parallel with the B-E junction. 3) Preferably use a 1/4W resistor or larger for the series resistor to the input, the others can be 0201 if you like. 4) There are also sensors that work the exact opposite of this type (source current), but they are relatively uncommon.

A real bulletproof design might use an isolated supply or a two terminal current source on the (truly) isolated side. The latter would have to protected against transients.

Note that none of these circuits necessarily provide a really clean logic signal (if you use a ST optocoupler they will, but that's a bit more expensive). If you use a 4N25 type optocoupler they will be vulnerable to noise during the transition. You can probably handle that in software. Read a bunch of application notes on optocouplers if you're not familiar with them. You need to design plenty of margin in.

Best regards, Spehro Pefhany

--
"it's the network..."                          "The Journey is the reward"
speff@interlog.com             Info for manufacturers: http://www.trexon.com
Embedded software/hardware/analog  Info for designers:  http://www.speff.com
Reply to
Spehro Pefhany

Hi Joe,

There are numerous rails (+5, +10, +12, +24, +48, +90 and 95VAC) running around the appliance, because it is put together out of a lot of modules that weren't originally intended to be integrated. I didn't design the appliance, I merely have to add intelligence to it. I was planning to run that +5V along with the actuator signals, purely to power the interface (which would be on a separate, replaceable PCB). The main circuit itself has a totally separate power supply.

A few mA sink on the input should be no problem.

I have to firm up what exactly I am talking to here, it's very open-ended and I hate that. But thank you for the suggestion.

Reply to
larwe

Hi Spehro,

1) See other reply, the +5V shown here is a totally separate supply (it's part of the "actuator" side, not the "micro" side). Micro has its own supply.

2) -> 4) Thanks :) 0201 is really too small for me though. I'm pretty much standardized on 0603, with excursions to larger sizes only for high power ratings. No kind of space constraints in this system.

The last time I used an optocoupler was in 1994 so I'll look at some more modern app notes, but for this application I have 500ms to respond to a change of state on the sensor, so there's no rush.

Reply to
larwe

Hi,

Biting on the last sentence of your message: The reason I put in the transistor was because my thinking goes like this:

  • I don't know the exact voltage that will be present when the sensor is inactive. So I don't know what series R to use for the correct LED current. If I use an opto with built-in switching transistor, I'm basically going to wind up with the same circuit I have here discretely.
  • I don't even know if the input is capable of driving the line high. It might be the equivalent of an open-collector, or possibly even a mechanical relay output with the other contact connected to ground.
  • Therefore I need the transistor :)
Reply to
larwe

+5V +---+-----+------------- | | | .-. | | | | - | | | ^ | '-' | | | | |> +---+---| | | .-. | | | | | '-' | --> nasty stuff->o

If the external devices can source current it might be a good idea to load the 5V rail enough that it can't be lifted up by current from the inputs (or use another series diode on each input).

Best regards, Spehro Pefhany

--
"it's the network..."                          "The Journey is the reward"
speff@interlog.com             Info for manufacturers: http://www.trexon.com
Embedded software/hardware/analog  Info for designers:  http://www.speff.com
Reply to
Spehro Pefhany

schreef in bericht news: snipped-for-privacy@f14g2000cwb.googlegroups.com...

Suppose your inputs are 40V>Vin>10V *and* they can provide 5mA or more, you can use LM317s in current source mode. (5mA is enough to switch most opto couplers.)

petrus bitbyter

--
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.802 / Virus Database: 545 - Release Date: 26-11-2004
Reply to
petrus bitbyter

How does that look exactly? I would have asked Bill, but he's not a great ascii artist.

[snip]
--
Thanks, Frank.
(remove 'q' and 'invalid' when replying by email)
Reply to
Frank Bemelman

Sounds like what you have is a NO NPN open collector output, like this:

+----------------------+ | Sensor -----------o + 10 to 30Vdc | Circuit | | +--------o Output | | | | |/ | | ----| | | | | | v | | | | | -------+--------o GND +----------------------+

In this case your circuit will work, but as others have already said, it's a bad idea. Anyway, before proceeding try to find the specs of the sensors. There are too many variants of them to take the risk of getting it wrong from the start, especially as you're making your own hardware.

At the plant I work in there are hundreds of the beasts interfacing to PLCs. It's a hassle as the cheapskates before me would use which ever was cheapest at the moment and alter the programming accordingly. This makes replacement and program logic an issue so I've now mandated standardizing with NO PNP outputs so both sensors and input modules are interchangeable.

- YD.

--
Remove HAT if replying by mail.
Reply to
YD

Hi, I _MAY_ have a NO NPN o/c output,as you illustrated, but I don't exactly know. Could be a relay contact, could be a TTL output even. Hence the problem. I've asked for samples of all the sensors to be sent to me (some of them are legacy devices for which datasheets are unavailable). But there is no guarantee that they won't change, so I want to be open-ended.

All I know is:

  • Driven low when sensor active
  • Not driven low when sensor inactive. Don't know if this means driven to sensor supply voltage, driven to sensor's logic supply voltage, or driven to some other arbitrary level.
  • Supply voltage of sensor is between 10V and 30V

Assumed:

  • Most unlikely they would have a boost converter in there pulling up the output to higher voltages.
  • They don't use -ve signaling voltages (relative to ground).
Reply to
larwe

Yes, I am the sole surviving member of the legendary Larwe-buk-Mk'Larwe tribe. When I die, so will our cultural tradition of the ham, turkey, marshmallow, hot sauce and chocolate sandwich.

Reply to
larwe

Yes! :) But tragically my standard terms say that the final payment is due on project completion, where that in turn is defined as written certification by the customer that the project wholly or substantially functions as required. No finish, no[t all the] money.

Reply to
Lewin A.R.W. Edwards

Absolutely not- you will need to protect your circuit against responding to the inevitable transients induced into the input lines. This implies a Schmitt trigger. One cheap approach would be like shown below- the

1N914 in the "gnd" leg ensures minimal headroom for input low of about 1.2V and the loading is ~ 430uA- this diode and the 1K bias are common to all the 74HC14's and are not replicated for each input. There should be no "gnd" connection in your circuit other than that shown.

View in a fixed-width font such as Courier.

+5V 10K | +--//----+-------------------+ | | | | | |U1 opto | | | 5mA +--------+ 1N914 | 1N914 | 100K | --> | | o----||----------+--//--+--| o--//--|-+ | | | | | / 470 | | | | | |/| | - | | 100K === | | V~~ | | 0.1U | | - | / | | | | | 1K | | | +--------+ | | | | / +--------+----+-----------+ | | | | | | | | 1N914 | | o---|
Reply to
Fred Bloggs

The diode to GND increases the Schmitt ground by Vd=0.7V- so a grounded input pulls the input to -0.7V relative Schmitt GND- the diode at the RC-input blocks reverse inputs. I went that route because the '14 VT(-) can be low-like 0.9V in the extreme, and then there is the possibility that a LOW input from sensor is not exactly gnd but something else like

0.4V or so. It's cheap-I know.
Reply to
Fred Bloggs

"Spehro Pefhany" schreef in bericht news: snipped-for-privacy@4ax.com...

Okay, thanks - not that I like it a bit - but okay ;) Perhaps I would like it, once I understand what that diode does for wonderful things?

--
Thanks, Frank.
(remove 'q' and 'invalid' when replying by email)
Reply to
Frank Bemelman

"Fred Bloggs" schreef in bericht news: snipped-for-privacy@nospam.com...

What is the use of that diode to GND ? What if the 'sensor' has a relay contact for output?

--
Thanks, Frank.
(remove 'q' and 'invalid' when replying by email)
Reply to
Frank Bemelman

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.