Author Topic: IR receiver circuit problem  (Read 8079 times)

0 Members and 1 Guest are viewing this topic.

Offline AsimTopic starter

  • Regular Contributor
  • *
  • Posts: 171
IR receiver circuit problem
« on: November 26, 2013, 02:56:20 pm »
Hi guys,
I built this circuit  http://www.electronics-diy.com/schematics/1064/rx.GIF when I connect the IR receiver to the microcontroller  the signal stays low, but when I disconnect the IR receiver from the microcontroller and connect the oscilloscope to the output of the receiver I receive the correct signal from the transmitter, any idea why and what are the possible solutions ?. This is the link of the project http://www.electronics-diy.com/electronic_schematic.php?id=1064

Thanks
 

Offline AG6QR

  • Frequent Contributor
  • **
  • Posts: 867
  • Country: us
    • AG6QR Blog
Re: IR receiver circuit problem
« Reply #1 on: November 26, 2013, 03:28:43 pm »
Just a guess, but it sounds to me like maybe the "input" pin of the microcontroller is configured as an output pin and is outputting low voltage.  Check your initialization in the software.
 

Offline macboy

  • Super Contributor
  • ***
  • Posts: 2327
  • Country: ca
Re: IR receiver circuit problem
« Reply #2 on: November 26, 2013, 04:13:11 pm »
Two things:
First, ensure that the microcontroller pin is set to input (mentioned by AG6QR already).
Second, you might need a pull-up resistor on the output of the IR module. 10k to 100k should be fine.

p.s. I always use an RC filter for the power on IR modules, as they tend to be extremely sensitive to power supply noise. Typically I would use a 100? series resistor and a 10 µF bypass cap.
 

Offline AsimTopic starter

  • Regular Contributor
  • *
  • Posts: 171
Re: IR receiver circuit problem
« Reply #3 on: November 26, 2013, 05:21:36 pm »
Just a guess, but it sounds to me like maybe the "input" pin of the microcontroller is configured as an output pin and is outputting low voltage.  Check your initialization in the software.

I had the code in a hex file from diy electronics , so i am assuming that pin is configured as input
 

Offline AsimTopic starter

  • Regular Contributor
  • *
  • Posts: 171
Re: IR receiver circuit problem
« Reply #4 on: November 26, 2013, 05:25:54 pm »
Two things:
First, ensure that the microcontroller pin is set to input (mentioned by AG6QR already).
Second, you might need a pull-up resistor on the output of the IR module. 10k to 100k should be fine.

p.s. I always use an RC filter for the power on IR modules, as they tend to be extremely sensitive to power supply noise. Typically I would use a 100? series resistor and a 10 µF bypass cap.

i think the 2nd point is already done in the schematic, maybe you can suggest some modifications to it ?
 

Offline AG6QR

  • Frequent Contributor
  • **
  • Posts: 867
  • Country: us
    • AG6QR Blog
Re: IR receiver circuit problem
« Reply #5 on: November 26, 2013, 05:48:49 pm »
Just a guess, but it sounds to me like maybe the "input" pin of the microcontroller is configured as an output pin and is outputting low voltage.  Check your initialization in the software.

I had the code in a hex file from diy electronics , so i am assuming that pin is configured as input

Did you check it?  Unless you've verified that point, it's possible the hex file is wrong, or it's also possible the chip wasn't programmed right and doesn't have that hex file programmed into it.  It's also possible that the pin's circuitry has been damaged by overvoltage, ESD, or something like that, and is shorted to ground.

Try putting a high valued resistor, say 10K to 100K or so, on that pin, without connecting anything else to the pin (leave the IR receiver disconnected).  Connect the other end of that resistor to Vcc, and watch what happens to the voltage at the pin.  Repeat, but this time connect the other side of the resistor to ground.  If the pin is set as input, you should be able to use a weak pullup/pulldown resistor to change the state either direction.  If the pin is set as output, the voltage at the pin will be relatively unaffected by a weak pullup/pulldown resistor.

Your circuit schematic already shows a 10K pullup resistor.  Make sure that's present and wired correctly.
 

Offline AsimTopic starter

  • Regular Contributor
  • *
  • Posts: 171
Re: IR receiver circuit problem
« Reply #6 on: November 26, 2013, 06:23:26 pm »
Just a guess, but it sounds to me like maybe the "input" pin of the microcontroller is configured as an output pin and is outputting low voltage.  Check your initialization in the software.

I had the code in a hex file from diy electronics , so i am assuming that pin is configured as input

Did you check it?  Unless you've verified that point, it's possible the hex file is wrong, or it's also possible the chip wasn't programmed right and doesn't have that hex file programmed into it.  It's also possible that the pin's circuitry has been damaged by overvoltage, ESD, or something like that, and is shorted to ground.

Try putting a high valued resistor, say 10K to 100K or so, on that pin, without connecting anything else to the pin (leave the IR receiver disconnected).  Connect the other end of that resistor to Vcc, and watch what happens to the voltage at the pin.  Repeat, but this time connect the other side of the resistor to ground.  If the pin is set as input, you should be able to use a weak pullup/pulldown resistor to change the state either direction.  If the pin is set as output, the voltage at the pin will be relatively unaffected by a weak pullup/pulldown resistor.

Your circuit schematic already shows a 10K pullup resistor.  Make sure that's present and wired correctly.


I just checked it from the hex file  (((((( #DEFINE IR      PORTA,3   ; IR LED input with R10K pull-up to vcc))))))   

it is defined as input.  I will check the other points you mentioned when i go back to the lab tomorrow ( it is night in here)

thank you for your help
 

Offline Mr Smiley

  • Frequent Contributor
  • **
  • Posts: 324
  • Country: gb
Re: IR receiver circuit problem
« Reply #7 on: November 26, 2013, 06:56:07 pm »
RA3 is an input only, so it can't be set as an output, it's also /mclr and Vpp

 :)
There is enough on this planet to sustain mans needs. There will never be enough on this planet to sustain mans greed.
 

Offline PA0PBZ

  • Super Contributor
  • ***
  • Posts: 5325
  • Country: nl
Re: IR receiver circuit problem
« Reply #8 on: November 26, 2013, 07:04:47 pm »


 :palm:
Keyboard error: Press F1 to continue.
 

Offline AG6QR

  • Frequent Contributor
  • **
  • Posts: 867
  • Country: us
    • AG6QR Blog
Re: IR receiver circuit problem
« Reply #9 on: November 26, 2013, 07:23:42 pm »

I just checked it from the hex file  (((((( #DEFINE IR      PORTA,3   ; IR LED input with R10K pull-up to vcc))))))   

it is defined as input.  I will check the other points you mentioned when i go back to the lab tomorrow ( it is night in here)

thank you for your help

That code doesn't configure it as input, the code which writes the values to TRISA would set whether that pin is configured as input or output.

However, as Smiley helpfully pointed out (and I just double-checked the PIC16F630 datasheet to confirm) the RA3 pin is always input.  Its bit in TRISA is always 1, regardless of what the software attempts to set it to.  So, unlike most of the other pins, it's impossible to get that misconfigured.  It IS possible for the port circuitry to be zapped by static or something like that.  So I'd still try pulling it up and down with a high valued resistor.

And as PA0PBZ suggests, double check your IR receiver's pinout.  I didn't suspect that, because if you got that wrong, then the tests of the IR receiver's output on the scope probably shouldn't have looked right.  But yeah, there's definitely a mismatch between your schematic and the published TSOP4838 pinout.

 

Offline AsimTopic starter

  • Regular Contributor
  • *
  • Posts: 171
Re: IR receiver circuit problem
« Reply #10 on: November 26, 2013, 07:29:54 pm »


 :palm:

Don't worry i am not that stupid :p

I always check the datasheets for pin configuration and yea the schematic is wrong on that part
 

Offline AsimTopic starter

  • Regular Contributor
  • *
  • Posts: 171
Re: IR receiver circuit problem
« Reply #11 on: November 26, 2013, 07:35:23 pm »
RA3 is an input only, so it can't be set as an output, it's also /mclr and Vpp

 :)

AHA, that's good news



I just checked it from the hex file  (((((( #DEFINE IR      PORTA,3   ; IR LED input with R10K pull-up to vcc))))))   

it is defined as input.  I will check the other points you mentioned when i go back to the lab tomorrow ( it is night in here)

thank you for your help

That code doesn't configure it as input, the code which writes the values to TRISA would set whether that pin is configured as input or output.

However, as Smiley helpfully pointed out (and I just double-checked the PIC16F630 datasheet to confirm) the RA3 pin is always input.  Its bit in TRISA is always 1, regardless of what the software attempts to set it to.  So, unlike most of the other pins, it's impossible to get that misconfigured.  It IS possible for the port circuitry to be zapped by static or something like that.  So I'd still try pulling it up and down with a high valued resistor.

And as PA0PBZ suggests, double check your IR receiver's pinout.  I didn't suspect that, because if you got that wrong, then the tests of the IR receiver's output on the scope probably shouldn't have looked right.  But yeah, there's definitely a mismatch between your schematic and the published TSOP4838 pinout.


yea, i took care of that and as you said if i connected it wrong i wouldn't have an output :)

i will do what you mentioned about the pulling resistor  tomorrow, hopefully it will work . i will even program a different microcontroller just in case
 

Offline PA0PBZ

  • Super Contributor
  • ***
  • Posts: 5325
  • Country: nl
Re: IR receiver circuit problem
« Reply #12 on: November 26, 2013, 07:36:40 pm »
Don't worry i am not that stupid :p

Too bad, it was an easy solution  ;)

The next thing to try (as already suggested) is to pull the pin up and down with a 10K resistor and measure the pin voltage.
Keyboard error: Press F1 to continue.
 

Offline AsimTopic starter

  • Regular Contributor
  • *
  • Posts: 171
Re: IR receiver circuit problem
« Reply #13 on: November 26, 2013, 07:47:19 pm »
Don't worry i am not that stupid :p

Too bad, it was an easy solution  ;)

The next thing to try (as already suggested) is to pull the pin up and down with a 10K resistor and measure the pin voltage.

HAHAHAHAAHA, now i wish that was the problem xD
 

Offline AsimTopic starter

  • Regular Contributor
  • *
  • Posts: 171
Re: IR receiver circuit problem
« Reply #14 on: November 27, 2013, 10:03:45 am »
I figured out the problem, in the schematic RA3 is pin # 13 but when i checked the datasheet is says pin #4 , i fixed it and it worked. the problem now is the range is very small ( 1 meter with direct pointing to the receiver ) how can i improve the range ? I am using BC547 transistor for the IR Emitter   
 

Offline macboy

  • Super Contributor
  • ***
  • Posts: 2327
  • Country: ca
Re: IR receiver circuit problem
« Reply #15 on: November 27, 2013, 01:20:29 pm »
I figured out the problem, in the schematic RA3 is pin # 13 but when i checked the datasheet is says pin #4 , i fixed it and it worked. the problem now is the range is very small ( 1 meter with direct pointing to the receiver ) how can i improve the range ? I am using BC547 transistor for the IR Emitter
Make sure your lithium cell is fresh. Try adding a 10 µF (or so) in parallel with C3, and reduce R1 from 100 ? to say 33 ?.  Reduce R2 from 1k to say 330 ? to help ensure that the transistor really saturates. Add another set of "R1" and IR LED. If all that doesn't help, then try driving the IR LED directly from the PIC pin RC6 to ground, no resistor. All of the 16F PICs have outputs that are internally current-limited at roughly 25 mA (~50 mA into a short circuit). That should be sufficient to drive the LED without all the extra parts, but whether it works better is up to you to find out.
 

Offline AsimTopic starter

  • Regular Contributor
  • *
  • Posts: 171
Re: IR receiver circuit problem
« Reply #16 on: November 27, 2013, 05:32:05 pm »
The range is now good, but the angle at which i can trigger the receiver is quiet bad ( very narrow )
Is their a way to improve the angle ?
 

Offline wraper

  • Supporter
  • ****
  • Posts: 18236
  • Country: lv
Re: IR receiver circuit problem
« Reply #17 on: November 27, 2013, 05:56:41 pm »
The range is now good, but the angle at which i can trigger the receiver is quiet bad ( very narrow )
Is their a way to improve the angle ?
I suggest to take some tv remote and point mobile phone camera to it. Watch the brightness of the led while pressing buttons, then compare to this remote.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf