Introduction: DIY Laser Tag System (Microcontroller Verison)

   Here is the long awaited laser tag system with microcontroller setup! If you have have a microcontroller with multiple inputs, then this will tell you how to use it to create and program a laser tag system of your own with a large customization factor. If you do not have a microcontroller, you may want to try this other instructable which deals with two 555 timer chips instead of a microcontroller. For those of you who have a microcontroller you can now see how to create my laser tag system with audio and visual feedback as well as a rumble feature. If you have the time, you might like to watch my four-part introduction and demo of the circuit before you start building.

Materials:
1x 555 timer chip
1x microcontroller (I'm using a Basic Stamp 2 chip but an Arduino would do just as nicely)
1x Peizospeaker
4x +/- resistors (1x 330; 1x 2.2K; 1x 4.7k; 1x 22k)
2x +/- photoresistor (1/4" cell with 3 ribs: 2.5M ohm darkness, 3.35k ohm in ambient light, 330 ohm in bright (laser) light)
4x LEDs (probably four different colors would be best and high brightness)
1x tactile switch
various jumper wires

* The resistors are considered to be +/- because the amounts will vary depending on whether you need resistors for the LEDs or if you have fewer or more photoresistors that you want swap in place of the resistors you have.

tools:
computer with programming software installed
needlenose pliers
laser pointer









Step 1: Step 1: Building the Schmitt Trigger, Bells, and Whistles

   This step can be broken up into smaller steps so that you can double check your work later on if you get stuck.

Step 1. Connect 555 timer to ground and power (1st and 8th pins respectively)

Step 2. Connect pin6 to ground.

Step 3. Connect a 4.7k resistor from power to pin 2.

Step 4. Connect two photoresistors in series from pin 2 to pin 6.

Step 5. Connect a 330 ohm resistor from the 555 timer output to pin 9 (or other pin of your choice) on the microcontroller.

Step 6. Connect a 2.2k resistor from the 555 timer pin 4 to pin 8 (or other pin of your choice) on the microcontroller.
*your Schmitt Trigger is now done

Step 7. Connect a peizospeaker so that it's ground connects with pin 1 on the 555 timer and a jumper connects its power to pin 6  (or other pin) on the microcontroller.

Step 8. Connect each of your four LEDs so that their anodes go to pins 2 through 5 (or other pins) on the microcontroller and leave open ends on the board. (see image below for details on how it looks)

Step 9. Connect all the cathodes of the LEDs together and connect the last wire of the group to pin 6 (it won't affect the Schmitt Trigger)

Step 10. Connect your tactile switch so that one lead connects directly to pin 0  (or other pin) on the microcontroller, the other lead on the other side connects to power, and the lead one lead on hthe other side connects to ground via a 22k resistor.

Step 11. Finally, if you have a pager motor connect it's positive lead to the 555 timer output directly and ground it directly to the board, for a rumble feature when you're hit.

Step 2: Step 2: Programming = Fun!

   This step is just a very short explanation of the programming. First of all, the language used by the Basic Stamp 2 ( you could call it a step brother of the Arduino) is called PBASIC, which you can download for free from Parallax . Keep in mind though, this language is for the Basic Stamp and does not run on other microcontroller (such as the Propeller chip which uses Spin language). Let's have a run-down of the commands necessary for the laser tag counter that I have written:

   Hits VAR Nib

   The syntax: "Name" "type of data" "data size"
   Where "Name" is a user given name to the variable to refer to in programming, "type of data" asks whether the Name is a variable or constant, and "data size" refers to the type of variable it will be: Bit, Nibble, Byte, or Word. A Bit holds a 0 or 1, a Nibble holds numbers 0 - 15, a Byte holds numbers 0 - 255, and a Word holds numbers 0 - 65535.

   LOW 8
   HIGH 8

   The syntax: LOW "Pin"     :     HIGH "Pin"
   "Pin" is the pin you want to turn off (LOW) or on (HIGH)

  
   FREQOUT 6, 2000, 1000

   The syntax: FREQOUT "Pin", "Duration", "Frequency"
   "Pin" is the pin to send a pulse to, "Duration" is how long  (in milliseconds) the pulse will last, and "Frequency" is the frequency in hertz.

   PAUSE 250

  The syntax: PAUSE "Duration"
  "Duration" is the length of pause in milliseconds

   FOR Report= 1 TO Total
   FREQOUT 6, 100, 2000
   PAUSE 100
   NEXT

   The syntax: FOR "Variable"= "Number/Variable" to "Number/Variable"
                     |
                     NEXT
   "Variable" is the name of a variable used for counting, and "Number/Variable" is a number or variable standing in for a starting and ending value for the FOR...NEXT loop to count to before finishing.

   IF (Total = 0) THEN ' if no hits, give "error" tone
      FREQOUT 6,2000,1000 ' gives speaker "error" tone
   ENDIF

   The syntax: IF ("Number/Variable" "Operator" "Number/Variable") THEN
                         |
                     ENDIF
   "Number/Variable" stands in for a value that should be compared to another value, "Operator" is an operator such as an =, > or <.

And that is all the commands you really need to learn. You can see that these all came from the source code I uploaded below so it has some context and they're not just random examples. I can help with any programming questions that you have, so feel free to drop me a line. Enjoy yourselves and stay tuned for my next circuit using dark triggering.

Comments

author
Quin5 (author)2014-05-15

I'm looking to purchase a lazertag system to start a lazertag business,
would you be able to produce or lead me to the guns and equipment I need
that would be safe and certifiable, that would be a cheaper option than
the $600/gun price range that I've seen advertised by the lazertag
manufacturers? email if so at ulrichinvesting@gmail.com

author
Raphango (author)2014-05-03

Sorry for my ignorance, but what's the use of it? =)

author
16skittles (author)2011-11-17

Could you add a price estimate like you did with the other?

About This Instructable

12,236views

32favorites

License:

More by MacDynamo:Security System Power SaverDIY Laser Tag System (Microcontroller verison)Unseen burglar alarm.
Add instructable to: