SparkFun Forums 

Where electronics enthusiasts find answers.

Have questions about a SparkFun product or board? This is the place to be.
By hassmaschine
#143810
Mee_n_Mac wrote: Any chance you could post a schematic or wiring diagram of what you think you have ? I gleam you're taking the voltage off a pot that's used to dim lights somewhere and when that voltage goes lower and lower you want the LEDs to get brighter and brighter ?? Thus you've got some inverting op-amp circuit to (try to) do that. That op-amp then drives a bunch of resistor+LEDs that are in parallel. So what you seem to need is an amp that can supply more current at about the same output voltage as the present op-amp circuit. You might be able to find a "power amp" to replace the op-amp in your circuit or one that follows it (op-amp output goes into power amp input).
I can post something, but basically what you've described is what Iv'e got - the voltage source I have from the dimmer/switch decreases as the backlights need increasing voltage, and vice versa. It is a dimmer but I never run it at a lower brightness (it's not very bright anyway).
OTOH when you say that "it's purpose is to invert the voltage from the light switch/dimmer, which I always run at full brightness," it sounds like you have a fixed voltage, that's either there or not, and the problem is just that it's not the correct voltage for the LEDs. There may be a much better and simpler way to make the LEDs turn on if this is the case. But I do need to know the circuit as best a you can and what the "wrong" voltage from this switch/dimmer is. Depending on the current involved, you might be able to get rid of this op-amp circuit and just use a reasonable power dropping resistor (though a DC-DC converter would be less wasteful and run cooler and a linear regulator+resistor would split the difference btw these 2 approaches).
see above. it doesn't work like this. a DC to DC won't work because at "full brightness" the source I can use from the dimmer switch is 1.35v, at "full dim" it's 8v. :)
hassmaschine wrote:btw, even if I crank up the op amp to say, 7v output, it still only gets about 3v to the LEDs.
If my understanding is correct, that's to be expected. The op-amp can't provide all the current needed by the LEDs. They are in effect shorting the output of the op-amp to ground (even if it's not a "hard" short). But let's be very clear with the terms used so there's no mistake. When you said "about 3v to the LEDs", did you really mean ~3V between the connector pins that go to the resistors+LEDs and ground ? The actual voltage across just the LEDs themselves should only ever be 1.5 to maybe a little over 2 V, even when driven at their max current levels.

Can you measure what the current draw needed by all the resistors+LEDs is ? I'm thinking you could put an ammeter inline with an ~ 4.8V battery pack and connect the resistors+LEDs to that. With that measurement, we could know what's needed for a "driver" of some sort.
I think you're correct - it's just not getting enough amps. when I supply 5v from a different source it works fine.

I meant the op amp only supplied 3v to the LEDs, not across them (I did measure that with a 5v supply, it was around 2.75v).

I tried reading the current with my cheap POS HF multimeter but it didn't really work (no readings anywhere). I don't trust this thing anyway. can I get in the ballpark a different way? there are 13 smd LEDs wired in parallel. I don't think LEDs differ drastically in their current draw? maybe they do?
By Mee_n_Mac
#143811
So much depends on the LEDs, I can only SWAG that they'll use somewhere between 10 and 20 mA and IF they are all wired in parallel, that's 130 - 260 mA for current draw. Certainly more than your op-amp can provide. At what voltage from the dimmer do you want the LEDs to come on ? Again, are all 13 wired to the same single pin you have to power them ? What would normally drive these LEDs ?

Here's my thinking ... you could use a simple comparator, like an LM139, and when the voltage got below a certain amount the comparator's output would change state. This could be used to switch a relay to send some +V to the LEDs or just drive a PNP transistor (? 2N3907 ?) which would then connect the LEDs to a +V source. Naturally we'd have to know the correct +V.

If there's more than 1 power pin, say there's one for every 3-4 LEDs, you could have several comparators switch on their LEDs at different dimmer voltage levels and so achieve some measure of LED brightness control.

If you wanted I suppose we could come up with some chopper (PWM) circuit that adjusts it's duty cycle as a function of input voltage (from the dimmer, 8V = off and 1.35V = full on) and achieve a full measure or brightness control. Unfortunately my PC with my circuit sim software is "pining for the fjords" so that would make getting a good design the 1'st go-aroound a bit less probable.

In almost every case I would need to have some idea of the intended driving voltage and/or the intended current draw. Can I ASSume that it's supposed to be 5V ("when I supply 5v from a different source it works fine") and that you have 5V handy to drive it ?
FWIW almost any DMM should be able to measure the expected level of current. You just need to stick the DMM leads in series with the LEDs (btw the voltage source and the LEDs input pin) and switch the DMM to amps mode and have the DMM probes stuck into the proper jacks in the DMM (current measurement is a different "set of holes" from voltage measurements).
By hassmaschine
#143840
I'm not sure what I'm doing wrong - but I haven't been able to get any reading with this silly DMM. I wish my fluke still worked. :(

anyway - I'm actually considering "screw it" and just hooking the 5v supply directly to the backlights. I don't care if they're always on. but I may need to add a resistor, when I put on the cover it bleeds through the gauge faces a tiny bit.

at least the gas gauge is working perfectly! aside from the backlights, I don't believe I have anything else to do, other than wire everything together. :)

BTW, thanks for all your help!
By hassmaschine
#143961
I've been thinking about it, and although just running them constantly with a 5v supply would work (quick and dirty), I don't think I want that. At the very least, I want them to turn on with the light switch.

I've got two choices - I can use the op-amp I already have (that can do 5v, but apparently not enough current), and maybe an emitter-follower circuit. alternatively, I could splice into the a +12v line for the lights, and build a voltage divider of some sort. out of those two, I'd rather do the first once, since it's already built and I don't have to do any extra wiring.

if I built an emitter-follower, just a basic one, using a 5k pot (or another value that might work), I could simply adjust the amperage output to get them where I want, right?
By Mee_n_Mac
#143967
Can you put together a schematic of what you have already ? Or at least let me know what the op-amp output is (with no load attached) for a number of dimmer voltages. I'm guessing you have some inverter configuration, perhaps with a level shift as was used for the gas gage. BTW is there some reason you have the dimmer operating "backwards" ? I'd have guessed that in it's previous life the max brightness would have been at 8V and the dimmest at 1.35V.

I might hope you could get by with a simple relay; with one end of the coil attached to "12V" and the other end of the coil to your dimmer. When the dimmer voltage gets low enough the relay will energize and then the contacts would connect your resistors+LEDs to whatever voltage source (and additional resistor ?) you find works. The problem is I don't know what the internal resistance of the dimmer is at the point where you want the LEDs to come on (the voltage being <??V). If the dimmer output was connected directly to some lightbulbs (to be dimmed) in it's previous usage, it'll probably be OK. Even if not, you could find a sensitive relay and just see if it works. This would be easier than adding a "driver" circuit to your existing op-amp circuit.
Relay4LEDs.jpg
You do not have the required permissions to view the files attached to this post.
By Mee_n_Mac
#143971
It occurs to me that if the simple relay concept above "works" for you, and if you have some spare 100 and 200 and 300 ohm resistors lying about ... you could do a few simple experiments to know ahead of time whether the concept will work in reality and whether you need a sensitive coil relay or just a normal one. Start by adjusting the dimmer to the point where you want the LEDs to come on. Then measure the output voltage as you did before. If this is <3V, you can probably use a 12V coil relay. Simulate the coil resistance by connecting a 300 ohm resistor across the "12v" to the dimmer output you just measured. Measure the voltage at the dimmer and across the resistor. If voltage across the 300 ohm resistor is 10V or greater, you're good to go with a standard signal relay with a 12V coil. If the voltage is less than 8V you will need a "sensitive" coil type relay.

Emulate one of these relays by adding another 300 ohms of resistance in series with the one you put in (600 ohms total). Again measure the dimmer voltage and voltage across the resistor. Again if the voltage > 10V across the resistor you're good to go with a sensitive coil 12V signal relay. If both of these fail the "10V test", stick the 100 ohm in (all by itself) and repeat the measurements and then the 200 ohm in (all by itself) and repeat the measurement. Post those back here and we'll see what else can be done.

If the "LED on" voltage is > 3V, just make the 100, 200, and 300 ohm measurements and let's see what can be done. A lower voltage coil might work in your scheme and the measurements will tell us.
By hassmaschine
#146677
alright - I'm back on this again after a 3 month hiatus :)

I have decided that I'm going to just switch on the 5v LED supply using the light switch as an input.

And luckily, it's more simple than you were thinking. There is another pin on the light switch that is simply switched ground when you turn on the lights (rather than grabbing the reverse voltage post of the light switch output). I figure all I have to do is feed that into a 2n2222a that activates the 5v input when grounded. here's the wiring diagram for the light switch:
Image

at the bottom you can see pin 4 of the light switch (accessory connector). I tested this with a DMM and basically it just switches to ground when you pull the switch (it's not immediately clear in the schematic). It's not used for anything, I guess BMW just put it there for the owner's use. Back in the day when they actually built driver's cars. ;)

I want to use this diagram, only with a 2n2222a and a 5v input:
Image

that should work, correct?

my only other idea - I'm not sure how much I want to tax the cluster's 5v supply. What I was thinking of doing, and it's probably a bad idea, was using the 13.5v car voltage instead, and using a voltage divider to bring it down to where I'd like it. But like I said, probably a bad idea?

I'll probably still use a voltage divider with the 5v supply, just so I can have some control over the brightness (and I've made the circuit so I can bypass it with a jumper if needed).

i need to build a test circuit first, I've got an extra light switch now too so I can fully bench test the whole thing.
By Mee_n_Mac
#146705
There's a disconnect between the wiring diagram you've provided and the words you've said. Let me see if I remember what you're were doing ... big picture-wise. You have an older BMW that you're putting a newer instrument clulster into. You've kept the old light switch and dimmer, as shown in the wiring diagram above. The instrument cluster wants to run off of 5V ... which comes from someplace else. There are LEDs in this cluster that want to see 5V, not "battery voltage" (12-14.4V). Ideally you want to be able to selectively dim these LEDs but for now it would be acceptable to just get them to be on/off with the old switch.

Looking at the wiring diagram it appears to me that the switch (when pulled ?) connected battery voltage to pin 1 (and to the old cluster) in the park and headlight positions. I might guess that as you twist the knob, the old cluster lights dim or get brighter. This is because there's a pot, used as a rheostat (a variable resistor), in series with the old cluster lights, between them and chassis ground. More resistance made for dimmer lights (less current through the bulbs) and less resistance made for brighter lights. Resistance varied with twist of the knob (or rotation of some other control). Pin 4 is connected to the variable resistor and to ground only through this rheostat (and a couple of diodes tossed in for good measure). It should always measure some resistance to ground, independant of the switch (park, head) position. This is different from how I read your words though perhaps in it's brightest position the rheostat is very low resistance to ground (and that's what you measured). Also the diodes keep the dimmer switch from supplying current out of pin 4, it can only suck current into pin 4.

If you keep the transistor circuit you showed (with the 2N3906, not a 2N2222a) and connected the open side of R1 to pin 4, I suspect the circuit will work to switch on the +supply (5 or 12V) to the LEDs. As you've said the supply need not be 12V but could be 5V (to go to the LEDs only) instead. Off the top of my head a 2N3906 should be good for 200 mA of current, you'll need to check that vs the total LED current draw. At some point as you adjust the dimmer control to be "more dim", you'll add enough resistance in series with R1 that the transistor won't switch anymore and the LEDs will go out. There will be a narrow region where the transistor will be neither fully on nor fully off and this may act to dim the LEDs but I'd be just a tad concerned about power dissapation in the transistor. When fully on, the current may be "high" but the voltage across the transistor will be low, perhaps 0.1-0.2 V, so as a result the power dissapated in the transistor is "low". And when the transistor is off, the voltage across it is "high" (5V in your case) but the current is near zero so again the power dissapated in the transistor is "low". In that inbetween zone you may have a few volts across the transistor and who knows how many mA ? Let me pretend it's something like 100 mA and 2V, that's 0.2W in the transistor. Depending on the package type and heatsinking, that may be more than is good for the device. Either avoid doing that (dimming) or get a beefier transistor (or FET).

BTW you want to use an PNP transistor (as shown), not an NPN (like a 2N2222a) to switch the 5V as shown. It's also the only way to use pin 4 due to the diodes shown in the dimmer switch. Using battery voltage instead of 5V in the circuit (as shown) can be made to work but you'll compound the discussed transistor power dissapation concerns and have to add some way to limit the current to the LEDs, which wanted to "see" only 5V. Depending on their max current draw, that might take a fairly beefy resistor.

What connection to the LEDs is available ? If their "ground" is separate from the cluster ground, you could tie that to pin 4 and let the rheostat turn on the LEDs and even dim them. I'm sure the rheostat in the old dimmer switch is "beefy". If all you have is a +supply to the LEDs, then that won't work and you'll need to do something like you've proposed. FWIW the relay circuit I showed above, with the - lead of the relay coil tied to pin 4 of the dimmer switch should work. At some point as you adjust the dimmer control to get brighter, the rheostat resistance will be low enough to energize the relay and thus switch some voltage (your choice) to the LEDs. You just won't be able to dim them and, if the wiring diagram is correct, the LEDs won't go on/off with the off/park/head position of the switch. To make that happen you'd need to tie the + lead of the relay coil to pin 1 of the switch (so the relay only gets it's 12V power when the switch is in park/head).
By hassmaschine
#146724
Mee_n_Mac wrote:There's a disconnect between the wiring diagram you've provided and the words you've said. Let me see if I remember what you're were doing ... big picture-wise. You have an older BMW that you're putting a newer instrument clulster into. You've kept the old light switch and dimmer, as shown in the wiring diagram above. The instrument cluster wants to run off of 5V ... which comes from someplace else. There are LEDs in this cluster that want to see 5V, not "battery voltage" (12-14.4V). Ideally you want to be able to selectively dim these LEDs but for now it would be acceptable to just get them to be on/off with the old switch.
correct, that's the direction I've decided on.
Looking at the wiring diagram it appears to me that the switch (when pulled ?) connected battery voltage to pin 1 (and to the old cluster) in the park and headlight positions. I might guess that as you twist the knob, the old cluster lights dim or get brighter. This is because there's a pot, used as a rheostat (a variable resistor), in series with the old cluster lights, between them and chassis ground. More resistance made for dimmer lights (less current through the bulbs) and less resistance made for brighter lights. Resistance varied with twist of the knob (or rotation of some other control). Pin 4 is connected to the variable resistor and to ground only through this rheostat (and a couple of diodes tossed in for good measure). It should always measure some resistance to ground, independant of the switch (park, head) position. This is different from how I read your words though perhaps in it's brightest position the rheostat is very low resistance to ground (and that's what you measured). Also the diodes keep the dimmer switch from supplying current out of pin 4, it can only suck current into pin 4.
That's why I said the diagram was misleading. When I actually test the switch, all I get is a ground (without any resistance). However it was months ago that I tested it, and now I have a spare switch, so I'll double check it again. But originally I thought it worked the same way you do, and I was hoping to use that to my advantage, but I was disappointed when all I found was a switched ground.
If you keep the transistor circuit you showed (with the 2N3906, not a 2N2222a) and connected the open side of R1 to pin 4, I suspect the circuit will work to switch on the +supply (5 or 12V) to the LEDs. As you've said the supply need not be 12V but could be 5V (to go to the LEDs only) instead. Off the top of my head a 2N3906 should be good for 200 mA of current, you'll need to check that vs the total LED current draw. At some point as you adjust the dimmer control to be "more dim", you'll add enough resistance in series with R1 that the transistor won't switch anymore and the LEDs will go out. There will be a narrow region where the transistor will be neither fully on nor fully off and this may act to dim the LEDs but I'd be just a tad concerned about power dissapation in the transistor. When fully on, the current may be "high" but the voltage across the transistor will be low, perhaps 0.1-0.2 V, so as a result the power dissapated in the transistor is "low". And when the transistor is off, the voltage across it is "high" (5V in your case) but the current is near zero so again the power dissapated in the transistor is "low". In that inbetween zone you may have a few volts across the transistor and who knows how many mA ? Let me pretend it's something like 100 mA and 2V, that's 0.2W in the transistor. Depending on the package type and heatsinking, that may be more than is good for the device. Either avoid doing that (dimming) or get a beefier transistor (or FET).
I got a ROM guess on a resistor from an EE friend at 1k ohms. due to how the board is built there's no real way for me to measure current.

As I said, I always have my switch at full brightness, and if my original measurements were correct it's just a ground anyway. I guess I'll have to see.
BTW you want to use an PNP transistor (as shown), not an NPN (like a 2N2222a) to switch the 5V as shown. It's also the only way to use pin 4 due to the diodes shown in the dimmer switch. Using battery voltage instead of 5V in the circuit (as shown) can be made to work but you'll compound the discussed transistor power dissapation concerns and have to add some way to limit the current to the LEDs, which wanted to "see" only 5V. Depending on their max current draw, that might take a fairly beefy resistor.
thanks for the correction on the transistor.
What connection to the LEDs is available ? If their "ground" is separate from the cluster ground, you could tie that to pin 4 and let the rheostat turn on the LEDs and even dim them. I'm sure the rheostat in the old dimmer switch is "beefy". If all you have is a +supply to the LEDs, then that won't work and you'll need to do something like you've proposed. FWIW the relay circuit I showed above, with the - lead of the relay coil tied to pin 4 of the dimmer switch should work. At some point as you adjust the dimmer control to get brighter, the rheostat resistance will be low enough to energize the relay and thus switch some voltage (your choice) to the LEDs. You just won't be able to dim them and, if the wiring diagram is correct, the LEDs won't go on/off with the off/park/head position of the switch. To make that happen you'd need to tie the + lead of the relay coil to pin 1 of the switch (so the relay only gets it's 12V power when the switch is in park/head).
Power only. The ground is constant and the power is switched on by one of the CPUs (presumably with some sort of variable/PWM output). I wish I could switch the ground, all the other LEDs are ground switched except the backlights, and activating them was really easy!
By Mee_n_Mac
#146742
The simplest thing to do is get a 12V relay. Connect the -coil to ground and the +coil to the switch pin #1 so that whenever the parking lights or headights are on, the relay is energized. Connect 1 side of the contacts to the LEDs in the instrument cluster and the other side of that contact pair to 5V (or 12V with an additional dropping resistor). The relay contacts should be rated for no less than 500 mA DC and perhaps no more than 10A DC (heavy duty relays don't always work well at low currents). Given you don't know the LEDs current draw, this is a safer and surer bet than using a transistor circuit. Less soldering too !
By hassmaschine
#146774
A relay would certainly work, but would be kind of bulky, the space behind the cluster is pretty cramped. i'd rather do it with a transistor and have everything packaged together. :)

I did some more backlight testing yesterday, switching plain 5v will defintely be accceptable. I don't think I'll need any voltage divider.
By hassmaschine
#147168
okay, I rechecked the light switch - and I was wrong. it does look like the pin 4 connection to my light switch accesses the rheostat, it's not a straight up ground. it also appears to be active whether the light switch is on or off. (I always got a continuity to ground). So the diagram I posted above won't work.

I checked on the back of one of my car's lights, and I also get a 12v switched signal with the light switch. Again my choices are the same - either a relay (simple) or I could use a transistor. I'd like to try and use a transistor, looking for a diagram I can use now.. if I can't figure that out, a relay will definitely work (I have tons of 12v relays).

I've got all the parts that I need now to put this together and make it work, too. :)

this should work correct? minus the LED/1k resistor, switch the 5v and 12v around:
Image
By Mee_n_Mac
#147183
hassmaschine wrote:this should work correct? minus the LED/1k resistor, switch the 5v and 12v around:
Basically correct. If your "LEDs" (that we believe to actually be a bunch of LEDs + dropping resistors) in the new cluster were meant to run off 5V, not 12V, then you'll want to have something for R1 ... value unknown ATM ... otherwise too much current will flow through them. Using 12V in place of the 5V means you may have to tweak R2 as well. You want to have enough current flowing into the base of the transistor to ensure the transistor is saturated and acting like a good switch to ground.
By hassmaschine
#147191
if the LEDs have current limiting resistors already, why do I need R1? the LEDs would be connected to the emitter, 5v to the base and 12v to the collector.

I'll start with a larger value for R2 and work my way down from there.
By Mee_n_Mac
#147217
hassmaschine wrote:if the LEDs have current limiting resistors already, why do I need R1? the LEDs would be connected to the emitter, 5v to the base and 12v to the collector.
Because the built-in current limiting resistors were sized for 5V. If you basically double the voltage across the LED+resistor, you should expect double the current. Will that fry the LED ? Depends on how close to the max current the built-in resistor allowed at 5V.
I'll start with a larger value for R2 and work my way down from there.
You'll want to make sure the difference in voltage between the collector and emitter (ground) is <0.2V and perhaps even less (it'll depend on the transistor you have the the "big" current level). Decrease R2 unit Vce doesn't drop anymore. This means the transistor is acting as a switch and not limiting current itself. It minimizes the heat disappated in the transistor. If you know (or measure) the "big" current level and are using 12V instead of the 5V in your diagram, then this is a good start for R2:

R2 = 11.35/(big current/100)