LED Driving

From circuitbending to homebrew stompboxes & synths, keep the DIY spirit alive!

Moderators: Kent, Joe., luketeaford, lisa

User avatar
marcusriley
Learning to Wiggle
Posts: 24
Joined: Mon Oct 21, 2019 11:31 pm
Location: Seattle

LED Driving

Post by marcusriley » Mon Dec 02, 2019 5:40 pm

Hi everyone,
I know there is *a lot* of information on how to drive LEDs on this forum, so I'm sorry to post anew. I'm just hoping someone can talk me through building a slightly more sensitive design - sometimes I get lost in the more technical discussion.

I've been using the attached design. It works better on some LEDs than for others. I've been using it in correlation with an LDR controlling an oscillator, so I'm gauging my experience from frequency span. I understand this might skew my results further.

What I am noticing is that the amount of brightness between "Off" and "slightly On" is a HUGE jump in responsiveness. Then, I find a disappointing amount of resolution for most of the sensitive part of the spectrum, and a fair bit of the voltage controlling a very small range around the saturation point.

Are there designs with slightly better linearization? Are there modifications that I can make to this design to fine-tune it to the LEDs I have on hand? Does the hFE of the transistor matter?

User avatar
cackland
Super Deluxe Wiggler
Posts: 2232
Joined: Thu Dec 28, 2017 5:42 pm
Location: Los Angeles, California

Post by cackland » Mon Dec 02, 2019 6:20 pm

No attached design?

User avatar
marcusriley
Learning to Wiggle
Posts: 24
Joined: Mon Oct 21, 2019 11:31 pm
Location: Seattle

Post by marcusriley » Mon Dec 02, 2019 6:29 pm

Oops, sorry about that.

Picture file

Orgia Mode
Common Wiggler
Posts: 105
Joined: Mon Nov 04, 2019 5:24 pm

Post by Orgia Mode » Mon Dec 02, 2019 6:43 pm

So are you using the LED and LDR in a vactrol configuration?
Iv'e been playing with optocouplers and their inherent resistance across the outputs and just like an LDR, the resistance range is not linear. Theres a lot of other problems with this schematic, but it maybe can give someone an idea on how to further help you...

It seems that if you use a similar LED/LDR in the feedback path of an op amp, you can make the output more linear.

***

EDIT: I haven't seen your upload yet....
EDIT2: the optocouplers in my pic are H11F1M
You do not have the required permissions to view the files attached to this post.

User avatar
marcusriley
Learning to Wiggle
Posts: 24
Joined: Mon Oct 21, 2019 11:31 pm
Location: Seattle

Post by marcusriley » Mon Dec 02, 2019 7:04 pm

Orgia Mode wrote:So are you using the LED and LDR in a vactrol configuration?
Yes.

Are you saying there are a lot of other problems with the schematic you attached or the one that I attached?

Orgia Mode
Common Wiggler
Posts: 105
Joined: Mon Nov 04, 2019 5:24 pm

Post by Orgia Mode » Mon Dec 02, 2019 7:16 pm

marcusriley wrote:
Orgia Mode wrote:So are you using the LED and LDR in a vactrol configuration?
Yes.

Are you saying there are a lot of other problems with the schematic you attached or the one that I attached?
Problems with mine, I Just copied and pasted a simulation I was working on for something else.
If you look at my picture though, you can see that the trace "log_out" will very closely relate to the resistance range you are experiencing in your own case. So using a second LED/LDR of the same type as feedback can counteract the Logarithmic response.

User avatar
marcusriley
Learning to Wiggle
Posts: 24
Joined: Mon Oct 21, 2019 11:31 pm
Location: Seattle

Post by marcusriley » Mon Dec 02, 2019 7:30 pm

That looks like a fantastic solution - I will definitely try it out for a future project. For my current issue, though, it would be helpful to look at some possibilities that use a single pairing, if there are other ideas.

whalemoth
Learning to Wiggle
Posts: 6
Joined: Thu Apr 04, 2019 3:09 am

Post by whalemoth » Mon Dec 02, 2019 8:23 pm

Here's a great page with some LED driver ideas on it -- I usually pick the model that's most suitable. I try and avoid adding op-amps unless necessary, sometimes I'll drive an LED that way to use up a spare.

http://musicfromouterspace.com/analogsy ... ivers.html

Orgia Mode
Common Wiggler
Posts: 105
Joined: Mon Nov 04, 2019 5:24 pm

Post by Orgia Mode » Mon Dec 02, 2019 8:37 pm

whalemoth wrote:Here's a great page with some LED driver ideas on it -- I usually pick the model that's most suitable. I try and avoid adding op-amps unless necessary, sometimes I'll drive an LED that way to use up a spare.

http://musicfromouterspace.com/analogsy ... ivers.html
Those are all on/off drivers.

In all honesty, we need an exponential converter to counteract the log response, such as this one: (just grabbed off of google)
https://i.stack.imgur.com/WFN6R.png

The problem is that this type of conversion requires thermal compensation to maintain that linearity across different ambient temperatures as well as across the full range of inputs. Then you have the issue of dialing in the trimmers to make it work with your LDR which is probably has 10-20% error.
Last edited by Orgia Mode on Mon Dec 02, 2019 8:58 pm, edited 1 time in total.

User avatar
Mungo
Super Deluxe Wiggler
Posts: 1186
Joined: Fri Jan 04, 2013 8:12 pm

Post by Mungo » Mon Dec 02, 2019 8:47 pm

Linearising an optoisolator by using a pair with one as feedback is better. But there are a range of voltage to current designs that will control the current in the LED. Ti have a document called SNLA140C "AN-31 Amplifier Circuit Collection" (http://www.ti.com/lit/an/snla140c/snla140c.pdf) which has several examples of voltage to current designs, some can be simplified without the darlington/mostfet if you are only driving small currents through a single LED, the Howland Current Pump configuration is widely used for its simplicity and keeping the reference to ground.

User avatar
marcusriley
Learning to Wiggle
Posts: 24
Joined: Mon Oct 21, 2019 11:31 pm
Location: Seattle

Post by marcusriley » Mon Dec 02, 2019 10:54 pm

Orgia Mode wrote: The problem is that this type of conversion requires thermal compensation to maintain that linearity across different ambient temperatures as well as across the full range of inputs. Then you have the issue of dialing in the trimmers to make it work with your LDR which is probably has 10-20% error.
Honestly, "improved response" is totally sufficient for me - if an exponential converter improves things even by 50%, I'd be satisfied. Any idea what the value of those unmarked resistors in Rene Schmitz's circuit might be? Strangely, I'm having a hard time finding simple examples of this function.
Mungo wrote: the Howland Current Pump configuration is widely used for its simplicity and keeping the reference to ground.
Any idea why the Howland Current Pump is drawn with 3 voltage outs? When you say they can be simplified without the mosfet, would I just be placing voltage directly at R3 (4.7k)?
You do not have the required permissions to view the files attached to this post.

Orgia Mode
Common Wiggler
Posts: 105
Joined: Mon Nov 04, 2019 5:24 pm

Post by Orgia Mode » Mon Dec 02, 2019 11:59 pm

marcusriley wrote:
Orgia Mode wrote: The problem is that this type of conversion requires thermal compensation to maintain that linearity across different ambient temperatures as well as across the full range of inputs. Then you have the issue of dialing in the trimmers to make it work with your LDR which is probably has 10-20% error.
Honestly, "improved response" is totally sufficient for me - if an exponential converter improves things even by 50%, I'd be satisfied. Any idea what the value of those unmarked resistors in Rene Schmitz's circuit might be? Strangely, I'm having a hard time finding simple examples of this function.
"The unlabeled resistor at the bottom is a high value resistor of 1Meg or so"
Here's Rene's site explaining expo converters:
https://www.schmitzbits.de/expo_tutorial/index.html

"simple examples of this function" - probably because there is nothing simple about it. :razz:
Iv'e read this maybe a hundred times and it's still sinking in:
http://www.openmusiclabs.com/files/expotemp.pdf

EDIT: also, what is your input? e.g. 0-10v or something else?

User avatar
marcusriley
Learning to Wiggle
Posts: 24
Joined: Mon Oct 21, 2019 11:31 pm
Location: Seattle

Post by marcusriley » Tue Dec 03, 2019 12:42 am

Orgia Mode wrote: what is your input? e.g. 0-10v or something else?
Yes, that's right. Thanks for the links to the Open Music Labs article.. might as well start the 100 readings sooner rather than later!

User avatar
marcusriley
Learning to Wiggle
Posts: 24
Joined: Mon Oct 21, 2019 11:31 pm
Location: Seattle

Post by marcusriley » Tue Dec 03, 2019 12:57 pm

Just beginning to dig in, but reading through the Schmitz article, it seems that my driver is already exponential - it's just not compensated.

Is the variation in thermal drift really significant enough to merit all of the additional circuitry, when it comes to simply driving an LED?

I know that the general circuit we're looking at here is designed to approximate 1v/octave...but if I wanted to make the curve more drastic (maybe 2v/octave?) - would that be helpful? Is there a way to modify the design to produce that output?

User avatar
devinw1
Super Deluxe Wiggler
Posts: 1705
Joined: Tue Aug 07, 2018 11:20 am
Location: Portland, OR
Contact:

Post by devinw1 » Tue Dec 03, 2019 1:36 pm

The original schematic you posted is just an on off driver. It just buffers the signal with an op amp, clips off any negative voltage, and then uses an NPN transistor to drive/buffer the LED (with a max current of 12mA based on that 1k resistor).

If you want to control the brightness of your LED based on voltage, you need something like Mungo has mentioned.

User avatar
marcusriley
Learning to Wiggle
Posts: 24
Joined: Mon Oct 21, 2019 11:31 pm
Location: Seattle

Post by marcusriley » Tue Dec 03, 2019 3:49 pm

devinw1 wrote:The original schematic you posted is just an on off driver.
My understanding was that it was a buffer feeding a transistor amplifier - and that transistors naturally produce an exponential response. it definitely doesn't simply produce a hard "off"/"on" - there is some amount of expression throughout the whole voltage range. Am I mistaken?

I can definitely try the Howland Current Pump - but I am a bit confused about how it operates based on the Application Note schematic. Would you suggest sending the input through R3 and grabbing the output from that op amp?

User avatar
devinw1
Super Deluxe Wiggler
Posts: 1705
Joined: Tue Aug 07, 2018 11:20 am
Location: Portland, OR
Contact:

Post by devinw1 » Tue Dec 03, 2019 4:16 pm

marcusriley wrote:
devinw1 wrote:The original schematic you posted is just an on off driver.
My understanding was that it was a buffer feeding a transistor amplifier - and that transistors naturally produce an exponential response. it definitely doesn't simply produce a hard "off"/"on" - there is some amount of expression throughout the whole voltage range. Am I mistaken?
There is an exponential response to a transistor something like I=exp(aV+b). but that is not what your first circuit is trying to accomplish. It will have a exponential type response for a tiny bit for really low voltage, and then it will be saturated and will work like a switch. This circuit is intending to use the transistor like a switch (to pop on and off when you apply gate or LFO or something).

You need something totally different if you want to have the brightness vary perceivably and evenly in response to a voltage.

User avatar
J3RK
Super Deluxe Wiggler
Posts: 6677
Joined: Tue Dec 22, 2009 12:46 pm
Location: Seattle

Post by J3RK » Tue Dec 03, 2019 4:38 pm

This is what I use for nearly all of my LEDs. It's a bidirectional driver, so you can use a two-lead bicolor LED, or just simply use a single LED for unidirectional indication. This circuit was introduced to me by Dave Brown several years ago, and I haven't used anything else since. Tweaking the input resistor helps a bit under some circumstances (depending on what's driving this). I usually put this after an output buffer.

For more logic-oriented on-off applications, I use a CD4041 to drive blocks of four LEDs. The current has to be limited quite a bit using this IC though. Typically 3K+ series resistor per LED. The benefit though, is that you have two states for logic on and off, so can use biclor LEDs to represent each state without one state being off. (or you can do tri-state with color1, color2, and off) I can post what this one looks like later.

Anyway, here is the op amp driver:

Image
Are you lemon? Does your head come to a nub?

User avatar
J3RK
Super Deluxe Wiggler
Posts: 6677
Joined: Tue Dec 22, 2009 12:46 pm
Location: Seattle

Post by J3RK » Tue Dec 03, 2019 4:55 pm

Here's the "BiColor Logic" driver that I use. When logic level is 0/Low one color is displayed. When logic level is 1/High the other color is displayed. You can drive four LEDs per CD4041 IC.

Image

You can see it working here with the BitStation. Incidentally, you can see the driver I posted above working on the VCO's in this video.

[video][/video]
Are you lemon? Does your head come to a nub?

User avatar
executiveBlaster
Wiggling with Experience
Posts: 499
Joined: Wed Oct 12, 2011 12:59 pm

Post by executiveBlaster » Tue Dec 03, 2019 5:00 pm

+1 for the op-amp circuit J3RK posted, works very well. current through the led varies linearly with the input voltage.

caveat: if you're only using a single LED instead of a two-lead bi-color, a diode should be anti-parallel with the LED (parallel, facing the other way) If a positive voltage is applied to the input, it all works great. if the input goes negative, the op-amp output swings to its negative rail, leaving -11ish volts across it, which will damage most LEDs.

you can also buy two-lead red LEDs that are just two reds in anti-parallel. positive and negative voltages then just light up.

User avatar
marcusriley
Learning to Wiggle
Posts: 24
Joined: Mon Oct 21, 2019 11:31 pm
Location: Seattle

Post by marcusriley » Tue Dec 03, 2019 5:09 pm

Thanks for the suggestion, J3RK - it would be a relief to get this into a single op-amp. Putting in the feedback loop compensates for the bias, right?


Found this in the Muffwiggler archive, which uses a bias trimmer - is this a hard switch also?
Image

[/img]

User avatar
J3RK
Super Deluxe Wiggler
Posts: 6677
Joined: Tue Dec 22, 2009 12:46 pm
Location: Seattle

Post by J3RK » Tue Dec 03, 2019 5:23 pm

That one from Tim will fade, but I'm not sure how smoothly. I simulated it, and it works pretty much as expected, however, I couldn't get a perfect balance using the trimmer in the sim. I suspect that is easier with physical parts though. I've never tried to build it since the op amp circuit works so well.

You can also do a simple follower type for positive only, by ditching the D2/R4 portion, and the bias trim, then adding a reverse biased diode on the base of the transistor to ground/0v. Works ok. Once again though, I think the op amp one is a touch better.
Are you lemon? Does your head come to a nub?

User avatar
executiveBlaster
Wiggling with Experience
Posts: 499
Joined: Wed Oct 12, 2011 12:59 pm

Post by executiveBlaster » Tue Dec 03, 2019 5:31 pm

that driver from tim servo will also smoke Q1 (aka blow up) if you turn the trimmer all the way to V+ !!!

and yes, totes, the LED in the feedback loop of the op amp compensates for the led forward voltage.

edit: that driver from Tim was one of the first things I built into a module. it smoked hilariously and readily! then someone here set me straight

I also built that op amp led driver into a module I made hundreds of, only to find it was definitely smoking the LED as I had put a regular unipolar led in. had to solder tiny diodes to the back of every one :doh:
Last edited by executiveBlaster on Tue Dec 03, 2019 5:34 pm, edited 1 time in total.

User avatar
J3RK
Super Deluxe Wiggler
Posts: 6677
Joined: Tue Dec 22, 2009 12:46 pm
Location: Seattle

Post by J3RK » Tue Dec 03, 2019 5:34 pm

executiveBlaster wrote:that driver from tim servo will also smoke Q1 (aka blow up) if you turn the trimmer all the way to V+ !!!
Nice catch, I didn't really think about that. :nuke: He did run "Magic Smoke Electronics" for quite some time.
Are you lemon? Does your head come to a nub?

User avatar
marcusriley
Learning to Wiggle
Posts: 24
Joined: Mon Oct 21, 2019 11:31 pm
Location: Seattle

Post by marcusriley » Tue Dec 03, 2019 5:50 pm

Hey there-
Just tested the Op Amp "Bicolor LED" circuit - noticed a few things:

1. The LED never turns completely off. I can experiment a bit more with the input resistor and the LED used. In some ways, this doesn't matter.. except for:

2. There is still a major jump in the LDR response from darkness to light in the early part of the curve. I imagine this has to do more with the LDR than the LED, but I am still trying to compensate for it.

3. Just to clarify, if I use a unipolor LED in the Op Amp circuit, I need to have a diode facing the other direction, wired in parallel?

Post Reply

Return to “Music Tech DIY”