# Resistor for open-collector transistor

I have an encoder; the circuit is in the image below:

The one that I’m interested in is the PNP one. I want to use a 0-5 V digital voltage, the datasheet says this:

1. Applied voltage: 30 VDC max.
2. Source current: 35 mA max
3. Residual voltage: 0.4 V max. (at source current of 35 mA)

By my calculations using Kirchhoff's law I can't obtain 5 V because of the 35 mA max; the pull-down resistor should be very low, because the emitter resistor is very low. Am I missing something? How can I dimension the resistor correctly?

This is the calculation that I made, what is wrong?

## 2 Answers

It says the maximum current is 35 mA and, that would mean the transistor might be on-the-cusp of failing so, choose a more reasonable current like 5 mA and calculate a resistor value that's 1 kΩ. You could probably go as low as 1 mA with a 5 kΩ resistor.

But, there is a minor problem pointed out by @periblepsis; the minimum supply voltage for this device is 12 volts so, in effect, you'll have to use two resistors and form a potential divider like this: -

• The transistor is operating as a switch so, it'll push the current defined by the resistor and the power supply. Use a 5 volt supply is my recommendation and it's very easy. OK upper logic level might end up being about 4.8 volts but that's fine for logic. Commented Apr 5, 2023 at 17:04
• @Andyaka The datasheet appears to specify +12 to +24 for the emitter (and 3.3 Ohm) end of the PNP. Elsewhere on the datasheet, for other devices, they do allow +5 V. But not in this case, for the specific E6B2-CWZ5B device. How do you read it? Commented Apr 5, 2023 at 19:32
• @periblepsis yes you are right. Good spot. It needs a potential divider to produce 0/5 volts from a 12 volt supply. Commented Apr 5, 2023 at 20:04
• ok now its clear, so my calc were not wrong, i just had to use a voltage divider to obtain my voltage without burning the transistor Commented Apr 5, 2023 at 20:14
• @SergioPiccione correct and sorry for being late in realizing it couldn't run from 5 volts. Commented Apr 5, 2023 at 20:35

The one that I’m interested in is the PNP one. I want to use a 0-5 V digital voltage, the datasheet says this:

Applied voltage: 30 VDC max.
Source current: 35 mA max
Residual voltage: 0.4 V max. (at source current of 35 mA)


I think you may have purchased the wrong encoder (or are contemplating such), if you are stuck with a $$\5\:\text{V}\$$ source voltage. Here's why:

Note that in the specific case of the only device they make as PNP, that they specify $$\12\:\text{V}\to 24\:\text{V}\$$, which appears to me to exclude $$\5\:\text{V}\$$. Strengthened also by the fact that the other three versions they make do support $$\5\:\text{V}\$$.

• yes i know i buyed the wrong one, too late for that, i was asking if i could fix that, so i have to put a voltage divider, i was thinking to a op amp inverter with negative reaction Commented Apr 5, 2023 at 20:07
• @SergioPiccione Then you will need a 12 V to 24 V supply. No getting around that, without deciding to first ignore the specifications and then perform some testing on the device to see if it can be made to work on 5 V. Do you have access to the appropriate voltage supply? Or only to 5 V? Commented Apr 5, 2023 at 20:08
• nono i have access to the correct voltage supply, just interested in the output Commented Apr 5, 2023 at 20:09
• @SergioPiccione Oh. Then Andy's suggestion about a divider could work. Or a different circuit using another BJT. Personally, I'd use an added BJT circuit. But it can be made to work with dividers. Commented Apr 5, 2023 at 20:10
• @SergioPiccione The resistors mentioned by Andy are fine. You 'could' add a BJT (or two or three, etc.) The extra BJT allows me another degree of flexibility and the possibility to protect your I/O pin from a single part failure (short, for example.) But you've not mentioned anything to suggest a need for that. I think the divider will be fine. Just don't use a screwdriver and accidentally short out the upper resistor in the divider! Commented Apr 5, 2023 at 21:48