Electronics › Electronics › Explanation of this Electronic circuit › I assume your IR sensor gives

I assume your IR sensor gives digital output. Here the transistor is operated as a switch only.

Suppose the transistor is off, you will get 5v ( maximum possible voltage ) at the output and it is independent of the value of collector resistor.

But suppose the transistor is ON, you need the minimum possible voltage at the output ( 0.7V ), which is the saturation voltage of the transistor. At that time an input current flows through the transistor depends on the input voltage and given 4.7 K resistor. For that input current an output current flows depends on the hfe of the transistor. That output current should generate a voltage not less than ( 5 – 0.7 ) V in the collector resistor, and the value of that resitor is designed for the same purpose using V = IR equation.

Simply for on condition of transistor,

we select an input resistance first

calculate the input current

multiply that current with hfe of transistor to get the output current

now we know the output current ( I )

The output voltage ( V ) should be 0.7 V, so 5 – 0.7 V should drop across collector resistor

now we know the current ( I ) through collector resistor and also the voltage drop across it ( V )

get the required value of resistor ( R ) using the equation R = V/I