IR receiver circuit problem  - Page 1
Forum section: electronics / projects

author: Asim
author_rank: Regular Contributor
timestamp: November 26, 2013, 02:56:20 pm
content: Hi guys,I built this circuithttp://www.electronics-diy.com/schematics/1064/rx.GIFwhen 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 projecthttp://www.electronics-diy.com/electronic_schematic.php?id=1064Thanks

author: AG6QR
author_rank: Frequent Contributor
timestamp: November 26, 2013, 03:28:43 pm
content: 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.

author: macboy
author_rank: Super Contributor
timestamp: November 26, 2013, 04:13:11 pm
content: 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.

author: Asim
author_rank: Regular Contributor
timestamp: November 26, 2013, 05:21:36 pm
content: Quote from: AG6QR on November 26, 2013, 03:28:43 pmI had the code in a hex file from diy electronics , so i am assuming that pin is configured as input

author: Asim
author_rank: Regular Contributor
timestamp: November 26, 2013, 05:25:54 pm
content: Quote from: macboy on November 26, 2013, 04:13:11 pmi think the 2nd point is already done in the schematic, maybe you can suggest some modifications to it ?

author: AG6QR
author_rank: Frequent Contributor
timestamp: November 26, 2013, 05:48:49 pm
content: Quote from: Asim on November 26, 2013, 05:21:36 pmDid 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.

author: Asim
author_rank: Regular Contributor
timestamp: November 26, 2013, 06:23:26 pm
content: Quote from: AG6QR on November 26, 2013, 05:48:49 pmI 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

author: Mr Smiley
author_rank: Frequent Contributor
timestamp: November 26, 2013, 06:56:07 pm
content: RA3 is an input only, so it can't be set as an output, it's also /mclr and Vpp

author: AG6QR
author_rank: Frequent Contributor
timestamp: November 26, 2013, 07:23:42 pm
content: Quote from: Asim on November 26, 2013, 06:23:26 pmThat 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.

author: Asim
author_rank: Regular Contributor
timestamp: November 26, 2013, 07:29:54 pm
content: Quote from: PA0PBZ on November 26, 2013, 07:04:47 pmDon't worry i am not that stupid :pI always check the datasheets for pin configuration and yea the schematic is wrong on that part

author: Asim
author_rank: Regular Contributor
timestamp: November 26, 2013, 07:35:23 pm
content: Quote from: Mr Smiley on November 26, 2013, 06:56:07 pmAHA, that's good newsQuote from: AG6QR on November 26, 2013, 07:23:42 pmyea, i took care of that and as you said if i connected it wrong i wouldn't have an outputi will do what you mentioned about the pulling resistor tomorrow, hopefully it will work . i will even program a different microcontroller just in case

author: PA0PBZ
author_rank: Super Contributor
timestamp: November 26, 2013, 07:36:40 pm
content: Quote from: Asim on November 26, 2013, 07:29:54 pmToo bad, it was an easy solutionThe next thing to try (as already suggested) is to pull the pin up and down with a 10K resistor and measure the pin voltage.

author: Asim
author_rank: Regular Contributor
timestamp: November 26, 2013, 07:47:19 pm
content: Quote from: PA0PBZ on November 26, 2013, 07:36:40 pmHAHAHAHAAHA, now i wish that was the problem xD

author: Asim
author_rank: Regular Contributor
timestamp: November 27, 2013, 10:03:45 am
content: 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

author: macboy
author_rank: Super Contributor
timestamp: November 27, 2013, 01:20:29 pm
content: Quote from: Asim on November 27, 2013, 10:03:45 amMake 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.

author: Asim
author_rank: Regular Contributor
timestamp: November 27, 2013, 05:32:05 pm
content: 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 ?

author: wraper
author_rank: Unknown
timestamp: November 27, 2013, 05:56:41 pm
content: Quote from: Asim on November 27, 2013, 05:32:05 pmI 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.