Photograph of a prototype circuit


A laser tag system based on an AVR microcontroller - specifically, the AVR Atmel ATmega328p. For prototyping I’m using an Arduino Uno board, but I plan to make a custom circuit board with the microcontroller placed directly on it. The software is written in C and does not use the Arduino/Wiring library - it uses AVR libc directly. This means the code has direct control over the timers, interrupts and other features of the microcontroller, which allows many improvements over existing AVR-based systems I have seen (e.g. the code is capable of simultaneous infrared reception and transmission).

Technical details

Infrared communication

The infrared signals are encoded on top of a 38 kHz carrier wave. A packet starts with a 1200 microsecond burst and is then followed by 16 more bursts, each representing a single bit. A burst of 800 microseconds indicates a binary 1, a burst of 400 microseconds indicates a binary 0. There is a 400 microsecond gap between these bursts. The most significant bit is sent first and the least significant bit is sent last.

This is similar to the underlying protocol used by other hobby Laser Tag systems, however, not quite compatible (due to the fixed 16 bit length and slightly different timings to account for the properties of the detector). The protocol that is eventually used on top of this will probably vary significantly from that of other systems - interoperability is not a concern of this project.

A Vishay TSAL6100 infrared LED is actually used for transmission. A timer on the AVR chip is used to generate the 38 kHz carrier, and the software turns the carrier on and off at the appropriate times to generate the bursts. Vishay TSOP4838 sensors are used for reception. These demodulate the signal such that their output is low when the carrier is on, and high when the carrier is off. An interrupt is fired on a rising and falling edge, and some simple timing and decoding code allows the packet to be read.

LCD screen

The LCD screen uses a Hitachi HD44780-compatible controller connected to a 74HC595 shift register to conserve pins on the AVR chip. The code can only write commands/data to the controller because of this, but all of the required functionality can be implemented without read support.


The speaker is connected to a pin, which in turn is connected to a timer. The timer is configured to produce a square wave at varying frequencies, so a variety of flat tones can be generated, but no complex waveforms.


The LEDs are connected to a 74HC595 shift register, just like the LCD screen. There are two LEDs for each team (red, green, blue, yellow) giving eight in total. The code implements an alternate flashing effect for the team colour. In the future, for complex game modes, a particular colour could signal someone as having captured the flag, for example.

Connected directly to the AVR chip there is also a muzzle flash LED with a small viewing angle and high intensity.

Radio communication

In order for live scoring/hit feedback, complex game modes, etc., radio communications between the guns and a central server computer will be used. I’m currently looking at using HopeRF RFM12B chips for this.


Infrared circuit with 555 timer This photo shows the original version of the infrared circuit using a 555 timer to generate the 38 kHz carrier, which was made before I was aware that an internal timer on the AVR chip could accomplish this.
Infrared circuit with AVR timer This is the newer version of the infrared circuit that uses an internal timer so it is a lot simpler. The current through the infrared LED is limited to 50mA by the resistor network, at the time I did not have the correct value resistor for this, and in the future a transistor will be added so higher currents can be used (the LED is capable of up to 200 mA).
LCD display circuit This shows an LCD display using a HD44780-compatible controller, interfacing with the AVR chip in 4-bit mode.
LCD display closeup This shows a health display on the left side and ammo display on the right side. The icons are implemented as custom characters in the controller's character generation RAM.
Speaker This shows a speaker being used to generate tones of various frequencies using one of the AVR timers.
Shift register This is a picture of a temporary circuit used to test the shift register code. The AVR chip does not quite have enough pins for the whole planned circuit, so shift registers will be used for things like status LEDs to free up pins for other purposes.
Prototype This is a near-complete prototype of the circuit (it lacks the RFM12B radio chip as that uses 2mm pitch instead of 2.54mm, so I can't easily breadboard it, and also lacks the buttons, as I almost ran out of wires.) It features the infrared circuitry (including MOSFET), LCD screen, speaker, team indicator LEDs and muzzle flash LED.

Source code

The work-in-progress code is available on GitHub.


I’ve had a few emails asking me for schematics. Unfortunately I don’t yet have anything that is finalized or completely tested, as the project is still in development, and I am afraid I have neglected to keep this in sync with the prototype circuit I built above - however, I’ve decided to upload what I have got so that it can hopefully be of some use. Just to be clear - these will almost certainly not work “as is”!

Main board

This basically covers the overall circuit. Some things to note are:

Old sensor board

This is what would be connected to the “IR RX” plug on the main board using some sort of parallel cable. Some more things to note:

New sensor board

I realised that to save wires in the connections between sensors, I could move the shift register to each individual sensor board, instead of it being on the main board. This is the updated schematic of the sensor board (also it doesn’t use the RGB LEDs any more), but there’s no corresponding updated schematic for the main board - sorry.

Muzzle board

This is basically the extraction of the part of the main board circuit above which contains the infrared LED for firing, and the colour LED for indicating you are firing. Again, as above, there is no updated schematic for the main board. The idea of this is that if I ever get to making real PCBs for this, it’s possible the main board may be too big to fit in the gun so it may need to be on the outside of it (and kept in your pocket or something), and the gun would just have this in it (it’d also need the trigger switch too - but again, the schematic is not up to date - sorry.)

RS232 board

The eventual intention is that the units will communicate wirelessly with the RFM12B chips to a central server computer which can do things like keep track of scores, and allow the implementation of complex game modes (e.g. capture the flag.) This is a completely untested and unfinished circuit which has the AVR/RFM12B chip (like the main board above), but also a MAX232 chip and RS232 socket so that you could connect it to the serial port of a computer.