I built a beam breaker set-up, with the transmitter and receiver next to each other, and a reflector about two meters out. Basically, the transmitter is an IR LED and the receiver a TSOP. Between the two components, I placed cardboard. I am constantly getting readings from the Arduino terminal on the alignment of the beams (HIGH or LOW).

I believe the set-up or individual devices are not faulty and all is working as should, including range, after extensive testing. When I place a retroreflector in front of the devices, up to about a meter, it works. Further, not so much.

It really comes down to having the IR LEDs pointing the same way, in the same angle. They don't now, and if I move the reflector further away, there logically comes a point that one beam 'falls off' the reflector.

After an entire afternoon of fidgeting, I finally managed to aim, using trail and error, only one IR LED at the reflector two meters further.

Methods I tried, include plain measuring on flat surfaces against straight walls, using a laser pointer, bending and cutting the legs of the LEDs the exact same way, moving the reflector up, down, left and right and finally, keeping the reflector in place but move the IR LEDs up, down, left and right.

The problem is that, even if I manage to align a LED, all it takes is a small accidental nudge to have to start all over.

Does anyone have practical tips on how to aim IR LEDs?


An ATTINY, using a MOSFET to drive the LED near max. capacity despite the limit on the pin, drives the LED. It uses this code to get 36kHz and send bursts as not to overload the TSOP:

//                           +-\/-+
//  Ain0       (D  5)  PB5  1|    |8   VCC
//  Ain3       (D  3)  PB3  2|    |7   PB2  (D  2)  INT0  Ain1
//  Ain2       (D  4)  PB4  3|    |6   PB1  (D  1)        pwm1
//                     GND  4|    |5   PB0  (D  0)        pwm0
//                           +----+

void setup(){
  DDRB |= (1<<PB0); //Set pin PB0 as output
  DDRB |= (1<<PB1); //Set pin PB1 as output

  TCNT0 = 0;
  TCCR0A = 0;
  TCCR0B = 0;

  TCCR0A |=(1<<COM0A0); //Timer in toggle mode Table 11-2 - PB0
  TCCR0A |=(1<<COM0B0); //PB1

  TCCR0A &=~(1<<COM0A1); 
  TCCR0A &=~(1<<COM0B1);

  TCCR0A |=(1<<WGM01); //Start timer in CTC mode Table 11.5
  TCCR0B |= (1 << CS00); //Prescaler Table 11.6

  OCR0A = 12; //CTC compare value, 36kHz

void loop(){ //cycle = 1/36 = 28μs
  TCCR0A |=(1<<COM0A0); //burst on for 10+ cycles
  TCCR0A |=(1<<COM0B0);

  TCCR0A &=~(1<<COM0A1); //off for 14+ cycles
  TCCR0A &=~(1<<COM0B1);


The receiver is an active-low TSOP that, via a comparator, is connected to an Arduino calling the attachInterrupt() function. There are two LEDs and two receivers to determine direction. The C code calculates direction and spits out the result.

enter image description here

  • \$\begingroup\$ Comments are not for extended discussion; this conversation has been moved to chat. Any conclusions reached should be edited back into the question and/or any answer(s). \$\endgroup\$
    – Dave Tweed
    Jul 27, 2019 at 13:23

3 Answers 3

  1. Pulse the LED to let you run them brighter without overheating so aim doesn't matter as much.

  2. Build a mounting block. so they are held rigidly in place relative to each other. This may require the ability and tools to drill accurate holes at small angles. It goes without saying to not rely on breadboards when alignment matters.

  3. Consider placing a visible LED with the same FOV above the existing photodiode and IR LED so that you can aim them better. Of course, this would require that those be rigidly attached to the IR devices so they remain in alignment.

  • \$\begingroup\$ Option 1 isn't feasible, I'm afraid. The IR bounces off me when I try to break the beam, so I will actually have to reduce its strength by increasing the resistor values, as I understand it. \$\endgroup\$ Jul 26, 2019 at 19:37
  • \$\begingroup\$ Another thing, why is the emitter and receiver so far apart? If you want maximum range why wouldn't you put them closer together? I find that makes it easier to aim if you're trying to get maximum range. But really, this should be on a soldered PCB and not sitting in a socket on a breadboard. \$\endgroup\$
    – DKNguyen
    Jul 26, 2019 at 19:39
  • \$\begingroup\$ They are quite close together. Seperated only by two pin holes to be precise. Too close and the cardboard between them will start pushing the LED to an angle. I can try bringing them closer still, but marginally. The breadboard is just for prototyping. \$\endgroup\$ Jul 26, 2019 at 19:45

The obvious answer is a retro reflector.

Cheap or expensive as done in industry or in surveying.

  • \$\begingroup\$ I am using one. \$\endgroup\$ Jul 26, 2019 at 19:47
  • \$\begingroup\$ to detect a missing object (beam-break) or detect an object with (corner rfector) ?? which is it? \$\endgroup\$ Jul 26, 2019 at 19:49
  • \$\begingroup\$ I see that but it may not be enough. How are you modulating your LED, the type of waveform matters a lot for some of the receiver types. If they need a carrier it also has to be at the correct frequency. \$\endgroup\$
    – KalleMP
    Jul 26, 2019 at 19:49
  • \$\begingroup\$ I'll clarify in the original post. \$\endgroup\$ Jul 26, 2019 at 20:06

The problem is that, even if I manage to align a LED, all it takes is a small accidental nudge to have to start all over.

The solution for this is to make some kind of mounting hardware or fixture that holds the devices (LEDs and detectors) so they won't be moved by a small accidental nudge.

Does anyone have practical tips on how to aim IR LEDs?

I'll disagree with what others have said. I'd try to narrow the LED output beam rather than widen it. Just a few degrees beam divergence should be enough to reach your detector if your target is a corner cube at a distance of ~1 m.

By using a wider divergence (10, 20, 30 degrees?) you're just allowing your received power to fall off quicker as the target distance increases.

You can place a collimating lens in front of your LED to focus its output into a narrower beam.

For really long distances, you could add a telescope in front of the receiver to increase its effective area.


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.