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 :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!
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!!!