[Solved] Laser tag

Hi, I'm actually trying to make a laser tag game using arduino. I've used arduino a lot so I have no problem with this project exept for the infrared transmission... I just can't find a way to make it work. I've tried this code :Technologies – IBM Developer but I can't make it work correctly. I am capting the signal but it ain't right and never the same read. I've also tried IRremote library with partial success but nothing working as I want. Finally, I've tried making my own code for transmission and it was a disaster. I'm using an ir LED and a vs1838b module at 38kHz. I've tried with a capacitor at the receiver but it was not working or making it worse. In the future, I will put a lens in front on the LED to increase range but that won't solve my actual issue. Does anyone know how to handle this?

Thank you!

You tried some code and it didn't work? Here's what you do, go show the project to someone who knows what they're doing and show them the code, the wiring, tell them about all the parts you have and describe in detail what you expected to see and what actually happened. Don't say anything totally useless like:

but it ain't right

Instead, describe how it isn't right and give them all the symptoms that they might need in order to try to tell what is wrong with your setup.

This would have been a great place to do all of this. Why you chose to just complain that it didn't work without giving anyone a chance to help you is beyond me. I can't imagine how you thought anyone would be able to help if all they know about it is that it doesn't work. But if you'll show it to someone and let them know what you did and how exactly it is broken then maybe someone who has some information about it can help you.

Hi, sorry if I was too general in my post.

So I attached the code I am using because it was too long to be included in the post.

I put a0.1uF capacitor at the vs1838b receiver. My wiring is exactly as described in the tutorial. When I let the IRpulse value at 600, the signal I get at the receiver is a serie of 2. What I understand from the code is that the decoding code was no able to identify bits as ones or zeros. So I played with IRpulse value and around 150 I get series of 0 and 1 but these are not the same I sent and are varying from read to read.

I am also trying to modulate the signal using tone function but I have not yet been able to get a transmission. The way I proceed is by maintaining the 38kHz signal for 1200 microseconds for ones and for 600 microseconds for zeros. There is a pause of 600 microseconds between impulses. These values are, from my understanding of the code, the same as the gun is supposed to send. My receiver is getting a signal, but it is just a serie of zeros. My hypothesis is that there is an inaccuracy with the length of the impulse I am sending, which leads to the receiver to miss read it.

I hope to have been more clear!

Thank you!

Code.txt (18.8 KB)

The filter in the IR receivers shortens received pulses by 50-100µs. Check your transmitted and received pulse lengths.

If you cannot make the IRremote library work with your project, something is wrong with your circuits.

That was just this. I've tried making emitter impulses a little longer and everything worked. Previously, when I was modifying the IRpulse value, I was modifying both the emitter and the receiver so there was always a small diffirence between the emitter and the received signal. Now, only by a small increase in the emitted signal, I am able to detect the whole byte without any error.

Thank you very much!!!