John said:
It is quite possible that all you need to get a 5 volt output from
this thing is to connect a pull up resistor (say, 4.7k) between a 5
volt supply and the output. You will also need a DC supply voltage
between +10 and +30 volts applied to its power wire and a common (to
both the supply voltage and the +5 logic supply). When the NPN output
transistor is on, the output voltage will be a fraction of a volt.
When it turns off, the pull up resistor will provide the logic high to
the 5 volt logic it is connected to.
Most of the time, Mr. Popelish's suggestion will work well (view in
fixed font or M$ Notepad):
|
| (+10-30VDC)
| VCC +5V
| + |
| | .-.
| .---o---. 1K| |
| | | | |
| | | '-'
| | |Out |
| | .-o-------o--
| | | |
| | |/ |
| | -| |
| | |> |
| | | |
| | GND|
| '---o---'
| |
| ===
| GND
(created by AACircuit v1.28.6 beta 04/19/05
www.tech-chat.de)
However, a few NPN industrial sensors have a weak current source in
parallel with the NPN transistor output, to help with noise immunity
when they're OFF. If your sensor has one (read the data sheet on the
sensor), you might get an input voltage significantly greater than +5V
with the above.
If your sensor has the supplemental weak current source, just use a
zener with your resistor like this (view in fixed font or M$ Notepad):
|
| (+10-30VDC)
| VCC
| +
| |
| .---o---. VCC (10-30V)
| | | +
| | _ | |
| | /|\ | .-.
| | ( | )| | |
| | \v/ | | |
| | | | '-'
| | | |Out |
| | 'o-o-------o--
| | | | |
| | |/ | /-/ 1N4732A
| | -| | ^ Vz = 4.7V
| | |> | |
| | | | ===
| | GND| GND
| '---o---'
| |
| ===
| GND
(created by AACircuit v1.28.6 beta 04/19/05
www.tech-chat.de)
This will keep the voltage from exceeding 5V if you have one of those
current-sinking sensors with the internal weak current source pullup.
There is one other element to consider -- that is whether there is
protection circuitry built in to the sensor which might bring up your
ON output below what you would consider a minimum logic low (more of a
problem with TTL). Many of the circuits are proprietary, and are not
covered in the data sheets. This may be an issue, particularly if
you're interfacing to logic which requires a TTL-level logic "0" (<=
0.8V). The best thing you can do is just to plug it in and measure.
If ON is less than 0.8V, you're OK. If not, or if it's real close, you
may have to use a comparator to interface with your logic (again, using
a pullup to +5V for the 5V interface).
Sorry to make it more complicated for you, but that's the way it is.
Always look at the data sheet, then do what's necessary to interface.
Good luck
Chris