Part 1: Building the handheld device
So, you want to build your own game of laser tag? Well, you've come to the right place! I'll show you step by step how to build your very own game of laser tag.
First thing you are going to need is parts. If you have purchased one of the kits we sell, then you have everything you need. If you haven't, you'll need to purchase the parts yourself. Unless you already have them. Either way, after getting the parts, we can continue on with the tutorial!
At a high level, what we are doing is connecting sensors, buttons, buzzers, and lights to the arduino. The arduino is a microcontroller, or a small computer that runs one program, and it needs sensors and buttons to interact with the physical world. It can only send and receive electricity, and the sensors and buttons we use convert things like light or the physical force of pushing down on a button into electricity so that the arduino knows those things happened.
In the rest of this tutorial, I'll show you how to connect everything to the arduino so that your arduino can play a game of laser tag. If you want to look at the finished product and try to wire it yourself, feel free to skip to the end. But, for everyone else, let's begin.
First, get the arduino prototyping shield and take it out of the electrostatic bag it's in (if it's in one). Picture Below.
Next, remove the foam pad under the shield. The shield is actually two parts. There is a white box on top, called a solderless breadboard, and a blue printed circuit board on the bottom. Keep the two pieces together, as we are are goign to plug everything into the white solderless breadboard on top. Note that the prototyping shield has small wires, called pins sticking out of the bottom. Do not bend those, You will need to pull the shield up out off of the foam.
Next, you are going to place the shield on top of the arduino (first picture below), making sure that the pins line up on the back part of the arduino (second picture below).
Press down on the white breadboard on the prototype shield and make sure that the prototype board's pins are plugged into the arduino.
Next, find your piezo buzzer (picture below). There are two types that we use, one that has long legs (long pieces of metal sticking out of the buzzer), and one that has short legs. If you have the one with long legs, shown below, you are going to want to cut the legs shorter with a pair of wire strippers. That way, the piezo sits flush or near flush with the top of the white solderless breadboard. Note that the holes in the breadboard are about as deep as it is high, so you want the wires that go into it to be about the height of the solderless breadboard.
If you do need to cut it, you want the legs to be the same height as the solderless breadboard. Measure the length that you want the legs to be, holding it up to the breadboard, and then cut the legs with wire strippers.
Next, you are going to plug the piezo into the solderless breadboard. Position the piezo speaker so that the legs are sticking into the bottom left corner of the solderless breadboard, and then the hole three up (each vertical section of holes on the solderless breadboard is a column) and three across (each horizontal row of holes in the solderless breadboard is a row). I will be referring to each hole in the number of rows / columns that it is from the bottom left corner of the breadboard.
Once the legs are in position, place the piezo over the breadboard so that the legs are sticking straight down into the breadboard. Push down until most (or all) of the piezo's legs are inside the breadboard.
Next, you are going to need some black wire. You don't have to use the same color wires that I do when building this project. However, it will be very helpful to troubleshoot any issues if you use the same wire colors that I do. If you use the same color wire for everything, it will be very difficult to look at what you just built and know whether a wire got crossed with another one, which could cause the device to malfunction. And that's not fun for anyone.
We are going to need to strip and cut a lot of wires to connect all of the sensors, buzzers, lights and other electronics to the arduino. The next few steps show you the process for making small pieces of wire to connect things with. You will use this process more throughout the tutorial.
The first thing we are going to do is strip off the plastic coating around the wire by putting it in our wire cutters in the hole marked 18 or 20 AWG (we use 22 gauge, or AWG wire. Why is wire gauge AWG? It's the American Wire Gauge). We want to strip off quite a bit, as shown in the picture below. It doesn't have to be exact, but we want it to be about twice the height of the breadboard.
After the plastic around the wire has been removed, you should see the bare, solid piece of wire underneath.
The next step is to measure how far the wire needs to go. To do this, we place the wire on the breadboard and hold the part with the plastic insulation over the holes in the breadboard that we want to connect. In this case, we are connecting the two holes shown in the picture below.
So, we want to cut the plastic part so that it is the same length (about, it does't have to be exact) as the distance between the arrows in the picture above. Cutting the wire after measuring with the wire is an easy way to determine how long you need your wire to be.
After you've cut the wire, look and see if it's close to the size you want. if it's within a breadboard hole or two of what you need, it should be fine. It doesn't need to be exact. Just close enough (like a lot of things in engineering, but that's a story for a different time).
Now that you have your wire, you are going to want to push the plastic insulation from one end of the wire to the middle of the wire. Start by holding the wire in one hand and use a finger nail on the other to push the insulation down on the wire.
Now that you have a wire with insulation in the middle, it's time to bend the metal so that the metal forms a "U" shape. Bend the wire right where the insulation ends on both sides.
Next, place the wire over the holes that we want to connect.
Once the wire is above the holes, hold it straight up above the breadboard and push the wire down into the holes. One trick to do this is to push directly over one side of the wire at a time, pushing one side in and then the other. If you have trouble, you can always use the ends of the wire cutters as grips to grab the wire and push it in (unless you have different wire strippers which don't have pliers on the end).
When the wire is in, it should be pretty flush with the top of the breadboard. If your wire is a little higher (or lumpier), that's fine. It will still work. It just doesn't look the same, which, to some people, doesn't matter that much. You get to decide.
Note: if your wire is too long, you can take it out and strip off more of the insulation. If the metal part is too long, you can always cut it shorter if the wire is sicking out too much. Just don't cut the exposed metal part very much shorter than the height of the breadboard. You want to make sure the wire connects well with the wires in the breadboard itself.
Most of the time, we are going to be connecting something on the breadboard, to the arduino shield (the black holes on connected to the arduino shield go to the arduino, so I will refer to them as connecting to the arduino). This wire connects the Piezo to ground, or the negative side of the battery we are going to connect the arduino to later. The wire is connected to the piezo through the solderless breadboard.
The next step is to connect the other wire on the buzzer to the arduino. To do that, we are going to need a longer wire than the one we just made. The technique we just used is good for making short wires. For longer ones, we can do a (slightly) easier method.
First, get a yellow wire.
Next, strip off the plastic at the end to expose the metal. You want to remove a little more than the height of the breadboard.
Next, measure the length of the wire using the insulation as a guide. You will want to cut the wire about a half inch longer than the distance to the pins, as shown in the picture below (or, cut it so that there is roughly the height of the solderless breadboard of extra distance on the end).
Note: for this wire, we actually are going to bend it into an L shape, so make it about a quarter inch longer than you think. For all other wires, they will be straight, so measure them as if they are going in straight and cut to that length.
After cutting the wire so that it is longer than you need, you are going to strip off the insulation on the other side so that there is metal exposed on both sides of the wire. Strip off enough insulation so that the exposed metal wire is the height of the the solderless breadboard.
Next, bend the two exposed pieces of metal down, so that they are facing the same direction.
Next, plug one end of the wire into the solderless breadboard, in the same column that we plugged the piezo into (column 3). That will connect the wire to the piezo.
You now want to bend the yellow wire so that it goes around the side of the solderless breadboard. This will make room for the other components that we are going to place on the breadboard later. You are going to plug the other end of the wire into the header pins, which are the black holes next to the solderless breadboard. These connect to the arduino. Plug the wire into pin number 2, which is the third hole from the left. The pins are numbered starting from 0, which has to do with computer science. We can get into that later, but for now, we build!
That covers how to make long wires and connect them to the solderless breadboard. If you need a short wire, you can use the first technique. However, the second technique of stripping one end, cutting the wire longer than you need, and then stripping the other end will always work. So, feel free to experiment with how to strip wires. it's all up to you!
And be sure to push the wire in as far as it will go on both sides, so you have something that looks like this
And now the piezo speaker is hooked up! This will let the arduino make noises. Now we are going to attach an RGB LED. This is a light that can be any color. The RGB LED is shown below, and has pieces of metal sticking out of it that are different lengths. These are called legs. Pay attention to which legs are which lengths. Electricity has to go through specific legs. If you plug this in wrong, it will not work. The one leg that we need to keep track of is the longest leg, as shown in the picture below.
We are now going to cut the legs so that they are shorter, being careful to leave the longest leg longer than all the other legs. To do this, first bend all the legs away from each other.
Next, starting with the leg on the right, cut all of the legs except the longest one so that the other legs are about the same length. You want them to be a little bit longer than the height of the breadboard
After you are done cutting the other legs, cut the long leg so that it is still a little bit longer than the other legs so you can still easily identify it among the other legs.When you are done, it should look like the picture below.
Now we are ready to plug the RGB LED in. Position the legs coming out of the LED like the picture below. The long leg should be on column 3 (third from the left)
Push your RGB LED down from the top so that it sits firmly in the breadboard.
Now that you have the RGB LED connected to the breadboard, we need to connect the RGB LED to the arduino. We are going to start with a small green wire. Measure and cut the wire to connect the left leg of the RGB LED to pin 3 on the arduino. Pin 2 is one to the right of pin 2, which you plugged the piezo into.
Next, we need to connect a blue wire to pin 5 on the arduino. This connects the next leg on the right of the RGB LED to pin 5 (there should be a 1 hole gap between 3 and 5).
Next, use a white wire to connect the furthest short leg on the right side of the RGB LED to pin 6 on the arduino, skipping the longest leg on the RGB LED.
Next, we need to add a resistor. For the RGB LED, we use a 680 Ohm resistor. This is the blue one in the kit.
We are going to use the resistor to connect the long leg of the RGB LED to ground. Start by holding the resistor as shown, in the picture. You are going to use it as a "wire" to connect the longest leg on the RGB LED to ground on the arduino.
Once you have measured how long it should be, bend the metal coming of the sides of the resistor (called the legs) down so that it connects between the holes as shown (you can remove any paper on the end of the legs).
After bending the resistor so that it is sticking up, cut the legs on the resistor so that the legs sticking down are a little taller than the solderless breadboard, and then press it down into the solderless breadboard as shown.
Note, that to make it easier to push the resistor in, push down directly on top of the leg, so you are pushing it straight down into the solderless breadboard.
The next thing we are going to add is the button. There are four pieces of metal, or legs, sticking out of the sides of the button.
Identify which side the pins are coming off of the button. You will want to look at the button from the side to see which direction the legs are coming off of the button in. In the picture below, they are going to the right.
Next, place the button on the solderless breadboard, as shown, with two columns on the solderless breadboard between the button, and the RGB LED. You want the legs to be coming towards you and to be plugged into the breadboard on either side of the gap in the middle of the solderless breadboard.
Next, we are going to add a red wire from the column above the top left pin on the button to the Five Volt (or power line) on the arduino shield.
After cutting the wire, press it into the solderless breadboard.
Next, we are going to use a yellow wire to connect the it to the same column as the bottom right pin on the button to pin 11. Measure and cut a small yellow wire to the length shown. Make sure you plug it in anywhere in the same column as the pin on the bottom right of the button (I use the one on the bottom, to make it neater). Plug the other end of the wire into the hole labeled "11". This is the fifth one from the right of the long black header pin (which is the black thing you plug into to connect to the arduino).
Next, you need to take one of the two 10 k Ohm resistors (with the gold, orange, black, and brown band).
You need to take the paper off of the metal (legs) coming off of the resistor, and then bend the legs down so that resistor connects to the ground (see picture below). You want the resistor to be connected to the same column as the top right pin on the button, and the second hole from the top (1 hole down) on the connection to ground on the arduino shield.
After the resistor is positioned, cut it so that the legs pointing down are about as tall as the breadboard, and plug it in.
Next, we are going to connect another button to the solderless breadboard. Leave one column of holes between the two buttons.
Next, using another red wire (this one is going to be small), we are going to connect the top left pins of both buttons. Cut the wire to the length shown, and then place it in the breadboard. It should be on the same column as the top left leg coming out of both buttons.
Next, we need to connect the bottom right pin of the button to pin 12 on the arduino. Cut a small yellow wire (measuring to the length shown) and plug it into the column with the bottom right pin of the button and pin 12 on the arduino (one to the right of pin 11).
Plug that wire in, and then get your other 10 k Ohm resistor. Bend it so that it curves around the outside of the other 10 k Ohm resistor, and then plug it in so that it is on the same column as the top right pin of the new button, and the ground header pin on the arduino.
Next, measure another red wire to the distance shown, cut and plug into the breadboard. It the wire should go from the other red wire to one column to the right of the button.
Next, we are going to plug in a black wire to one row to the right of the red wire we just plugg in. The other end of the black wire will go all the way to the middle hole in the ground header pin.
We now are going to take a white wire, and bend it around the solderless breadboard as shown, and cut it to the length shown.
Cut the wire to length and plug it in on the top right of the solderless breadboard on the second column from the right (next to the black wire) and and over pin 9 on the arduino (2nd hole to the left of the yellow wires, on the black header pin).
Next, take a black wire and cut it to the length shown.
Insert the wire into the breadboard in the position shown below. The top part of the wire should be in the same column as the black wire, and the bottom part of the wire should go straight down, so that there is a one hole gap between it and the bottom right pin on the button.
Next, we are going to install the transistor, which is shown in the picture below. the transistor has a flat side and a round side. It doesn't matter whether the flat side or round side is facing you when you plug it in, but for this tutorial, have the flat side face you. Cut the wires (pins) coming off of the transistor so that the wires a are a bit taller than the height of the breadboard, then plug it in at the location shown.
Next, get one of the 1 k Ohm resistors, which has a brown, black, red, and gold band (in that order).
Remove the paper and bend the legs of the resistor so that the legs connect as shown. It should connect to one pin from the right-most row on the solderless breadboard, and over pin 10 on the header pin for the arduino.
Cut the resistor legs to length, and then plug the resistor in so it sits flush with the breadboard.
Next, we are going to connect the infrared LED. This will send the signal to the other device to tag someone. Find the infrared LED, which has a blue top. This LED, like the other one, has legs that are different lengths. Identify the one that is longer, and trim the legs on the LED so that the long leg is still longer than the short leg. Electricity only goes through the LED one way, and if you plug it in the wrong way, it won't work (kind of like plugging a battery in the wrong way).
Note, if you have purchased a case or want to build a case in the future, do NOT cut the infrared LED's legs shorter. Skip cutting the legs and follow the rest of the steps.
You want to cut the legs on the LED a little lower than the middle, so the legs are cut so they are longer than half the length they started as.
Make sure you keep the long leg longer than the short leg.
Next, position the infrared LED so that the long leg is on the upper area of the solderless breadboard, as shown.
Keeping the long leg on top, plug the infrared LED in as shown, so it is straddling the top and bottom halves of the solderless breadboard, and is on the furthest column to the right.
Now we need to bend the infrared LED to the right. The infrared LED is going to shine light from the base out the rounded end like a flashlight, where the light is coming out of the rounded end. Therefore, wherever the rounded end is pointing is where you will be sending the tag. It's important that the LED points as straight forward as possible so that it is easy to aim the device. If the infrared LED isn't pointing straight, you will need to aim next to the target object to hit it. Most likely, the infrared LED will naturally bend up if you bend it over to the right. Simply bend it the other way so that it is as straight as possible.
In the picture below, the infrared LED is pointing up, as indicated by the solid line through the LED. You want to bend it so that the LED is pointing straight ahead. Note that you are not trying to make it go straight away from the solderless breadboard, which may be crooked. You want it to go straight ahead with respect to the arduino (as shown by the second yellow line going along the bottom of the arduino.
You don't need to make the infrared LED face exactly the same way as the arduino, so don't spend a lot of time on this. But taking a minute to make it as straight as possible will be helpful down the road.
After you've checked that it is straight from the top, look at the front of the device and make sure that the infrared LED isn't pointing up or down, but pointing straight ahead from this viewpoint as well.
Next, we need to attach the 15 Ohm resistor, which has brown, green, black and gold bands (in that order).
Take the paper off the end and bend the resistor so it is connecting to the breadboard as shown. Note, for this one, you can bend the legs straight down from the body of the resistor (the brown part in the middle), and it will be the correct length.
Once you have bent the resistor so that it fits where it is supposed to, cut the legs short so that it sits down close to the solderless breadboard.
We now are ready to connect the last component. Get an infrared receiver. Notice that there is a half-sphere on one side. That sphere detects infrared light. We want that sphere to be pointing in the same direction as the infrared LED (to the right).
Cut the legs on the infrared LED so that they are a bit longer than the solderless breadboard. This component is going to stick up off the breadboard by about an eighth of an inch, so it's ok to keep the legs longer than other components.
Now, we want to bend the legs so that instead of being right next to each other, that are at a forty-five degree angle to one another (If you want to see how the legs are supposed to look after bending them, skip ahead one picture to see how this is supposed to look when you are done bending the legs, and where the infrared receiver goes).
After you have cut the legs, look at the infrared receiver so that the sphere is facing you. Bend the leg on the right of the infrared receiver (the one to your right) forward (towards you), so it is going in the same direction as the sphere.
Next, bend the leg on the left side of the infrared receiver back, so it is going away from the sphere (away from you).
After you have bent the legs, it should be easier to position the infrared receiver so that it can be plugged into the solderless breadboard across three different columns, as shown below (zoomed in to show where each leg of the infrared receiver goes).
And that's it! The first part of the laser tag device is complete! Great job! Here's what the finished product from part 1 should look like:
The next part, part 2, goes over building the electronics that go on your head. Click here to continue to the next part of the tutorial!