On 11/12/05, Dmitriy Kiryashov <vze27bym@verizon.net> wrote: > Hi Olin. > > CCP pin to base of NPN ( 2N4401 or 2N2222 , Vcbo about 50v ) > collector to +5v, emitter to current limiting resistor > 2nd pin of current limiting resistor to anode of LED > cathode of LED to ground > > One resistor less and smaller pcb estate. > Any objections ? Many. Switching the LED will be like vodka with water... :) If you was thinking to a constant current switcher, than keep the sensing resistor in the transistor's emitter and the IR led in the transistor's collector. Else will be a mixed analogic/switching design. cheers, vasile > > > WBR Dmitry. > > PS. 2N4401 with hFE = 50 on 100 mA sounds scary :) > > > > Olin Lathrop wrote: > > Not a good idea. First, there is no need for a separate pin to > > enable/disable the 40KHz pulse output. You can do that just as easily in > > software by enabling/disabling the CCP module. Second, you need a resistor > > in series with the LED if running it from 5V. The forward voltage of an IR > > LED is nowhere near 5V, so without a resistor something will have to give. > > That will probably be one or both of the PIC pins. Third, IR LEDs can take > > a lot more current than most visible LEDs of the same size. Check the data > > sheet. Most likely you can put at least 100mA thru it when it's on, for an > > average current of 50mA. Fourth, you can't drive that much current with a > > PIC pin. Connect the CCP output pin to a resistor, other end of resistor to > > base of NPN transistor, emitter to ground, collector to LED cathode, LED > > anode to another resistor, and the other end of that resistor to 5V. Size > > the LED resistor to get 100mA (depending on your LED) thru the LED when the > > transistor is on. Size the base resistor to make sure the transistor is > > saturated when sinking the LED current. With a jellybean transistor like > > 2N4401 you can count on a gain of at least 50. That means you need at least > > 2mA base drive to support 100mA LED current. A 2Kohm base resistor will get > > you a little more than that, which is probably a good answer. > > > > > a 40khz pulse should be output on the IR LED for a short period of time > > > (about a second). > > > > That's not a short period of time. The IR detector will probably want to > > see pulses from 10 to 50 cycles. Much beyond that and it's automatic gain > > circuitry will decide the pulse is ambient and set its threshold to filter > > it out. > > > > > I have included a simple Excel spreadsheet I made to help calculate > > > the settings for the CCP Module for the PIC 16F628, which I used to > > > come up with my values for the program. > > > > That's silly. What happens when you change the PIC oscillator frequency or > > want to use a different IR modulation frequency? These should be parameters > > directly in your code, probably a top level include file, and everything > > else should be computed from that at assembly time. > > > > ****************************************************************** > > Embed Inc, Littleton Massachusetts, (978) 742-9014. #1 PIC > > consultant in 2004 program year. http://www.embedinc.com/products > > -- > > http://www.piclist.com PIC/SX FAQ & list archive > > View/change your membership options at > > http://mailman.mit.edu/mailman/listinfo/piclist > -- > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist > -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist