Showing posts with label arduino. Show all posts
Showing posts with label arduino. Show all posts

Monday, March 2, 2020

Flying Laser Tag Gun



I've picked up a new project around laser tag.  A few years ago Flite Test showed off a prototype laser tag system that mounts on an RC airplane.  It generated alot of excitement about the concept but the system never came to market.



There was a little discussion and excitement on their forums over the last few years about how to do it.  At least one project got started and has some impressive demos.  It isn't for sale yet and isn't open source so you can't pick it up and build it yourself.  With a little time off this year I decided to see if I could get the most basic system up and working.  The goals are:
  • Easy to add to an existing plane
  • Works with existing LTX/LTTO taggers for ground-to-air and testing
  • As simple to build at home as possible

The code and build instructions are going up on github.


The basic setup is identical to a LTX tagger.  Two status LEDs give the health and ammo counters.  The FPV camera provides the pilot a view of the status LEDs on the wings and chasing planes should be able to at least see the whole strip flash red on hit to get feedback.


The wiring is pretty simple and the whole thing should easily fit on an Arduino shield.  It could be miniaturized with more work.



I've ordered a batch of PCBs to make an actual sheild which should be a little more robust for mounting.



I am also designing a number of 3d printed parts for mounting the IR LED, lens and a case for the Arduino.





Monday, August 23, 2010

Phoenix LTX

Hey look I made a lazer tag gun! It runs on Arduino using the IRremote library.

Send:
void IRsend::sendPHOENIX_LTX(unsigned long data, int nbits) {

enableIROut(36);
//HEAD
mark(PHOENIX_HDR_MARK);
space(PHOENIX_HDR_SPACE);
mark(PHOENIX_HDR_MARK);
int i = 0;
for (i = 0; i < 7; i++) {
if (i % 2 == 0) {
space(PHOENIX_LTX_SPACE);
} else {
mark(PHOENIX_LTX_ZERO_MARK);
}
}
//DATA
if ((data >> 2) & 1 == 1) {
mark(PHOENIX_LTX_ONE_MARK);
} else {
mark(PHOENIX_LTX_ZERO_MARK);
}
space(PHOENIX_LTX_SPACE);
if ((data >> 0) & 1 == 1) {
mark(PHOENIX_LTX_ONE_MARK);
} else {
mark(PHOENIX_LTX_ZERO_MARK);
}
//TAIL
for (i = 0; i < 4; i++) {
if (i % 2 == 0) {
space(PHOENIX_LTX_SPACE);
} else {
mark(PHOENIX_LTX_ZERO_MARK);
}
}
space(PHOENIX_LTX_SPACE);

}

Receive:
long IRrecv::decodePHOENIX_LTX(decode_results *results) {

long data = 0;

int offset = 1;

int i = 0;

//HEAD

if (results->rawlen != 18) {

return ERR;

}

if (!MATCH_MARK(results->rawbuf[offset], PHOENIX_HDR_MARK)) {

return ERR;

}

offset++;

if (!MATCH_SPACE(results->rawbuf[offset], PHOENIX_HDR_SPACE)) {

return ERR;

}

offset++;

if (!MATCH_MARK(results->rawbuf[offset], PHOENIX_HDR_MARK)) {

return ERR;

}

offset++;

for (i = 0; i < 7; i++) {

if (i % 2 == 0) {

if (!MATCH_SPACE(results->rawbuf[offset], 2000)) {

Serial.println(i, DEC);

return ERR;

}



} else {



if (!MATCH_MARK(results->rawbuf[offset], 1000)) {

Serial.println(i, DEC);

return ERR;

}

}

offset++;

}

Serial.println("Data");

//DATA

for (i = 0; i < 3; i++) {

if (MATCH_MARK(results->rawbuf[offset], PHOENIX_LTX_ONE_MARK)) {

data << 1;

data |= 1;

} else if (MATCH_MARK(results->rawbuf[offset], PHOENIX_LTX_ZERO_MARK)) {

data << 1;

data |= 0;

} else {

Serial.println(i, DEC);

return ERR;

}

offset++;

}

Serial.println("Tail");

//TAIL

for (i = 0; i < 2; i++) {

if (!MATCH_SPACE(results->rawbuf[offset], 2000)) {

return ERR;

}

offset++;

if (!MATCH_MARK(results->rawbuf[offset], 1000)) {

return ERR;

}

offset++;

}



// Success

results->bits = 3;

results->value = data;

results->decode_type = PHOENIX_LTX;

return DECODED;

}

Defines:
#define PHOENIX_HDR_MARK 3000
#define PHOENIX_HDR_SPACE 6000
#define PHOENIX_LTX_ONE_MARK 2000
#define PHOENIX_LTX_ZERO_MARK 1000
#define PHOENIX_LTX_SPACE 2000