Nerf Laser Ops - simulate the signal

Hi,
I have been playing with those Nerf things as well and I went a little farther. Lots of guess work, but it seems I can decode shoots from any color and shoot back. I still lack power, so I can't shoot a Nerf placed more than 50 cm from my emitter, but I'm working on it.

I haven't tested your code, but I think you missed one (maybe important) point:
the signal sent by the blasters begin with a 3 stepped header and not a unique pulse. Also, you can safely round the values in your array to multiples of 1000 microseconds. This will not enhance the signal, just improve readability. As you may already have guessed, the signal is composed of a header followed by 16 bits, depending on the shooter's color.

  • The header is a 3ms pulse followed by a 6ms pause and a 3ms pulse again.
  • A bit is composed of a 2ms pause followed by a 1ms pulse if the value is 0 or a 2ms pulse if the value is 1.

And finally, when the blasters are not connected to the app, the signals are:
RED: , 0,0,0,0, 1,0,0,0, 0,0,0,0, 0,0,0,0
BLUE: 0,0,0,0, 1,0,0,0, 0,1,0,0, 0,0,0,0
PURPLE: 0,0,0,0, 1,0,0,0, 1,0,0,0, 0,0,0,0

So maybe you should have a try with:
unsigned int RED[35] = {3000, 6000, 3000,
2000, 1000, 2000, 1000, 2000, 1000, 2000, 1000,
2000, 2000, 2000, 1000, 2000, 1000, 2000, 1000,
2000, 1000, 2000, 1000, 2000, 1000, 2000, 1000,
2000, 1000, 2000, 1000, 2000, 1000, 2000, 1000};

unsigned int BLUE[35] = {3000, 6000, 3000,
2000, 1000, 2000, 1000, 2000, 1000, 2000, 1000,
2000, 2000, 2000, 1000, 2000, 1000, 2000, 1000,
2000, 1000, 2000, 2000, 2000, 1000, 2000, 1000,
2000, 1000, 2000, 1000, 2000, 1000, 2000, 1000};

unsigned int PURPLE[35] = {3000, 6000, 3000,
2000, 1000, 2000, 1000, 2000, 1000, 2000, 1000,
2000, 2000, 2000, 1000, 2000, 1000, 2000, 1000,
2000, 2000, 2000, 1000, 2000, 1000, 2000, 1000,
2000, 1000, 2000, 1000, 2000, 1000, 2000, 1000};

irsend.sendRaw(powerOn, 35, 38); // don't forget to correct the array length!

Please let us know if it helped you and what wavelength gives the best results, I suspect my own problems come from an unadapted IR LED, so I have to buy some.
I will try your code soon and post an update if I have any idea.

You can read my work-in-progress on my github account, BTW