I'm doing a project in which a 5mm LED is near a 5mm phototransistor. There are times in which the sensor must pick up external light even with the LED on.

I understand one option is to turn the LEDs off everytime I want to sense light, but that means the microcontroller will run slower overall (as it spends time turning the LED on and off) and flickering might drain batteries faster.

So I'm opting for a second option. Using heat-shrink tubing to cover up the sides of the LED's so they don't affect the nearby sensor.

I have tried 5mm heat-shrink tubing on a 5mm led and it fits decently but somewhat loose. They say the traditional way is to use a blow-dryer on very low heat to tighten the tubing to the LED, but I was thinking maybe theres a better approach.

Online there is an option to buy 6mm tubing as well (http://futurlec.com/Cable.shtml).

So other than applying heat, which of the following is better to secure the tubing to the LED?

Should I buy 5mm and 6mm tubing, put the 5mm tubing on the LED and force the 6mm tubing over the 5mm tubing in place?


Should I change 6mm to a higher number for 2nd tubing size?

or should I get a larger tube diameter and use some tool (I don't know the name of it) to feed it through itself (so one end looks like a cup rim and the other end looks cut)?

or is there a specialized tool to actually cover the LED completely?

I thought of led holders and clips but they cover only parts of the sides or they angle the LED the wrong way. Also the sensor side is about 6mm maximum away from the LED side.

  • 2
    \$\begingroup\$ Flickering the LED won't drain power faster than keeping it on all the time. Though it will mean the micro will use more power to do the logic, which might be what you meant. \$\endgroup\$
    – Hearth
    May 9, 2018 at 0:58
  • \$\begingroup\$ What's wrong with applying heat? \$\endgroup\$
    – user253751
    May 9, 2018 at 1:55
  • \$\begingroup\$ And yes, as previously stated, flickering won't use extra power and it won't wear out the LED either. \$\endgroup\$
    – user253751
    May 9, 2018 at 1:57
  • \$\begingroup\$ you can get flat top LEDs in round and square. using pwm to dim the pin shouldn't draw more power than it save, since it's "hardware accelerated" and doing most of the work all the time anyway. \$\endgroup\$
    – dandavis
    May 9, 2018 at 3:23
  • \$\begingroup\$ Just about any heat source can be used to shrink the tubing. \$\endgroup\$
    – user57037
    May 9, 2018 at 5:10

2 Answers 2


Heatshrink varies from 25% to 50% to 66% reduction in diameter depending on type. LED's are extremely sensitive to damage risk with soldering > 3 seconds on the leads but no problem with a heat gun on the tubing.

This is a perfect solution to your problem and you can reduce the beam exit angle by the length of the tube. If it shrinks to say 3mm, you may have to align it perfectly and reinforce with PolyUrethane, PU (e.g. sub-floor adhesive) so it does not move easily, yet not brittle.

If you know trig, you can compute the length of the tube for the cone angle you need, so that alignment is not critical yet blocks interference. A PhotoDiode, PD and high gain current sense amplifier is far better with a daylight blocking filter as they are very accurate with 0.4mA/mW but PT's have high gain but very inaccurate with >50% hFE tolerance. But you can always trim your gain to suit the gap.

Usually a 1500W heat gun with low air speed is used with a curl adapter to circle around the tube which is hot enough to melt solder at shorter ranges. I have also use a lighter with care, and a hair dryer on low speed.

  • \$\begingroup\$ Wrap the photo-transistor in a T (RCR) DC-nulling feedback, crafted to set Vcollector at VDD/2. \$\endgroup\$ May 9, 2018 at 2:58

You likely do not need the heat shrink.

Try turning the LED on and off with the typical ambient light present and see if there is any change in the photo transistor. Very unlikely. Even in a dark room you would need a very sensitive photo transistor to detect if the LED were on of off.

For example a Lite-On LTL2V3VYKL12 5mm Clear LED has a viewing angle of 30°.

Below is the spacial distribution. Very little light would go sideways. The amount of light going sideways would not be enough to affect the photo transistor.

enter image description here

As you can see here the emitter is about 4 mm above the PCB surface. The direction of the light is up not down.

enter image description here

enter image description here

Doing the math. With a 30° viewing angle the light travels 15° on each side. The vertical red line is 6 mm from the LED. The green horizontal line is the PCB. The LED emitting surface is 4 mm above the PCB. The distance from point B to point C is 6.3 mm.

Then if you include the half angle of the photo transistor it can only see light coming from straight above the detector surface. Any light from the LED would be coming at a 45°angle greatly reducing sensitivity.

enter image description here


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.