Feather & multiple IR detectors

Please tell us which board you are using.
For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
ttu_don
 
Posts: 53
Joined: Mon Mar 17, 2014 12:36 am

Feather & multiple IR detectors

Post by ttu_don »

Has anyone tried connecting more than one IR detector to a Feather board?

Most tutorials I've seen only show one IR detector tied to one GPIO pin. I'd like to have 4 IR detectors tied to different input pins on a board, then do something when each pin detects an IR signal.......

User avatar
adafruit_support_bill
 
Posts: 88091
Joined: Sat Feb 07, 2009 10:11 am

Re: Feather & multiple IR detectors

Post by adafruit_support_bill »

That will work fine. You just need to program different things when you detect things on different pins.

User avatar
ttu_don
 
Posts: 53
Joined: Mon Mar 17, 2014 12:36 am

Re: Feather & multiple IR detectors

Post by ttu_don »

Thanks for the response, Bill!

Can you suggest a few Feather boards to use with multiple IR receivers?

I have some IR receiver code working on a Raspberry Pi Pico, but I can't get more than 1 receiver working at a time.....

Maybe the Feather RP2040 can do this....??

User avatar
adafruit_support_bill
 
Posts: 88091
Joined: Sat Feb 07, 2009 10:11 am

Re: Feather & multiple IR detectors

Post by adafruit_support_bill »

Which specific IR detector are you having problems with?

User avatar
ttu_don
 
Posts: 53
Joined: Mon Mar 17, 2014 12:36 am

Re: Feather & multiple IR detectors

Post by ttu_don »

I'm using Adafruit's product 157, the TSOP38238 IR receiver.....

I posted my issue in the CircuitPython & Micropython forum, if you want to have a look.

Thanks!!

User avatar
adafruit_support_bill
 
Posts: 88091
Joined: Sat Feb 07, 2009 10:11 am

Re: Feather & multiple IR detectors

Post by adafruit_support_bill »

The TSOP type detectors are a bit more complex than the reflective or transmissive type IR detectors. Because they are receiving serially encoded data, you need to closely monitor and time the rising and falling edges of the signal. Typically, this is done by sampling a GPIO pin in a tight loop. In theory, you might be able to monitor multiple pins with interrupts. But I'm not aware of any library that does this.

User avatar
ttu_don
 
Posts: 53
Joined: Mon Mar 17, 2014 12:36 am

Re: Feather & multiple IR detectors

Post by ttu_don »

Ok. I didn't know that.....

What IR receiver would you recommend?

The system I'm trying to create is 2 laser tag guns (team 1 & team 2) setup with 3-4 IR receivers each as 'targets' set up on a table.

I found an instructable (https://www.instructables.com/Laser-Shooting-Game/) It uses real lasers, though. I have little kids, so I don't want to use lasers (afraid they'll shoot their eyes out!).

Thanks for your help!!

User avatar
adafruit_support_bill
 
Posts: 88091
Joined: Sat Feb 07, 2009 10:11 am

Re: Feather & multiple IR detectors

Post by adafruit_support_bill »

The TSOPs are probably the ones you want to use for that application. Most of the IR detectors are simple binary devices. They put out a high signal when illuminated by IR and a low signal when not. They cannot discriminate between different sources of IR.

The TSOP38238 uses a 38KHz carrier frequency and can receive coded signals from IR transmitters modulated by that same 38KHz. They put out a high signal when a 38KHz signal is detected and a low signal when not. So in that respect they are similar. But for most applications, the 38KHz serves as a carrier frequency for encoded pulses to send digital commands or data. To decode those pulses, you need to closely monitor the timing - which is difficult to do on multiple pins at once.

The other issue is that while you could have two guns sending two different codes. They would be both transmitting at the same 38KHz frequency. So if both fired at once, they would 'jam' each other.

You could minimize the jamming by using guns and sensors with different frequencies. The TSOP382xx series has other frequency options ranging from 30 to 56 kHz.
https://www.vishay.com/docs/82491/tsop382.pdf

That way, you wouldn't need to send any codes from the guns - just transmit the carrier frequency. And on the receive side, you could treat them as simple binary devices.

The down side would be that you would need 2 sensors per target - one for each frequency of the guns.

User avatar
ttu_don
 
Posts: 53
Joined: Mon Mar 17, 2014 12:36 am

Re: Feather & multiple IR detectors

Post by ttu_don »

Ok. I'm using the receivers to decode the IR transmitted by the gun. With pulseio.PulseIn I can figure out the pulses that the gun is sending, using the REPL of the Pi Pico & Thonny:

Code: Select all

# Expected pulse, pasted in from previous recording REPL session:
pulse = [2936, 2962, 2052, 940, 2048, 964, 2049, 932, 2056, 1961, 2053, 938, 2050, 962, 2039, 963]
This pulse train differs, depending on team 1 or 2. I was hoping to set up a micro or a Raspberry Pi to detect multiple IR receivers & drive a different servo depending on which IR receiver is triggered..... It doesn't look like that can work.... short of using a single micro for each IR receiver.

As for the guns jamming each other out, I'm not sure how to fix that. I have taken one gun apart & figured out how it works, but I don't have the source code for the gun micro & I'm not sure if I can 're-construct' the gun's functions on another micro.....

Are you saying I can use a TSOP38238 in the targets for gun 1 & a TSOP38256 in the targets for gun 2? If that would work, I could simply label each target as 'Team 1' & 'Team 2', so I would only need 1 sensor per target......

User avatar
adafruit_support_bill
 
Posts: 88091
Joined: Sat Feb 07, 2009 10:11 am

Re: Feather & multiple IR detectors

Post by adafruit_support_bill »

Are you saying I can use a TSOP38238 in the targets for gun 1 & a TSOP38256 in the targets for gun 2? If that would work,
Using TSOP sensors of different frequencies would only work if you could control the frequencies transmitted by the guns. Since you don't have the source code for those, you would pretty much need to replace the guts of the guns with a microcontroller running your own code.

The up-side would be that the code on both ends could be very simple. There would be no need for decoding any pulse trains. Each gun could just blast it's carrier frequency, and the output of the corresponding TSOP wold go high when that frequency was detected.

User avatar
ttu_don
 
Posts: 53
Joined: Mon Mar 17, 2014 12:36 am

Re: Feather & multiple IR detectors

Post by ttu_don »

Is there a way to tell what frequency the gun is sending? Maybe using an oscilloscope....?

User avatar
adafruit_support_bill
 
Posts: 88091
Joined: Sat Feb 07, 2009 10:11 am

Re: Feather & multiple IR detectors

Post by adafruit_support_bill »

Yes a scope would be a good way to tell. If you have access to the insides of the gun, you could probe the signal going to the IR emitter. If not, you could use the receiver half of a break-beam sensor and probe the output of that. https://www.adafruit.com/product/2167

Locked
Please be positive and constructive with your questions and comments.

Return to “Feather - Adafruit's lightweight platform”