1
\$\begingroup\$

I'm trying to mod an existing laser tag gun adding new features. To do this I need to "piggy back" on the guns IR receiver and read values from it using a microcontroller (in my case a microbit) whilst its still connected to the existing guns circuitry.

I'm pretty sure the receiver being used is this:

http://arduino-info.wikispaces.com/file/view/IR-Receiver-AX-1838HS.pdf/264668680/IR-Receiver-AX-1838HS.pdf

I perhaps naively assumed I could attach the signal pin of the IR receiver to an analogue GPIO pin and read values from it as the gun is hit by the other gun.

This doesn't appear to work however as I just get a load of low level noise and no obvious peaks and troughs. I'm taking a reading every 0.026 milliseconds which should be roughly in sync with the 38khz frequency of the receiver.

Just to make sure I've tried reading all three pins in case I got the signal pin wrong but they all read the same kind of noise.

Am I just wrong expecting to be able to get a reading from it whilst its also connected to its existing circuit?

Thanks for any help

=================================

Thanks for the help so far. Do I need to put a resistor on the wire out to my GPIO pin, will that let the existing circuit get more of the signal from the IR receiver?

\$\endgroup\$
  • \$\begingroup\$ These are typically digital devices, not analog, so use an ordinary digital input or a timer capture one. \$\endgroup\$ – Chris Stratton Jul 8 '18 at 21:49
  • \$\begingroup\$ Thanks Chris, I read something about that and wondered but woudn't I still see the raw signal if I read it analog? Some more reading suggested I may have done something much more stupid and not connected the ground on the microbit to the ground on the laser guns circuit so no common ground, does that sound more likely? \$\endgroup\$ – Gingemonster Jul 8 '18 at 21:51
  • \$\begingroup\$ Lack of a common ground would certainly cause problems. But trying to use an ADC input could as well; it's always slower and you might not be sampling at the rate you think you are or interpreting the data correctly. Also in faster modes, some MCU ADC inputs can be very low impedance. With IR receivers often being open drain outputs working against a pullup resistor, loading with a low impedance ADC input could itself cause problems. \$\endgroup\$ – Chris Stratton Jul 8 '18 at 22:01
  • \$\begingroup\$ The Rx has automatic gain control with load bias and a limiter with comparator for AM detection on the carrier for the symbol range specified for Lo/hi. A Steady burst preamble sets the AGC followed by data. \$\endgroup\$ – Sunnyskyguy EE75 Jul 8 '18 at 23:49
  • \$\begingroup\$ Ok common ground and digital reading now means I can read the data I was expecting, however now the original laser gun circuit is not responding to the other gun whilst I have the microcontroller connected (and reading pulses as expect). It seems connecting my microcontroller pin is stopping the main circuit getting what it expects. Any ideas? \$\endgroup\$ – Gingemonster Jul 9 '18 at 7:24
0
\$\begingroup\$

You should look at the output signal of the IR receiver. It is not likely to be an analogue voltage. Instead expect it to be a modulated digital signal which you will have to decode in your MCU software. The 38 kHz typically used for IR communications is the carrier frequency of the IR signal. The transmitter will send a signal by sending bursts of IR light at 38 kHz. When the bursts are coming it means one logic level say a '1'. When transmitter holds back on the bursts and there is no light coming to the receiver that would be the opposite logic level say '0'. Note that the modulated '1's and '0's typically will persist for multiple cycles of the 38 kHz. The IR receiver strips away the 38 kHz bursts and outputs a waveform the follows the modulation signal. A typical IR protocol is setup to transmit about 10 times per second.

The best way to get a handle on the actual signal is to look at it with an oscilloscope. Alternately you can use a timer in an MCU to measure the interval between each sequence of low to high transition and high to low transition in the IR protocol transmission and store the measurements for later inspection. A simple setup could take the readings and then send it out a serial port to a PC for study.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.