I am attempting to measure smoke in a small chamber through optical obfuscation using a TCRT5000 phototransistor. I'm taking measurements with an Arduino Nano.

My current configuration is:

  • \$R_l\$ is a 10k resistor
  • \$V_{cc}\$ is 5V
  • The IR diode resistor is 100ohm

The problem I am facing is that the sensitivity with this configuration is too low.

Here is a graph of the recording:

adc measurement

As you can see, the effective range is between 232 and 214 (this is the 10-bit ADC values bitshifted down to 8-bit).

What I need to do is change \$R_l\$ to move the range of the phototransistor to be more sensitive within this range since I do no expect values smaller than about 200.

What are the steps to calculate the \$R_l\$ value on my desired range?


Here is the schematic:

phototransistor circuit
(source: northwestern.edu)

I have the circuit configured as the Common-Emitter Amplifier type. In this case, my above reference to \$R_l\$ should be changed to \$R_c\$

Am I able to just adjust \$R_c\$ to change the range of the circuit?

  • 2
    \$\begingroup\$ I can work out myself what resistor is where, but adding a schematic is a must. Plus I need to know what is the input range of the ADC. \$\endgroup\$ Sep 20, 2016 at 18:11
  • \$\begingroup\$ For an interesting teardown of an IR smoke detector, see youtube.com/watch?v=uzKAZCKjpU8; it also goes into detail about self-calibration and such. \$\endgroup\$
    – JvO
    Sep 20, 2016 at 22:47
  • \$\begingroup\$ @VladimirCravero Noted! I have edited the question to include the schematic. Also, the ADC is whatever type is included on an Arduino Nano. \$\endgroup\$
    – sabjorn
    Sep 21, 2016 at 20:59

4 Answers 4


I'm just going to take some of your numbers and guess from there. You are running your IR emitter LED at about \$35\;\textrm{mA}\$ and you are getting returned collector currents from around \$47\;\mu\textrm{A}\$ to \$82\;\mu\textrm{A}\$, given your shown ADC values. (Assuming a \$5\;\textrm{V}\$ rail and your \$10\;\textrm{k}\Omega\$ collector resistor.) So that's about the range you want to see and you'd probably like it spread out over your \$5\;\textrm{V}\$ ADC input range, too.

I prefer the idea of allowing you to set the forward current in the IR emitter LED. You may want to do this from your controller. But so far, you haven't asked for that. So, to keep it simple, I'll just make this an adjustable bit of hardware. Allowing you to change the IR emitter LED current will allow you to make one kind of adjustment for whatever reflector you are using, and its distance, coupled with the density of smoke that interferes. However, the absolute max states \$60\;\textrm{mA}\$, so let's not allow more than something less than that.. say \$50\;\textrm{mA}\$ maximum. (Not recommended, either. But there may be times when you don't care.)

Other than that, it's a good idea to keep the \$V_{CE}\$ of your opto-transistor fixed, as well. There is a bit of stuff going on in the curves shown in Figure 7, which makes me want to fix the value of \$V_{CE}\approx 4\;\textrm{V}\$, or so. Do so places you right in the middle of some nice flat areas of the curves there.

Finally, you need to be able to set thresholds, so that the voltage input to your ADC doesn't move from \$0\;\textrm{V}\$ until some minimum current is reached. Then it rises, until some limit is again reached, where it rails at the top. This will give you a maximum resolution into the area of interest.

So here's an idea to try:


simulate this circuit – Schematic created using CircuitLab

In the above design, \$R_3\$ adjusts your IR emitter LED current, up to around \$50\;\textrm{mA}\$. It uses a standard \$1\;\textrm{k}\Omega\$ potentiometer, which are pretty easy to get. The value of \$R_1\$ establishes this range. I figured a maximum of about \$2.5\;\textrm{V}\$ at the emitter of \$Q_1\$, so the value is then \$R_1=\frac{2.5\;\textrm{V}}{50\;\textrm{mA}}=50\;\Omega\$ and I used the next standard size down from that.

The value of \$R_5\$ sets the gain. In this case, I decided to give you a range of from \$40\;\mu\textrm{A}\$ to \$90\;\mu\textrm{A}\$, which means a \$\Delta\;I=50\;\mu\textrm{A}\$. With an output that ranges from \$0\;\textrm{V}\$ to \$5\;\textrm{V}\$, then \$R_5=\frac{5\;\textrm{V}-0\;\textrm{V}}{90\;\mu\textrm{A}-40\;\mu\textrm{A}}=100\;\textrm{k}\Omega\$. So that is where that value came from.

The value of \$R_4\$ sets the minimum current that this range starts at, which in this design is \$I_{min}=40\;\mu\textrm{A}\$. I set a voltage divider up to the (+) input of the opamp to make sure that the current mirror collector is above a volt or so. I picked \$V_{ref}=2.5\;\textrm{V}\$ as the middle of your voltage range. It could be different. But that's where I placed it. (I did that to provide enough \$V_{CE}\$ for the current mirror and to also provide for the possibility that you might want to use discrete BJTs for the mirror and would therefore need some added emitter resistors [discussed at the end, below.]) So when the opamp output is still at \$0\;\textrm{V}\$, there will be come current flowing through \$R_5\$. That also has to be accounted for. So the value of \$R_4\$ will be set as:

$$ R_4=\frac{5\;\textrm{V}-V_{ref}}{\frac{V_{ref}}{R_5}+I_{set}}\approx 39\;\textrm{k}\Omega$$

So this allows you to make adjustments to your IR emitter LED current, within a reasonable range, and allows you to design \$R_4\$ and \$R_5\$ per your needs at the ADC, as well.

I specified a nice current mirror pair designed for the purpose. The BCV61 contains a pair of NPN BJTs on the same die and they will be reasonable here. They are also cheap to get.

However, if you do decide to use discrete BJTs, then please add two resistors to the above design. With your current range of currents, these would be both have a maximum of \$10\;\textrm{k}\Omega\$; one placed between the emitter of \$Q_2\$ and ground, and one placed between the emitter of \$Q_3\$ and ground. But to provide flexibility for higher currents, I'd probably recommend using \$1\;\textrm{k}\Omega\$ values, instead, and then just forget about them. That should be fine for up to ten times the current, which I doubt you will ever need here.

  • \$\begingroup\$ Call me silly, but isn't the current flowing through the transistor (on the right hand side of the TCRT) straight from +5 through Q3 to ground. How does R3 affect that? \$\endgroup\$
    – JvO
    Sep 20, 2016 at 22:16
  • \$\begingroup\$ @JvO I don't suppose you know how a current mirror works, then. It should do just fine, as shown. \$\endgroup\$
    – jonk
    Sep 20, 2016 at 22:26
  • \$\begingroup\$ Ah yes, Q2 and Q3 are current mirrors, it's the basis for any OpAmp. Still, how does R3 affect the emitter current for the transistor inside the TCRT? At the very least it's depending on the reflection... \$\endgroup\$
    – JvO
    Sep 20, 2016 at 22:39
  • \$\begingroup\$ @JvO Let me update the schematic. Perhaps the opto isn't clear to you. \$\endgroup\$
    – jonk
    Sep 20, 2016 at 23:14
  • 1
    \$\begingroup\$ Can you please check your equation for R4 calculation? It seams to me that currents are not properly defined. Current through R5 + Iset is equal to the current through R4? \$\endgroup\$
    – Haris778
    Sep 22, 2016 at 12:31

Let's start by looking at Figure 9 from the datasheet. That characterization is done with 10V Vce on the phototransitors, with 20mA flowing in the transmitter, varying the distance of the reflective object to detect. As you can see it peaks at 20mA, but you do not have 10V for the Vce. I would not expect the collector current to vary dramatically with Vce, and a glance at figure 5 confirms that: at ambient temperature, with 5V of Vce you still have approximately 1:1 current transfer ratio.

Now let's see what the limits of the transferred current are: back to figure 9 you can see that the relative current peaks to 1, while it can go down to 0 when the object gets very close. This happens because it effectively blocks all the light.

An input from the designer (you) is required: what distance range do you need? Just to make an example I will assume you want your transfer function monotonic, so you will start from 2mm. Max distance is a little trickier since the farther you are, the smaller the sensitivity becomes, i.e. a big change in distance produces a small change in current. It seems, from fig9, that current becomes almost flat at 20%, so I will assume your current will vary between 100% and 20% of the transmitter forward current.

Now we need to know what are the valid input voltages for the ADC: I will assume a 5V full range ADC, that accepts anything from 0V to 5V.

Unfortunately (?) you have one constraint, and two variables:

$$ 0 < \alpha I_F R_l < 5 $$

where \$\alpha\$ varies from 20% to 100%. Working the sides separately, and substituting in \$I_F\$ the equation of the diode to get \$R_D\$ to the party, you get:

$$ 0 < 0.2R_l\frac{V_{cc}-V_D}{R_D}\\ 1R_l\frac{V_{cc}-V_D}{R_D}<5 $$ Then again: $$ 0 < \frac{R_l}{R_D} < \frac{5}{V_{cc}-V_D} $$ Punching in the remaining numbers you finally get: $$ 0 < \frac{R_l}{R_D} < \frac{5}{V_{cc}-V_D} < 1.33 $$

Since I believe you will chose \$R_l>0\$, if only because of physics, just forget the lfh of the inequation.

If you throw in your pick you get a resistor ratio of 100. Not good.

Now you have many ways of determining how to go on from here. You probably don't want to use too big resistors, but you don't even want your LED to catch fire. I would say that 1k\$\Omega\$ for both resistors is a great starting point, you get less than 5mA in your LED which is ok. Start from there and if the sensitivity does not suit you either increase \$R_l\$ a bit or decrease \$R_D\$ a bit.

  • \$\begingroup\$ @Bence Kaulics please note that a space between a number and its unit is not required. \$\endgroup\$ Sep 20, 2016 at 19:08
  • \$\begingroup\$ I think The Photon disagrees about spaces and units and numbers. He just said so, yesterday, to me. In fact, he has a description in his profile about how to implement it! ;) \$\endgroup\$
    – jonk
    Sep 20, 2016 at 19:22
  • \$\begingroup\$ My edit was according to this, but it is your answer it is up to you. But be aware that Peter Mortensen will soon turn up and will insert those spaces again. ;) \$\endgroup\$ Sep 20, 2016 at 20:00
  • \$\begingroup\$ wow, I was so sure I was right and it seems I am not. Thanks for teaching me something Bence. \$\endgroup\$ Sep 20, 2016 at 20:11
  • \$\begingroup\$ Yup - a space is required by SI standard. "Numerical value and unit symbol are separated by a space. This rule also applies to the symbol "°C" for degrees Celsius, as in "25 °C". The only exception are the symbols for the units of plane angle degree, minute and second, which follow the numerical value without a space in between (for example "30°")." ISO 31-0. To make things worse, you should really add a non-breaking space so it doesn't split across two lines! \$\endgroup\$
    – Transistor
    Sep 20, 2016 at 21:42


simulate this circuit – Schematic created using CircuitLab

You can increase gain by Rc ratio / If input. This also affects Trise time, which may be slow if I understand.


  • Transmission Loss affects output levels in NIR band is not same as visible.
  • You are using HC logic ~50 Ohm ESR (not CD40xx which is ~300 Ohms)
  • Output can be scaled with R divider to ADC Vin max if not 0-5V

Here's an idea for a very wide sensitivity range. I'm assuming linearity isn't as important as dynamic range, since you didn't specify linearity. In this system, you have high sensitivity for very low particle density but poorer resolution where smoke density is high.
You don't need the Nano's A-to-D with the following circuit:


simulate this circuit – Schematic created using CircuitLab GPIOin/out must be a digital I/O pin on the nano that can be programmed as input, or programmed as output. It helps if, as an input pin, it has a Schmidt hysteresis, but I have used this scheme with an ordinary I/O pin.
GPIO1, GPIO2, GPIO3 are all programmed as output pins. They can vary infrared LED current over a wide range, when used singly, or in current-aiding for higher sensitivity.
Here's the sequence of taking a reading:

  • (1)Set GPIOin/out as output, and program it logic HIGH.
  • (2) Set one or more of GPIO1, GPIO2, GPIO3 to logic high.
  • (3)Wait for a short time while C1 charges to Vdd.
  • (4) Program GPIOin/out to "input" (instead of output). Also start the timer.
  • (5) Monitor GPIOin/out until it goes to logic low.
  • (6)Stop the timer.
  • (7) Save the timer count.
    The nice thing about this conversion process is that you get very large numbers for small phototransistor currents, and hence very high sensitivity where you need it. If necessary, you can extend a counter's length well beyond the A-to-D's overflow of ten bits.
    This does require your Nano's GPIOin/out pin leakage current to be small - leakage current of the phototransistor pluls leakage current of GPIOin/out pin sets ultimate sensitivity, assuming that C1 is a good, non-leaky polypropylene capacitor.
    If you've got no smoke, and no reflections, the counter will overflow before Q1 charges C1 down to logic low. When this happens, just pre-charge C1 by starting the sequence (above) again.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.