Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Problem in IR LED circuit.......

Status
Not open for further replies.

sanddune008

New Member
Hi All,

I am facing problem in interfacing IR LED to PIC(developing an IR transmitter to an already working speaker IR receiver)......Speakers IR receiver is not able to receive the command.

1. I am transmitting the Pronto command at 38 Khz frequency

I have connect as per the link:
Infra/radio remote control encoder/decoder with PIC

similar to this in the link
4/8-channel V4.2 IR transmitter.

Schematic explanation:
I have connected the CCP1 pin to the the gate(BS170) and drain is connected to the cathode of the IRLED, anode of IRLED is connected through 10K resistor to Vcc.
Source of BS170 is connected to GND.

1. How to determine whether my IR LED is oscillating at 38Khz.
2. Will BS170 be able to switch on and off at that speed.
3. able to verify that the command at the CCP1 and gate of the BS170 in oscilloscope.


What may the reason for the receiver not detect the command?

Thanks in advance
 
Last edited:
Hi All,

I am facing problem in interfacing IR LED to PIC(developing an IR transmitter to an already working speaker IR receiver)......Speakers IR receiver is not able to receive the command.

1. I am transmitting the Pronto command at 38 Khz frequency

I have connect as per the link:
Infra/radio remote control encoder/decoder with PIC

similar to this in the link
4/8-channel V4.2 IR transmitter.

Schematic explanation:
I have connected the CCP1 pin to the the gate(BS170) and drain is connected to the cathode of the IRLED, anode of IRLED is connected through 10K resistor to Vcc.
Source of BS170 is connected to GND.

1. How to determine whether my IR LED is oscillating at 38Khz.
2. Will BS170 be able to switch on and off at that speed.
3. able to verify that the command at the CCP1 and gate of the BS170 in oscilloscope.


What may the reason for the receiver not detect the command?

Thanks in advance
 
IR LEDs do not oscillate. The BS170 will do 38KHz in it's sleep.

4/8 channel? that design is shoddy. you can make a full duplex 2400BPS data link with those IR receivers and only a single extra counter. of course your crystals end up at slightly different values...
 
If you have a digital camera, you can see the infrared LED lit, but doesn't measure frequency (need an oscilloscope or counter for that). Most of the IR receiver modules I've played with aren't too particular about the center frequency.

If you are transmitting through the IR LED, you should be able to see it flash and flicker in a camera's view screen.

The 10k resistor in series with the IR LED seems kind of high. What's your supply voltage?
 
well I had answered this bu tit seems you have edited it and my answer did not make it ...

IR LEDs do not oscillate. 38KHZ is childs play for the FET. If you do not see the 38KHz bursts uP pin AND on the gate, the it is not getting to the LED.

You do realize that the circuit is kind of crappy and with those IR receivers, external counters, and different crystal frequencies you can have a 2400BPS full duplex data link, don't you?
 
Thanks all for your time....


Power supply is : 5V.......

Is it my 10 K resistor causing the problem.........can u suggest me a proper resistor value.....

I tried holding a camera beside the IR LED.....didn't see any red light(could this be that it is too fast to be viewed)....as oscilloscope shows me that the IR led is being switched on and off at 38Khz......
 
I tried increasing the switching period of the IR Led by making him to toggle for 1000ms still the not able to view IR LED blinking with the camera....

is the series resistor the culprit.
 
I tried increasing the switching period of the IR Led by making him to toggle for 1000ms still the not able to view IR LED blinking with the camera....

is the series resistor the culprit.

Try something like 220Ω. I usually run LEDs straight off the microcontroller pin, no resistor, but thats for visible colors. IR is around 1.7 volts, might be a little much. I/O pins are limited to 20 mA, which is the same as most LEDs...

Anyway, the IR LED will show up white in the viewfinder on your camera. Works better in a dimly lit room, not real bright when lit directly, and less bright if pulsed. Some cameras filter IR more strongly than others, but you should still notice some difference.
 
The current-limiting resistor for the IR LED is only 10 ohms. That is why they use a Mosfet to deliver the very high current.
The IR LED is pulsed so that the pulse current can be much higher than its rated continuous current.
 
Try something like 220Ω. I usually run LEDs straight off the microcontroller pin, no resistor, but thats for visible colors. IR is around 1.7 volts, might be a little much. I/O pins are limited to 20 mA, which is the same as most LEDs...

Anyway, the IR LED will show up white in the viewfinder on your camera. Works better in a dimly lit room, not real bright when lit directly, and less bright if pulsed. Some cameras filter IR more strongly than others, but you should still notice some difference.

I tried my camera on DVD remote, was able to see the IR Led glow very bright.

Is there a simple logic to get the thing show up my camera.

Little frustrated with this damn thing though :mad:

Here is my code
Code:
#include <16F628A.h>
#fuses XT,NOWDT,NOPROTECT,NOLVP,NOCPD
         
#use delay(clock=4000000)
#use fast_io(B)

void main(void)               //Program stepping point
{
   //printf("\r\nInitialized\n\r");   
   while(1)
   {
	Send_MuteCmd();
    }
}	

void Send_MuteCmd(void)
{
   /
   int8 i =100;
 
    do
    {
    /* SendBit0();*/ SendBit1();
     /* SendBit0();*/ SendBit1();
     /* SendBit1();*/ SendBit0(); 
     /* SendBit0();*/ SendBit1(); 
     /* SendBit0();*/ SendBit1();
     /* SendBit0();*/ SendBit1();
     /* SendBit1();*/ SendBit0();
     /* SendBit1();*/ SendBit0();
     /* SendBit1();*/ SendBit0();
     /* SendBit0();*/ SendBit1(); 
     /* SendBit1();*/ SendBit0();
      
      SendSqncEnd();
      
     /* SendBit0();*/ SendBit1();
     /* SendBit0();*/ SendBit1();
     /* SendBit1();*/ SendBit0(); 
     /* SendBit0();*/ SendBit1(); 
     /* SendBit0();*/ SendBit1();
     /* SendBit0();*/ SendBit1();
     /* SendBit1();*/ SendBit0();
     /* SendBit1();*/ SendBit0();
     /* SendBit1();*/ SendBit0();
     /* SendBit0();*/ SendBit1(); 
     /* SendBit1();*/ SendBit0();
      
      SendSqncEnd();
      
     /* SendBit0();*/ SendBit1();
     /* SendBit0();*/ SendBit1();
     /* SendBit1();*/ SendBit0(); 
     /* SendBit0();*/ SendBit1(); 
     /* SendBit0();*/ SendBit1();
     /* SendBit0();*/ SendBit1();
     /* SendBit1();*/ SendBit0();
     /* SendBit1();*/ SendBit0();
     /* SendBit1();*/ SendBit0();
     /* SendBit0();*/ SendBit1(); 
     /* SendBit1();*/ SendBit0();
   
    }while(i--);
      
}


void SendBit0(void)
{
   //printf("\r\nInsSndBit0\n\r");
   //38khz Pulses
   SetPWM();
   //delay_us(342);
   //modification after MPLAB simulation
   delay_us(322);
   //No pulses for 82
   //output_high(PIN_B3);
   set_pwm1_duty(0);// testing by setting the duty cycle to 0
   //delay_us(3157);//No pulses are sent
   //modification after MPLAB simulation
   //delay_us(3135);//No pulses are sent
   delay_us(3100);//No pulses are sent     
}

void SetPWM(void)
{
   set_tris_B(0x01); 
   //App_init();
   setup_ccp1(CCP_PWM);   // Configure CCP1 as a PWM
   setup_timer_2(T2_DIV_BY_1,25,1);
   //Generating 38khz PWM with 50% duty cycle
   set_pwm1_duty(13);
}

Thanks all for your time
 
Now i am able to see a faint glow on the IR LED.....still its not doing the job it is intended.....Is my above code fine?.....

What may be the reason for the faint glow?.....Is it because BS170 is not driving enough current to the IR LED?.......

Please help me with an alternative circuit?.....

Thanks to all
 
Sorry, but that's about all I have. I don't know 'C', and use AVR microcontrollers. Only used FETs a few times, and mostly guess using transistors, or ask for help. My school days were more than 20 years ago, and took a long break before getting back into electronics as a hobby...

My experience with FETs, is most need 10 volts to fully turn on. There are a few logic-level FETs, but haven't tried them yet. Might try a simple transistor driver for your LED, most can handle 100 mA with ease and no heatsink.
 
I can see a faint glow on the IR LED.....Is it because of this my receiver is not able to receive the command.....

I have introduced an 220 ohm resistor to the IR LED......

Thanks
 
Use Ohm's Law to caculate the current in the LED:
1) Is the supply 5V?
2) The IR LED has a forward voltage drop of 1.2V.
3) Then the resistor has a voltage drop of 5V - 1.2V= 3.8V.
4) then the current is only 3.8V/220 ohms= 17.3mA.

The original circuit used a 10 ohms current-limiting resistor so the current is 3.8V/10 ohms= 380mA. Some IR LEDs are rated for a peak momentary current of 1A.

When you used 10k then the current was only 3.8V/10k ohms= 0.38mA.
 
Thanks audioguru for your time.....

I was able to increase the intensity of the IR LED ....... had to introduce an 80 ohm resistor.

Pulses that are being applied is inverted ,ie, intially the potential drop across the IR LED is high and goes low on an button event,LED switches on and off based on the pulses.For a high pulse generated at the PWM pin
a low pulse is applied at the cathode of the LED(I am using an FET as a current driver)? (Please correct me if asking a dumb question). As, what i observed was an opposite pulse being sent by the actual DVD remote.

Maybe this is the reason my dvd player was not able to detect the command.

Is that normal?......... Is there a way to invert the Pulses being applied to the IR LED?

Thanks
 
The drain of a P-channel Mosfet will pull the anode of the IR LED high when the gate of the Mosfet goes low. Then your signal is inverted from what you have now.
I have never seen a "logic-level" P-channel Mosfet. Use a PNP transistor with a series base resistor instead.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top