In this Instructable I would like to introduce you to my own Laser Game Environment. The point of this project is to develop an easy-to-use and open-source engine as well as a prototype of Laser Game Weapon, which you can then either build yourself, or better modify it to suit your own needs and then build it!
The reason why I made this project is that I wanted to make about 10 Laser Game weapons for our local scout troop. However, all of the designs I found on the Internet had some flaws, so that's why I made my own.
The resulting weapons has following specification:
- range: 30 - 40 meters
- angle of half radiance: 10°
- battery life: 3 - 4 hours
- the weapon is very mechanically durable and you can easily waterproof it
- cost of one weapon is below 10 US dollars!
- the weapon is equipped with acoustic and light signalization (2 groups of independently controlled RGB LEDs and piezo speaker)
- time required: 2 - 4 hours per piece, depending on your skill level
Some more technical specifications:
- MCU: Atmel ATmega 328 (same as Arduino UNO)
- IR transmitter: TSAL6100 IR diode
- IR receiver: 4 x TSOP4838, connected together with quadruple AND gate
- battery: lithium ion 18 650 from old laptop akupack
I am not going to give you step-by-step instructions on how to build this weapon, as it is pretty obvious and relatively easy. You don't have to be a skilled maker, but at least some basic skills would certainly come in handy. Should you have any questions or comments, I will gladly answer them in the comment section.
Step 1: How IR Communication Works
Firstly, forget that we are speaking about infrared light (IR)- IR light is almost as usual light, except that human eye can't see it. The transmitter simply blinks the IR diode, which creates pulses of variable length. The receiver then measures the length of those pulses. And depending on the length of the pulse, its either logical 1 or logical 0 (this is called binary code and is used by every computer). Arrays of those 0s or 1s then create a sequence, and the receiver knows that for example sequence 1011 means a hit from the enemy team.
This is very simply explained, but I will not go in depth of the problem, it gets complicated really fast. If you want to know more, visit this Sparkfun article. I think it is a waste of time to explain something which has already been explained elsewhere.
IR transmission may sound like some alien technology, but trust me, your TV remote control works exactly the same. And you have probably observed that you need to point your remote control onto the television, or it won't work. Laser game uses this very same principle - when the player presses trigger, the IR diode shines a cone of IR light in the direction of the gun and of course if this cone hits another player, the signal is processed and evaluated.
Image courtesy of http://www.sbprojects.com/.
Step 2: The Gun
The first step is to construct the gun itself. The gun contains the following electronics:
- The microcontroller (MCU), which is the core of the whole build. I have chosen Atmel's ATmega 328, because you can get it for under 2 USD from Ebay and because it is the same as in Arduino UNO. In fact, you can use an Arduino, but it will just be more expensive.
- A simple ISP connector, used to program the MCU with firmware and charge the battery.
- IR diode. Because I didn't want to mess with optics (lenses and so on), I have chosen IR diode with the smallest angle of half radiance. This is the top angle of the cone which the diode shines out. If this angle is too big, the game will be very easy, because you wouldn't need to aim your gun at all; however, should this angle be too small, the game would be extremely difficult (mostly on short distances), because you would need to aim precisely at the enemy's head.
- Flashlight diode - just a very bright LED, which has two purposes. Firstly, when the player shoots, this diode is lit up at two times the maximum brightness, but for only a short period of time. This does not damage the LED and simulates muzzle flash of the gun. And, with PWM, you can also use it as a flashlight.
- A small (but loud) piezo speaker, used to signal the player some events - shooting, being hit and so on.
- Three buttons. One is a trigger and the other two are auxiliary buttons. In the code, you can assign them custom functions - they can be used to reload "magazines", send a healing pulse to a nearby player or just turn on the flashlight diode on the gun.
- 5 RGB diodes. One is located directly on the body of the gun, while the other four are located on the head receiver.
- Drivers for the LEDs (5 transistors in total, 1 for IR LED, 1 for flashlight LED, 3 for each color channel of the RGB diode).
- 5V boost converter and lithium battery. This will provide power for our system.
On the pictures above, you can see the control PCB and also the schematics I used. It may seem like a lot of parts, but trust me, the PCB is really easy to make at home or you can very easily build it on a breadboard.
The body of the gun is made from PVC piping, because it is cheap, easy to get and durable and you can make various shapes with it.
Step 3: Headset Receiver
We have the gun, which is capable of transmitting the IR signal. Now we however need some way to receive the IR signal. For this, we will use four TSOP4838 modules, which are modules especially made for receiving IR. We need four of them, because one receives from only about 90° - so by using 4, we basically cover the whole 360° around the player. To connect them together, we need a 4-input AND gate (again, I do not want to go into details).
The problem is that IR light does not pass thru solid materials. So, if the player covers those receivers (by accident), he could become invincible. For this reason, we will mount them on the player's head, where they will not by obscured by any other part of the body.
Because we have only 10 dollars, we will make a headdress from a rubbery-like material and glue the four PCBs with receivers and diodes directly on it. This headdress will then be connected with a 6 wire cable to the gun.
And when we at that, we will mount here 4 of those RGB LEDs, because again, on the players head, they can be seen from a fair distance.
Step 4: Firmware
After you have finished building the weapon, its time to burn the firmware, which you can download from the list of files of this Instructable. You can open the files in AVR Studio or simply in Notepad and copy-paste them into Arduino IDE (the code is Arduino compatible). I will not explain the code in depth, but you should understand it really easily. All actions (light up LED and so on) are predefined with macros, so you don't have to mess with bit logic (like PORTD |= 1 << PORTD5).
Because the code is very simple to adapt, you can make your own game modes. Here are only a few suggestions:
- Team battle - you have two teams of players, and the goal is to kill all opponents. After that, the game administrator uses his gun to send healing shots to revive all dead players and new round can begin!
- Capture the point - in the middle of the battlefield is a capture point, a simplified version of a laser game gun, which can only receive data. When a player hits the capture point, it starts counting up time. When a player from the other team hits the point, it starts counting time for the other team. At the same time, players fire at each other. When a player is hit, he has to wait 5 minutes, then he is automatically revived. The team, who held the point for longer time, wins. Of course I recommend that you use some sort of clearly visible signalization for the players to tell which team is currently occupying the point (LED strips are great for that).
- Death match - there are no teams, and the goal is to hit as many other players as possible. When you are hit, you must wait 30 seconds to be revived. Every player has his unique binary ID, and your gun logs how many times and which player hit you. At the end of the game, those logs are compared and the winner is calculated (I recommend that you save those logs into EEPROM, which you can then easily read with an Arduino )
- There are countless other possibilities, it depends just on your imagination...
Step 5: Conclusion
I hope this Instructable will be helpful for somebody. If you have any questions or so, just leave a comment and I will try to reply ASAP.
I build a few of those guns and had great fun with them. They are reliable, damage-proof and easy to make, which makes them different from other Laser Game Gun designs. Laser Game is best played in dark and dissected environments, like a forest in a night (all those lights look really amazing) or an old factory.