# Base resistor in open collector

I want Vout to be logic 0 when Vin is logic 1 (+5V), and Vout to be high impedance otherwise. I designed the circuit like an open collector switch. But how can I design R1 value ? Usually in transistor switches, I calculate the base resistance value by calculating Ic(sat), putting Vce = 0V in the collector circuit. Then I divide it by Beta to find the minimum base current needed to switch on the transistor. Here there is no collector resistance or collector current. So I can't figure out what should be the minimum value of base current to turn on the transistor.

simulate this circuit – Schematic created using CircuitLab

There is no Vout in your circuit as shown.
You have to supply a pullup resistor to define a Vout and a collector current.
If you are simply taking the collector to an Arduino digital pin as an input, then you'd have to turn on the internal pullup resistor to provide current for the collector.

From the BC547 datasheet:

For the Arduino input current on an AtMega328 the DIO pin schematic shows the Pullup resistor on the I/O pin.

The value of the pullup is shown in Table 32-2:

So the minimum values is about 20 KOhm, through maximum of 50 kOhm. With a 5 V MCU you will draw about 250 uA maximum, if you are operating at 3.3 V then you'd expect a maximum of about 17 uA.

If you then look at your BC547 datasheet you'll notice that you need 50 uA or less to ensure you could pass the 250 uA collector current.
However there is a tendency to overdrive the Base so I'd suggest using around 250 uA Base current.
That would give a base resistor of about 18 kOhm in your circuit. This would be equivalent to an effective Hfe of 1.

If you use the minimum Hfe of 10 (for overdrive) as suggested by others then you end up with only 25 uA Base current and an R value of about 170 kOhm. There is nothing wrong with this of course, so you decide what overdrive you want to use. My preference is to not use high value resistors in digital circuits if I can avoid it.

• Finally understanding the usefulness of data sheets. Got it :-) Commented Dec 16, 2017 at 19:03

As stated, you can't do it. You must specify both the maximum expected collector current and the minimum required output voltage.

Since open-collector outputs are ordinarily associated with saturated operation, it is usual to assume a beta in the range of 10 to 20, with the exact choice depending on how conservative you want your design to be.

Max it out. Or decide what the max ICE current should be for your design, then calculate the resistor for saturation at that current. An open collector with an unknown ICE you have to hazard a guess and make a determination of what your design should handle.

• Vout will go to a microcontroller (Arduino) digital pin for read purpose. I cant figure out what would be the max Ic current in this case ? If Vin = high, will any current flow from the microcontroller to the ground via the transistor ? Commented Dec 16, 2017 at 17:11
• @Passerby: shouldn't that be "<5mA" (less than...) Commented Dec 16, 2017 at 18:50
• Yes, typo. If it's just for a high impedance input, then the current is typically less than 5 milliamps. A 1k base resistor is more than enough. And yes. The base current does flow through the transistor to ground in this case. So your base resistor must be sized for your micro controller's output limit. Commented Dec 16, 2017 at 19:03