LED driver/square wave generator

Thread Starter

sdh314

Joined Jun 2, 2011
18
Hi all,

I need to drive a LED at 1kHz with a square wave signal and feed that signal as a reference into another circuit. At present I've been using a microcontroller (Arduino) to switch a digital pin on and off, but I've noticed significant gitter in the square wave pulse, and I want a more accurate and precise solution. The LED was switched on and off via a simple transistor switch using this signal, and it was designed for a LED current of 75mA.

A 555 timer comes to mind to provide the square wave pulse, and I've read that this can also sink or source up to 200mA. Has anyone had experience with this circuit, and can tell me another about how constant a current it can provide? Would it instead be better to drive the transistor switch circuit to drive my LED with the output instead? (as is shown in the attached circuit schematic).

Does anyone know if there are dedicated high precision chips that can encompass both square wave generation (at an arbitrary frequency), a LED driver capable of driving 75mA of _constant_ current, and an enable pin to turn it all on or off. Or am I asking too much?

I've attached the most obvious solution (at least to me). Can I still run the reference signal into the other circuit as pictured? (which will go into the input of an op-amp).

Any suggestions much appreciated! Thanks in advance!
 

Attachments

Audioguru

Joined Dec 20, 2007
11,248
The output of your 555 is not a square-wave, it is a rectangular wave because the timing capacitor charges by two resistors in series but is discharged by only one resistor. A diode can be added in series with a resistor to maker the output square.

The 555 can power the LED with its current-limiting resistor (without the transistor) plus make an output.
 

Wendy

Joined Mar 24, 2008
23,415
Say what? You want to have an OP brand new to the hobby learn to program a device when a 555 and a hand full of part will do the exact same thing without a programming device for a PIC? It is not as if there is a difference in cost either way.

The only reason I have not answered this is I have no clue what the OPs requirements are. You can achieve around 53% duty cycle with that design, maybe a little better.

So lets go through the exercise, what is the power supply voltage? That is a bare starting point.

Use 1KΩ for R1, and 0.1µF for C1, then calculate what R2 needs to be. I have several references for the 555 available to help you calculate the values.

Bill's Index

http://forum.allaboutcircuits.com/picture.php?albumid=41&pictureid=308

http://forum.allaboutcircuits.com/picture.php?albumid=41&pictureid=1233

My Cookbook



So, let me know the power supply voltage, and I'll give you something I thing you are after. It may take a little while, words do not communicate electronics well.

Oh, and another reference...

LEDs, 555s, Flashers, and Light Chasers
 

ErnieM

Joined Apr 24, 2011
8,377
Say what? You want to have an OP brand new to the hobby switching to a 555 plus a hand full of parts to do the exact same thing his existing circuit should do when properly programmed. I would expect the final design to have a small but significant difference in cost biased to the micro side.

I would suggest the OP move his post over to the "Embedded Systems and Microcontrollers" sub forum here and ask about improving his code. (I would help but I never used the Arduino platform.)
 

tracecom

Joined Apr 16, 2010
3,944
At present I've been using a microcontroller (Arduino) to switch a digital pin on and off, but I've noticed significant gitter in the square wave pulse, and I want a more accurate and precise solution. The LED was switched on and off via a simple transistor switch using this signal, and it was designed for a LED current of 75mA.
I have no experience with Arduino, but if it's jittering, I would look at the power supply filtering and decoupling.
 

thatoneguy

Joined Feb 19, 2009
6,359
If it is on an Arduino board, the supply is pretty solid.

I suspect it is the way the code is written, so if that could be posted, something may jump out, even though we aren't Arduino experts, uCs are all similar, and code is nearly universal if it is in C.
 

Thread Starter

sdh314

Joined Jun 2, 2011
18
Thanks for the feedback guys.

I was originally using a bit-banging technique with a digital output pin, which may explain the jitter, I'm having a look at doing it via PWM but it sounds as though changing the timer frequencies may bugger up some aspects of my code.

Nonetheless, back to the analog solution. I added a diode as suggested and have used R1, R2 = 45.62kHz and C = 15 nF. This gives a (measured) frequency of 1.02 kHz.

I noticed I don't quite get a 50% duty cycle, closer to 57%. More confusing is the fact that when I connect the output pin to my simple transistor circuit which drives the LED (as per schematic in first post), the frequency increases to 1.09kHz and the duty cycle changes to 59%. Perhaps this has to do with the switching circuit pulling a relative large current through the supply (and thereby perhaps affecting it's stability?)

What would be the (dis)advantages of driving the LED directly from the output pin (with a series resistor). Would it expect to get as constant current through the LED during the on time as I would for the simple transistor circuit I'm using?

Thanks!
 
Top