I am building a IR-based laser tag system. The basics are working fine. One feature, that I want to have, is different weapon modes with different ranges.

How can I change the range of an IR transmitter with as little hardware as possible, or at best, completely in software?

  • 2
    Just guessing, but if you are using IR LEDs as transmitters, the only way I see to alter range is by altering the amount of current applied to the IR LEDs, and PWM would not be a solution in this particular case. However I wouldn't say this is an accurate way to get different ranges, if (again) as I guess you would like to get differences in range of tenths of meters, or even meters. more or less the same accuracy you get when your TV remote's batteries are getting discharged and you must get up from your sofa a given distance... – Roberto Jun 9 '16 at 9:07
  • 1
    Roberto's suggestion can only work if the beam diverges significantly. A laser beam is practically cylindrical at close distances, and you will not get enough attenuation for this idea to work. You should instead use lightsaber technology to make the beam stop at a fixed distance. – Edgar Bonet Jun 9 '16 at 9:24
  • It's not a laser, sorry for the confusion. That's only the name of the game. All it is is an IR LED behind a lens. – Dakkaron Jun 9 '16 at 10:13
  • 1
    The problem with altering the current is that I have the IR LED behind a transistor that allows for the full current to go through, so I can't even use two pins with different resistors. From what I gather from the datasheet of an infrared receiver, it looses a lot of responsivity if the frequency of the signal does not match the frequency of the receiver exactly. Would that work? So e.g. if I want full range, I use 38 khz, while if I want half range, I use 36khz. – Dakkaron Jun 9 '16 at 10:27
  • @Dakkaron You should be able to easily test that. Using an led without a resistor isn't advisable, unless the voltage of the batteries is lower than the forward voltage of the diode (or a bit above, since you are only pulsing the led). I think you could use PWM, but you'd have to use a frequency that's way above 38khz. – Gerben Jun 9 '16 at 12:28

Instead of modifying the TX power, why not make the receiver read the light level. You just need to transmit some data, like the weapon ID.

If it works you could send more information, including how stable the weapon that hit the target was, during the shoot, using an accelerometer.

  • 1
    My devices have to be compatible to the guns I already have. Those are a proprietary system, so I have no control over them. Also the receivers I use on my devices are integrated IR receiver circuits (something like this: vishay.com/docs/82491/tsop382.pdf) and they only report the demodulated data, not the light level. – Dakkaron Jun 13 '16 at 13:48
  • @Dakkaron, note the AGC block in the specification sheet you linked to above. There is no way to determine the AGC setting from the outside world. No way to tell how strong the source is. No way to tell how far away it is. So you need to either supplement your setup with the Sharp Distance measurement device (my 1st answer) or utilize a power varying secondary signal source as a reference (my 2nd answer). – st2000 Jul 7 '17 at 21:03

Let us assume you are using an ordinary inferred LED and a type of inferred detector used in remote control entertainment equipment.

Inferred LED modulation is simple and is well documented on the web.

The inferred receiver is a complex device. It contains, among other features, an Automated Gain Control (AGC) circuit and a Phase Locked Loop (PLL) circuit. The AGC adjusts the gain and makes it impossible to gauge the power of one IR source relative to another. The PLL "locks onto" the signal.

Consider using and adjusting the power of a secondary inferred LED transmitter transmitting at the same time as the primary LED transmitter is being received. The secondary inferred LED transmitter is local to the inferred LED receiver and transmits a unique code. The primary inferred LED transmitter is part of the opponent's equipment and transmits a unique code. Slowly reduce the power of the secondary inferred LED source until the code switches from the secondary source to the primary source. The power used by the secondary inferred LED when the switch occurs should be proportional to the distance to the primary inferred LED.

In the above scenario we have used the AGC to "hide" the primary source until we reduced the power of the secondary source to just below that of the primary source. And we used the PLL to "lock onto" the strongest signal.


Consider using a Sharp Distance Sensor in addition to your shoot / confirm-hit inferred LED & receiver.

This Sharp distance sensor is specified to detect objects that reflect IR light from 100 cm-500 cm.

How can I change the range of an IR transmitter with as little hardware as possible, or at best, completely in software?

I believe the sensors produce an analog output that can feed into an Arduino's ADC. So software (by itself) can be used to adjust the threshold distance.

Similar devices I have used have a narrow sensing field. They only reported the distance to objects directly in front of them. Also, I found they were effected by defective (burning out?) florescent light sources. We assumed failing florescent light sources produced IR radiation similar in frequency as used by the sensor's IR emitter. Also, the analog output is slightly stair stepped in the unit we tested. I say this in case you were expecting to use increase relative accuracy of several readings if not precision of any given reading.

  • No, the receivers are digital which product an all-or-nothing output. Also the entire receive systems apparently already exist and are not being modified by the asker. – Chris Stratton Jul 6 '17 at 14:57
  • Perhaps there are several different types of Sharp Distance Sensors. The Sharp Distance Sensors we used produced a voltage that was proportional to the distance. However, we could not use them as they actually change the voltage in small desecrate steps. – st2000 Jul 6 '17 at 22:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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