How to drive Infrared LED off PIC

Thread Starter

JDR04

Joined May 5, 2011
367
Thanks for that. So what you are saying is that I can reduce the duty cycle to say about 10 or 20% and increase the current through the IR LED in order to achieve distance, am i understanding this correctly? Could somebody explain to me the relationship between duty cycle and mA through the IR LED please. I do understand the shorter "on period" of the LED enables a higher current to pass through it without causing damage,however, is there a formula for this, or, how is it worked out?

Can I still use the TIP31C as suggested by Markd77? I like your idea of testing bit by bit. In this way I hope to understand the concept fully.

Your suggestion of using more than 1 IR LED emitter is interesting and I'll note it down for "future adventures"

Thanks alot for your time and help-John
 
Last edited:

THE_RB

Joined Feb 11, 2008
5,438
Thanks for that. So what you are saying is that I can reduce the duty cycle to say about 10 or 20% and increase the current through the IR LED in order to achieve distance, am i understanding this correctly? Could somebody explain to me the relationship between duty cycle and mA through the IR LED please. I do understand the shorter "on period" of the LED enables a higher current to pass through it without causing damage,however, is there a formula for this, or, how is it worked out?
...
Do you have a datasheet for the IR LED you are using?

Generally they give a lot of information regarding maximum allowable pulsed current. There are normally specs for DC current, and pulsed current per duty cycle and often is a chart showing how much you are allowed to increase current for different duty cycles.

High current low-duty pulsing is the most common way to use IR LEDs so manufacturers document the safe limits very well in the LED datasheets. :)
 

Markd77

Joined Sep 7, 2009
2,806
Have a look at the Permissible Pulse Handling Capability graph. For example at 20% duty cycle, which I believe will work fine with the receiver, the tP (pulse duration) will be less than 10^-5 seconds so you can use the very left edge of the graph and the pulse current can be up to 700mA.
 

Thread Starter

JDR04

Joined May 5, 2011
367
Thanks for that Markd77. Appreciate your time. I'll check it out and come back to the forum.

Thanks again - John
 

Thread Starter

JDR04

Joined May 5, 2011
367
Hello everyone. Could somebody please tell me if my method and calculations are correct , or, where I have gone wrong. I have attached a schematic of my intended circuit.
PIC is a 12F683
Voltage out of pin 5 is 4.6V with a duty cycle of 20%
D1 is a Infrared LED requiring +-650Ma at 20% duty cycle.
D1 has a forward voltage drop of 1.4V
Q1 is a BC337.
D2 is a 1N4001 (To protect PIC.) (Is this really needed?)
Power supply to IR LED is 5Vdc by battery pack.
My calculations are;
For R1
R1 = 5v-1.4V=3.6V/0.650=5.53ohms or 5.6 (preferred value)
For R2
R2=4.6V-0.7V(D2)-0.7V(BC337)=3.1V
Use factor of 10 to drive Q1 into saturation.
650/10 = 65mA
Therefore R2=3.1V/0.065 mA =47oms.
Any help or comments will be appreciated.
Thanks again-John
 

Attachments

THE_RB

Joined Feb 11, 2008
5,438
Nice going on the schematic, but there are a few issues.

I would lose the diode, it is not needed and stops the PIC being able to turn OFF the BC337 properly.

Your base resistor is too low in ohms. A BC337 at 650 mA Ic will still have a good gain, close to 100. Even a bad brand will have a gain >50. (It is a high gain, low saturation transistor).

So choose a base resistor that;
1. Won't drive the PIC output pin into overcurrent (25mA limit).
2. Will give enough base current.

Let's say you just go for the PIC output pin max current of 25mA;
pin voltage = 4.4v
Vbe = 0.65v
so the base resistor must drop 4.4-0.65 = 3.75v at 0.025A
which is 150 ohms.

Now to calculate the LED series resistor R1, you need to know the LED Vf at 650 mA. Hopefully the datasheet shows this?

Then it helps to know the BC337 Vce saturation voltage. I prefer to test, so I would inject 25mA into the base, connect some dummy load resistors and an ammeter to the collector and make it pass 650mA Ic. Then you can read Vce sat with a voltmeter across C and E.

I expect that Vce sat voltage to be about 0.2 to 0.3v depending on brand and type (I prefer high gain brands BC337-400 etc, but most of them still have good gain and good Vce sat).

Once you have measured Vce sat you can calc the value of R1 from; R1 volts / 650mA.
 

Thread Starter

JDR04

Joined May 5, 2011
367
I've tried to figure out the voltage drop of the IR LED using the graphs on the datasheet. I figure the IR LED voltage drop at 650mA to be 2.25V.

I've atatched the graph and marked in RED how I read off the 2.25V. If somebody could tell me if I was correct or not it would be appreciated.

Many Thanks - John
 

Attachments

THE_RB

Joined Feb 11, 2008
5,438
I would use the "typical" value for your calcs, as it gives a better safety margin.

So I'd say about 1.8v at 650mA for 20uS pulses.

Your 38kHz carrier is 20% duty right?
1 / 38kHz = 26.3uS total period
*20% duty = 5.3uS ON period

I'm not sure if the Vf would increase or decrease at 5.3uS compared to their 20uS example. Possibly less, as the LED capacitance would cause it to take a bit of time to turn on?

Maybe someone else can chime in here, but from my opinion you should be fine choosing a resistor to work with the LED at 650mA and 1.8v Vf. :)
 

Thread Starter

JDR04

Joined May 5, 2011
367
OK, apologies to all who tried to help me with the measurements I gave them.......they were all wrong!! I was looking at peak to peak instead of RMS values.

So, I've got a PIC 12F683 with PWM output on pin 5. The voltage is 2.23V RMS. All voltages from now on RMS folks.

I want to drive a BC337 Transistor off the pin 5 of the PIC. So, if I run the PIC at say 20mA to be safe I calculate I need 76.5 ohms between the PIC pin 5 and the BASE of the tranny. So I made up a combination of resistors and got 76 ohms.

However, when I measure the amperage through to the tranny I only get 4.95mA. I'm thinking it's got something to do with the duty cycle of 20%.

Could somebody explain to me what is happening here please.:confused:

Thanks a Lot -JDR04
 

ErnieM

Joined Apr 24, 2011
8,377
JDR: Don't use RMS voltages. First, they need to be translated BACK into peak voltages, without knowing the duty cycle and the supply voltage that is impossible, and your meter probably gives an incorrect reading anyway.

Make the PIC give an on and off output and use any DC voltmeter. Those measurements will be accurate.

Use the value RB gave you, make the PIC output high and read the DC voltages. If anything gets hot be quick to turn it off.
 

THE_RB

Joined Feb 11, 2008
5,438
I covered it in post #28, the PIC output pin driving 20mA will source about 4.4v. Worst case maybe 4.2v.

The tranny base will be about 0.7v, so that leaves;
4.4 - 0.7 = 3.7v across the base resistor.
R = E/I = 3.7/0.020 = 185 ohms.
:)
 

Thread Starter

JDR04

Joined May 5, 2011
367
Hi ErnieM, thanks for the reply.

I'm sorry but I am awfully confused about the type of voltage measurements. If I use a DC voltmeter does that not give me a RMS voltage reading? I'm just checking the top of my Fluke 179 and it says "True RMS Multimeter" So I assumed if I used that then my reading would automatically be a RMS reading which you said I should stay away from?

I set up my scope to give me a peak to peak reading and got 5.4V pk-pk. Can I apply
what The RB wrote in calculating the resistor value. I would like to work at 20mA for safety sake, so...

5.4V-0.7V=4.7V pk-pk.
therefor 4.7V/0.020 =235ohms.
Where did I go wrong???? I just want to be sure about the RMS and pk-pk voltages.

Thanks -JDR
 
Last edited:

Markd77

Joined Sep 7, 2009
2,806
If you connect the scope across the resistor you can calculate the current through it with ohms law, you can also do the same thing if you are still using a 5.6 ohm resistor with the LED to get the LED current.
It's only the peak current that you are interested in, the specification for the PIC pin is a maximum current, not an average one, same for the LED (for any given duty cycle).
 

Thread Starter

JDR04

Joined May 5, 2011
367
Thanks Markd77.Get it now.

So, for the IR LED I need 650mA at peak voltage. The supply is 5V.

Therefore 5V/0.650 gives 7.7 ohms or closest. Please tell me I'm on the right track here??

Thanks again, JDR
 

ErnieM

Joined Apr 24, 2011
8,377
"RMS" or "True RMS" is a means of calculating or measuring an AC voltage in such a way as to give the equivalent DC voltage that would produce the same power.

While it is true from that definition that a DC voltage is also it's RMS voltage it causes confusion to state it as such.

When you report a voltage level as 4.7V peak-to-peak you raise questions such as "where is the zero reference?" where all you have is 4.7 volts above ground. Stating the voltage AS 4.7V implies "measured relative (or referenced) to ground."

Now "True RMS" may be a real claim or pure marketing fantasy, though I would believe it on a Fluke. Cheaper meters "assume" a sine wave, measure the peak voltage and apply a simple ratio to calculate RMS; this is only true for a sine wave, not other waves. A "True RMS" meter actually does something like use the input wave to heat some component then measure the temperature change. That change is dependent on the true power in the wave and hence is very accurate representation of the RMS value.
 

Thread Starter

JDR04

Joined May 5, 2011
367
I was wondering if somebody could suggest what logic level mosfet I should use for this project. Markd77 mentioned such a device in an earlier posting and I would like to give it a bash.

Thanks folks - JDR04
 

Thread Starter

JDR04

Joined May 5, 2011
367
OK, had a look around at MOSFETS and seem to think the ZVN4310A will do the job.

The only thing I could not establish for sure was the Gate voltage required to switch on! I have attached the datasheet .

I need to flash the IR LED at 38Khz with a peak current of 0.650mA.
I'm using a PIC, 12F683
Will connect the MOSFET GATE to pin 5 of the PIC which gives a voltage of 4.5V.

Any thoughts on this will be appreciated, thanks JDR04
 

Attachments

Top