CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Op amp infrared LED Driver

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
joshkeys



Joined: 16 Aug 2005
Posts: 37
Location: Fredericton,NB

View user's profile Send private message Send e-mail MSN Messenger

Op amp infrared LED Driver
PostPosted: Tue Nov 28, 2006 10:10 pm     Reply with quote

I am attempting to drive an infrared LED at 38 KHz. I am using a pic12f678,and cannot get close enough to 38 kHz (38 kHz = a period of 26.315 us, which means an interrupt period to turn on and off of 13.158 us. Since the smallest resolution running at 40 Mhz is 1us, I can only get a 13 us interrupt period which equals roughly 38.5 Khz)

Anyways so the question I am asking is more of an analog design question and no longer PIC related. But hopefully someone will answer.

I am now using an op amp as a astable multivibrator set to 38kHz. The output oscillates at 38 kHz, but as with any op amp, the output is not exatctly equal to the rail voltage due to the drop across the transistors on the output side. Therfore it oscillates from roughly 4V to 1V.

Now here comes the problem, I cannot directly drive the LED from the opamp output due to current constraints, so i would like to use the output to bias a transistor with the LED on the collector, but the output of the op amp will always bias the transistor. So is there a way to turn the 4V to 1V oscillations to a 5V to 0V oscillation, in which case I could use that to drive the transistor, otherwise is there a way to drive the transistor such that 1V it will not bias the transistor, and 4V will bias it?

Hopefully someone can answer this even though it is no longer directly PIC related.

Thanks
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Nov 28, 2006 11:00 pm     Reply with quote

Quote:
I am using a pic12f678

I can't find a link to this PIC. Can you confirm what PIC you're using.
joshkeys



Joined: 16 Aug 2005
Posts: 37
Location: Fredericton,NB

View user's profile Send private message Send e-mail MSN Messenger

PostPosted: Tue Nov 28, 2006 11:21 pm     Reply with quote

I meant to say PIC 12F675.
newguy



Joined: 24 Jun 2004
Posts: 1907

View user's profile Send private message

PostPosted: Tue Nov 28, 2006 11:24 pm     Reply with quote

Whoa. Rethink what you're doing.

I run an IR LED application (consumer electronics remote control emulator) on a PIC running at 4 MHz and it works 100% of the time. The key is to set up the PWM to run at 38 kHz (or something close to that frequency as it's not critical), then use a timer to turn the PWM on/off. Because the fastest IR "burst" is around 600 us, that means the PIC has plenty of time to attend to this task, as well as many others.

All you have to do is toggle the PWM drive pin's TRIS bit when you want to turn the IR burst on/off.

The PIC's PWM pin is connected to the gate of a 2N7000 or equivalent n-channel enhancement MOSFET. A BJT would also suffice. The IR LED's anode is connected to Vcc (or a higher voltage if available). The cathode is connected to a resistor, and the other end of the resistor is connected to the drain of the FET. You also need a pulldown on the gate, and that's it.
joshkeys



Joined: 16 Aug 2005
Posts: 37
Location: Fredericton,NB

View user's profile Send private message Send e-mail MSN Messenger

PostPosted: Tue Nov 28, 2006 11:38 pm     Reply with quote

I realize I could use PWM, but the PIC 12f675 does not have PWM built in. The reason for the op amp configuration is to keep the oscillator as a stand alone device without the need for a microprocessor.. all i need is a stand alone 38kHz infrared LED. The application is a infrared beam sensor. So if i can keep the transmitter standalone, then on the other end i have my 38khz receiver connected to the pic microprocessor so i can do everything i need done whenever the beam is broken, but be able to place the transmitter elsewhere, and without a microprocessor to run it.

Thanks
Ttelmah
Guest







PostPosted: Wed Nov 29, 2006 3:17 am     Reply with quote

I'd suggest using a simple 555, rather than an op-amp. The output of this has plenty of drive to directly feed the LED (with a current limiting resistor obviously). You can use the reset pin on the 555, as a control to switch it on/off, allowing you to generate the required pulse train.
As an aside though, there is no problem at all developing a 38Khz tone with the 12F chips. Remember that the mark/space, does not have to be equal, and the chips don't have to run off 4MHz (not 40MHz...). Run off 3.8MHz, with twelve clocks 'on', and thirteen 'off', and it gives a very nice 38000Hz output.

Best Wishes
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group