Shop OBEX P1 Docs P2 Docs Learn Events
Basic Stamp Project - Lazor Tag — Parallax Forums

Basic Stamp Project - Lazor Tag

aforsytheaforsythe Posts: 4
edited 2015-07-04 16:34 in Robotics
So a while ago, I bought a 10-pack of BS Homework boards, and put them on a shelf. At the time my daughter and I were working on a Boe-Bot so we bought some extra curricular items like the 4x20 LCD screen, Sound-Pal and the IR Remote kit, and while we were working on piling all of that on a robot, the box of homework boards sat there for months.

Anyway, to make a long story short, my sons are here for a month in the summer, and we're about half way through after camping and whatnot. We're a little short on cash and I was out of ideas for things to do for the next 2 weeks. Then it hit me, literally. I was moving some things around on the shelf, and this light-weight box fell out and hit me in the face.

I walked out and said, "Hey guys, I've got some electronics here and I was thinking we could do something with them. I've got two of these boards setup to send IR communication back and forth between them, and I was thinking maybe we could do something like make lazerTag vests or something."

They both jumped from their chairs with excitement, but it was 11:30pm so I made them go to bed :) (I'm not inherently evil, it just happens sometimes.)


Anyway, we're just in the beginning prototyping stage and we have the vest Mk.I ready and currently utilizing the remote as is for a gun. I thought some of you here might be interested in doing something like this.

Right now, the vest is just using the IR detector that comes with the remote kit (or one of the ones for the BoeBot kit), an LED and two resisters. The IR Detection circuit is the one from the IR Remote with the BoeBot manual you can download from the shop. The LED circuit is right from the BoeBot manual page 48.

So far, the vest registers hits 3 seconds apart and after 3 hits, you're dead. Again, this was all done in like 3 hours this morning so it's very basic. I plan on getting a few more remotes, dismantling them and making them fit inside some plastic Nerf guns or something of that nature. I need to add sound to the vests, get a proper circuit board and re-stash the solderless homework boards for future prototyping. I'd also like to add a central hub and maybe have the vests or guns communicate via Wifi for different play modes, teams, capture the flag, power-ups, etc... Maybe even add the 2x20 LCD screens to the vests for read-out.

Parts -

1x IR Remote
1x Homework Board
1x 220 Resistor
1x 470 Resistor
1x LED (any color - I'm using Red)
2x Jumper Wires
1x IR Detector

You'll also need a 9v battery, 2 AA for the remote and a serial/USB connector to connect the board.

Here is the basic code I am using, half of which came from the IR Remote kit for detecting and deciphering the IR codes from the Remote using the SONY protocol.



                       ' Ir Remote Lazor Tag

' Process incoming SONY remote messages & display remote code.
' {$STAMP BS2}
' {$PBASIC 2.5}
' SONY TV IR remote variables
irPulse VAR Word ' Stores pulse widths
remoteCode VAR Byte ' Stores remote code
TxPin CON 15
Hits VAR Nib


Hits = 0 'Clear Hit Counter on Reset

DO ' Main DO...LOOP
Get_Pulses: ' Label to restart message check
remoteCode = 0 ' Clear previous remoteCode



' Wait for resting state between messages to end.

  DO
    RCTIME 2, 1, irPulse
  LOOP UNTIL irPulse > 1000

  ' Measure start pulse. If out of range, then retry at Get_Pulses label.
  RCTIME 2, 0, irPulse
  IF irPulse > 1125 OR irPulse < 675 THEN GOTO Get_Pulses
  ' Get Data bit pulses.
  RCTIME 2, 0, irPulse
  IF irPulse > 300 THEN remoteCode.BIT0 = 1
  RCTIME 2, 0, irPulse
  IF irPulse > 300 THEN remoteCode.BIT1 = 1
  RCTIME 2, 0, irPulse
  IF irPulse > 300 THEN remoteCode.BIT2 = 1
  RCTIME 2, 0, irPulse
  IF irPulse > 300 THEN remoteCode.BIT3 = 1
  RCTIME 2, 0, irPulse
  IF irPulse > 300 THEN remoteCode.BIT4 = 1
  RCTIME 2, 0, irPulse
  IF irPulse > 300 THEN remoteCode.BIT5 = 1
  RCTIME 2, 0, irPulse
  IF irPulse > 300 THEN remoteCode.BIT6 = 1
  ' Map digit keys to actual values.
  IF (remoteCode < 10) THEN remoteCode = remoteCode + 1
  IF (remoteCode = 10) THEN remoteCode = 0

  SELECT remotecode

    CASE 1     'Target Code, Change Per Vest
      Hits = Hits + 1
      DEBUG "You've Been hit ", DEC Hits, " Times", CR
      HIGH 15
      PAUSE 250        ' Quickly Flash LED
      LOW 15

      IF Hits >= 3 THEN GOTO Endloop

      PAUSE 3000



    CASE ELSE
      DEBUG "Wrong Target", CR
  ENDSELECT
LOOP ' Repeat main DO...LOOP

Endloop:         ' Game Over Man!

DO
  DEBUG "Game Over Man! Game Over!",CR
  HIGH 15
  PAUSE 500
  LOW 15
  PAUSE 500
LOOP










Comments

  • ercoerco Posts: 20,254
    Nice job! Sounds like a great family project. Be sure to Youtube a video of all the fun!
  • How did I miss this? Must have gotten buried under the "less than positive forum gibberish" when I was out racing yesterday.
    Great project.!
Sign In or Register to comment.