I've got an LM358 comparator turning on an LED. What I'd like to add is a way to dim the LED by a fixed amound when a 12v signal is sensed.

It's in a tach circuit in a car, and when the headlights are turned on the dash lights get fed power, so when that occurs it's probably dark enough where the LED should be less bright.

I've got something modeled in ltspice with a resistor and npn on parallel with the led to draw off some of the current. Does that seem sensible or is there maybe a better way? Thanks!enter image description here

Here's an example of a similar 2-stage shift light in action:

This is an example of a similar 2-stage shift light

  • 2
    \$\begingroup\$ It sounds sensible but if you posted your schematic it might not be. \$\endgroup\$ – Andy aka Jul 16 '18 at 14:59
  • 3
    \$\begingroup\$ Yes, we need to see a schematic. \$\endgroup\$ – Elliot Alderson Jul 16 '18 at 15:08
  • \$\begingroup\$ I'm so sorry, I've got the schematic added now. This is.a really nice forum format for this type of thing! \$\endgroup\$ – mojozoom Jul 16 '18 at 16:03
  • \$\begingroup\$ Why 2 comparators doing same thing? Did you test this yet for RPM error, slew rate and ripple? Tachs are not usually rated like 725 Ohms rather in kRPM/V \$\endgroup\$ – Tony Stewart Sunnyskyguy EE75 Jul 16 '18 at 17:51
  • \$\begingroup\$ Good questions Tony - this is an odd one. The car is from 1968 and the tach is a Faria current sensing tach based on his 1958 patent US3005155, which uses a 1 mA full scale taut band meter movement. My DMM showed 725 ohms across the movement, and the current from the ohmmeter drove it to a 1500 rpm reading. So that's why I have the LM2917 set up as a freq to current converter. \$\endgroup\$ – mojozoom Jul 16 '18 at 19:11

I think it will be difficult to make your scheme work properly. Essentially, you are trying to use an NPN transistor to connect a resistor in parallel with an LED, hoping that the resistor will draw some large fraction of the current that would have gone through the LED. The problem I see is that the voltage across the resistor is proportional to the current passing through it while the voltage across the LED is (relatively) constant. So, the degree of current sharing between the LED and the resistor will change significantly as the supply voltage changes. What you have indicated as your "+12V" supply will actually vary quite a bit as the engine RPM changes, the A/C cycles on and off, and the battery charge level changes...it's probably over 14V when the battery is charging with few other loads. At low RPM the LED may not work at all.

To make the circuit more reliable you should probably add a voltage regulator for the LM358 comparators, so the LED circuits will see a more constant voltage. To change the brightness of the LEDs you should try to control the current through them. You need a way to add resistance in series with the LED when your headlights are on.

  • \$\begingroup\$ I can add a regulator. Without it the led current drops from 14mA to 9mA as battery voltage drops from 13.8v to 10v. \$\endgroup\$ – mojozoom Jul 16 '18 at 21:05
  • \$\begingroup\$ But I can't figure out how to add switched resistance in series. Can a digipot do that? \$\endgroup\$ – mojozoom Jul 16 '18 at 21:06
  • \$\begingroup\$ I would put a resistor in series with the LED (between the resistor and ground) and short across it with an NPN when the headlights are not on. Use another NPN with its base driven by the headlights...add a pullup on the collector, and use the collector voltage as your signal that the headlights are not on. \$\endgroup\$ – Elliot Alderson Jul 16 '18 at 22:22
  • \$\begingroup\$ That's perfect. I used three NPNs, one with the pullup resistor, and then one at each of the LEDs. I did have to add diodes in each signal line to the second NPNs as without them there was a short bit of higher current thorough the LEDs when they first turned on. But it works very nicely. Thanks! \$\endgroup\$ – mojozoom Jul 17 '18 at 2:25

The equivalent circuit of your schematic when headlights are on is a 2.73V source in series with a 77ohm resistor. The low equivalent voltage, very close to LED voltage might lead to high variations in LED current.

You can use an additional resistor in series with R15 (R23) shorted by a MOSFET P-channel when headlights are off like this:


simulate this circuit – Schematic created using CircuitLab

Use an appropriate MOSFET with Vgs max > +-15v, Vds > 15V, Id > 100mA

A low gate voltage will open M1 shorting the adittional resistor.

This way the dependence of the power supply voltage is reduced, both headlights on or off having a 12V source.

  • 1
    \$\begingroup\$ Darn I just saw this answer and had already ordered parts. If the NPN arrangement doesn't work out though I'll try this next. \$\endgroup\$ – mojozoom Jul 21 '18 at 14:51
  • \$\begingroup\$ @mojozoom I'm sorry I was that late with the answer. I'm glad tough I was so fast to point the huge error in the first posted answer so no harm was done. \$\endgroup\$ – Dorian Jul 21 '18 at 15:54
  • \$\begingroup\$ @mojozoom My doubts were if you can interrupt the circuit to insert an additional resistor but since there is no better answer I posted this anyway. \$\endgroup\$ – Dorian Jul 21 '18 at 16:04
  • \$\begingroup\$ Well I spent quite a bit of time working with he LM2917-14 and was never able to get a linear current response from it with respect to the input frequency. I expect it's something I was doing wrong, but I've found that the available spice models really aren't 100% correct in their behavior, and as I'm not an electronics expert by any means I really rely on LTSpice. \$\endgroup\$ – mojozoom Aug 10 '18 at 22:08
  • \$\begingroup\$ The 555 circuit was doing a fine job providing a 12V square wave at 20% duty cycle as required, until I pulled my normal shenanigans and hooked it up backwards. I can only think of one circuit I've built that I haven't hooked up backwards. I even hooked my hot tub up backwards once (240 VAC!). Anyway, I've ordered some new 555's and some P-type mosfets to protect the poor little chips from me. \$\endgroup\$ – mojozoom Aug 10 '18 at 22:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.