infrared recievers using multiple

Status
Not open for further replies.

Benangulo

Member
Im making a toy the plan is to have it follow the kid that has an infrared controller. Ive been able to get the IR receiver to work fine with the teensy. Now I want to add the tracking of the kid using multiple IR recievers. Is this possible or should I use another method? Thanks
 
Are we talking about PIR sensors or photodiodes/-transistors? I think we need a little more information before we can help you. Whats the IR source on the kid? the kid itself? A IR Diode, PWM'ed or CW?
Ben
 
TSOP4838 is the reciever im using a standard tv remote now as I develop the code. I want the kid to have like a nintendo power glove on with a reciever and transmitter the toy aka "enemy" will also have rx/tx ir. As the kid moves the enemy will have 4 rx just to receive the location of the kid . If the kid moves 6 ft to the right, the enemy toy turns to face him.
Disney has a toy like this called the playmation
 
These kind of receivers are usually used in IR remotes and contain an internal demodulator for the carrier frequency (in your case 38kHz). This is necessary to make the receiver immune to sunlight ("DC" light) and to pulsing light at frequencies other than 38kHz (caused by LED lighting or CFLs). The output has no indication of signal strength, so it's not easy to use the receiver's directivity for an estimation of the relative angle to the IR source. These receivers also happily accept IR that bounced off of a wall or ceiling.
Maybe start by having the IR source sweep it's power output from 0 to 100% periodically. Then use multiple receivers at different angles and count how many signals you get on each of them. The ones with the biggest percentage of received signals are facing the IR source.

Ben
 
These kind of receivers are usually used in IR remotes and contain an internal demodulator for the carrier frequency (in your case 38kHz). This is necessary to make the receiver immune to sunlight ("DC" light) and to pulsing light at frequencies other than 38kHz (caused by LED lighting or CFLs). The output has no indication of signal strength, so it's not easy to use the receiver's directivity for an estimation of the relative angle to the IR source. These receivers also happily accept IR that bounced off of a wall or ceiling.
Maybe start by having the IR source sweep it's power output from 0 to 100% periodically. Then use multiple receivers at different angles and count how many signals you get on each of them. The ones with the biggest percentage of received signals are facing the IR source.

Ben
++
Great idea!
 
Thanks, I hope to make a fun diy toy. I have already coded a bunch of the interactivity. I will post some code up soon so all the forum can see and help make it better
 
So would that be done as an analog input?
no, the receiver output is digital. It is active (I'm not shure if these are low-active or high-active) when the receiver detects IR pulses at 38kHz and off if it doesn't. Hence my suggestion in #4. The IR emitter should pulse out 38kHz constantly, but with a "sawtooth" power profile over time. Don't cycle through the power output too quickly, the receiver needs some 38kHz-cycles to lock in to the signal. Maybe a 10Hz cycle is a good start.
Ben
 
Common IR receivers have an IR phototransistor, a bandpass filter for 38KHz, an amplifier, and a digital serial output. Serial is the same bit stream that the IR transmitter emitted. Software has to measure the bit periods and decode. Lots of that on the 'net, and for Arduino. Maybe T3 too. These are packaged like a three-lead transistor or a metal cube for PCB mount, and with an IR lens. Cost $3 or so. Most common serial data format is "RC5".

The ones I used needed very clean 5V power. And a 20K pullup on the output.

Don't try this with a bare IR diode without the filter and amp. Won't work more than a few inches.
https://www.google.com/url?sa=t&rct...MUgpWfXIw&sig2=0LTv5U9OxHpqOvlJFaKi4w&cad=rja

https://www.radioshack.com/products/38khz-infrared-receiver-module?variant=5717577093
 
Last edited:
I recently did a project at home for my surround sound system. The remote stopped working (never tracked down what the cause was, likely the IR transmitter went bad) and so I decoded the signal sent from each button and programmed it with my Teensy which was hooked up to an IR transmitter (below is the code from testing on an Arduino first, so just need to change pin definitions and such).

Here is a good article for reference on the NEC protocol: http://www.circuitvalley.com/2013/09/nec-protocol-ir-infrared-remote-control.html

Sample of the code I used to transmit the required 38kHz carrier wave:

Code:
/*

Leading Pulse     9000us
Space             4500us
Address + Inv.   27000us  
Command + Inv.   27000us
Stop Bit           562us
-------------------------
TOTAL            68062us

*/

unsigned long powerOn    = 0b00000000111111110011000011001111;
unsigned long volumeUp   = 0b00000000111111110100001010111101;
unsigned long volumeDown = 0b00000000111111111100001000111101;

void setup() {
    DDRB |= (1<<PINB5);
}

void loop() {
    sendData(volumeUp);
    delay(40);
    repeatBurst(); // increment volume
    repeatBurst(); // increment volume again
    delay(5000);
    
    sendData(volumeDown);
    delay(40);
    repeatBurst(); // decrement volume
    repeatBurst(); // decrement volume again
    delay(5000);
}

void repeatBurst() {
    carrierFreq(9000);        // leading pulse   9.0 ms
    delayMicroseconds(2250);  // space           2.25ms
    carrierFreq(562);         // pulse burst        562us 
    delay(108);
}

void carrierFreq(int usDuration) {
    uint16_t numCycles = usDuration * 0.076;

    for (int i=0; i<=numCycles; i++) {
        PORTB ^= (1<<PINB5);
        delayMicroseconds(13);   
    } 
}

void sendData(unsigned long dataSequence) {

    carrierFreq(9000);        // leading pulse   9.0 ms
    delayMicroseconds(4500);  // space           4.5 ms
    
    for (int i=0; i<32; i++) {
        // turn on carrier for 1 bit time (562us)
        carrierFreq(562);
        
        // go silent, check for a 1 or 0
        if (dataSequence & 0x80000000) {
            delayMicroseconds(1675);
        }
        else {
            delayMicroseconds(562);
        }
        dataSequence <<= 1; // bitshift 1
    } 
    carrierFreq(562);  // send stop bit
}
 
Last edited:
So just to be sure do I also have to use Serial1 , Serial2, Serial3, to receive transmissions from all the infrared receivers?
 
So just to be sure do I also have to use Serial1 , Serial2, Serial3, to receive transmissions from all the infrared receivers?

That depends. If you want to just see wether the Receiver receives or not, any digital pin is good. If you want to actually transmit data, you _can_ use serial, although the usual protocols used for IR rx/tx are different, because the bit error rate ist typically to high to establish a working and useful serial connection. See joe_prince's link about the NEC protocol. And google "channel coding" and "coding theory" if you want to dig deeper into this.

Ben
 
So just to be sure do I also have to use Serial1 , Serial2, Serial3, to receive transmissions from all the infrared receivers?
IR Receivers . the $2 ones with the diode, amp and serial output.... do NOT output UART serial data. They output the serial bit stream of the on/off keying of the 38KHz carrier.

You can buy IR receivers with a microprocessor that makes UART serial data out of the raw bits from IR. Like IRman (no longer made but can be found (I have 2)), UIRT (IR to USB as a serial COMn device).
 
Thanks guys I got the basic idea going. I used what Ben said. I created an if statement with the condition being that the IR receiver get 1000 hits. Then it would know which side is getting hits. I started at 50 but it was too small of a threshold. Each IR is just used on any digital in as a basic on/off switch.
I have it with 2 ir sensors, next is to add maybe another 2.
Thanks again guys
 
Status
Not open for further replies.
Back
Top