Multiple IR Receivers


Closed Thread
Results 1 to 9 of 9

Hybrid View

  1. #1
    Join Date
    Oct 2004
    Posts
    448


    Did you find this post helpful? Yes | No

    Default

    These modules have a weak internal pullup, so simply connecting the outputs of both modules to a single pic pin should work.

    Regards,

    Anand

  2. #2
    Join Date
    Dec 2007
    Posts
    34


    Did you find this post helpful? Yes | No

    Default

    Hi Guys,
    What i am trying to do is have the signals come in on different pins and then send the received data along with the input pin number out through RS232. I have tried using GOTO and GOSUBS commands but it only works 50% of the time on one pin and not at all on the other.

    Thanks Guys

  3. #3
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by jhorsburgh View Post
    Hi Guys,
    What i am trying to do is have the signals come in on different pins and then send the received data along with the input pin number out through RS232. I have tried using GOTO and GOSUBS commands but it only works 50% of the time on one pin and not at all on the other.

    Thanks Guys
    Are you saying that because one pin is tied up looking for a pulse that it ends up missing pulses on the other pin?
    Not sure if it'll help any (probably won't since a PIC is single threaded and can only act on one input at any one time unless you record any pulses you get and post-process them to see if anything useful was present during the time you recorded any pulses), but if you check your manual, you might find something that'll help you limit the MAXIMUM time the PULSIN statement waits for a PULSE (quite a few hints in that statement right there).

  4. #4
    Join Date
    Dec 2005
    Posts
    1,073


    Did you find this post helpful? Yes | No

    Default

    Why are you using two receivers? If both are 38kHz, both will see both signals. Whichever pin is triggered first will seize control.

  5. #5
    Join Date
    Dec 2007
    Posts
    34


    Did you find this post helpful? Yes | No

    Default

    Hey Guys,
    I had made the following changes to the code, and added the "DEFINE PULSIN_MAX 300" line to the top of the code. It now works for GPIO.3 most of the time but it does not work at all on GPIO.2. The modules are 38Khz dave but i am not sure what you mean by "both will see both signals. Whichever pin is triggered first will seize control. "

    <code>
    STARTPULSE:
    PulsIn GPIO.3,0,CODELENGTH 'MEASURE LOW PULSE (IR LED ON TIME)
    IF (CODELENGTH > 200) and (CODELENGTH < 400) Then SENSOR1
    PulsIn GPIO.2,0,CODELENGTH 'MEASURE LOW PULSE (IR LED ON TIME)
    IF (CODELENGTH > 200) and (CODELENGTH < 400) Then SENSOR2
    goto STARTPULSE

    SENSOR1:
    RXPIN1 = GPIO.3
    pin = 1
    GOTO CODEPULSES

    SENSOR2:
    RXPIN1 = GPIO.2
    pin = 2
    GOTO CODEPULSES
    </code>

    Thanks Again,
    Jeremy

  6. #6
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Place PulsIn GPIO.2,0,CODELENGTH before PulsIn GPIO.3,0,CODELENGTH.

    Does it work with the sensor on GPIO.2 now?
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  7. #7
    Join Date
    Dec 2005
    Posts
    1,073


    Did you find this post helpful? Yes | No

    Default

    Unless the two receivers are optically isolated so that neither can see the signal intended for the other, both will see all signals.

    The first one in your code will process the signal, blocking all of the code statements for the other one.

    If you follow Bruce's suggestion, the one that wasn't working will start working but the other will stop working.

Similar Threads

  1. Replies: 17
    Last Post: - 12th April 2014, 02:17
  2. Plz help in completing RC-5 IR remote lamp dimmer project
    By vu2iia in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 3rd April 2008, 08:44
  3. PIC10F200 Automated IR Light Switch
    By Bruce in forum Code Examples
    Replies: 7
    Last Post: - 3rd May 2007, 11:40
  4. how to get pic to pic communication
    By kinsiro in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 30th August 2005, 17:12
  5. Multiple IR LEDs from 1 port using transistor
    By belpe123 in forum General
    Replies: 3
    Last Post: - 20th May 2005, 22:07

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts