Connect with us

Sensor/LED circuit-more help needed please-multiV's and dimmer

Discussion in 'Electronic Basics' started by Gman, Aug 19, 2005.

Scroll to continue with content
  1. Gman

    Gman Guest

    Hi there,

    Thanks for the help on the test button question. Got another
    non-electronics technician problem.

    I am still working on this Sensor Circuit with LED indicators. The box
    I'm building, I want it to be able to be used on either system voltage
    of 14Vdc or 28Vdc with a spdt switch setting the box for the
    appropriate voltage.

    So I have eight sensors, eight LEDs (some with different ratings, see
    below), two voltages and two states of DAYTIME (Bright) and NIGHTTIME

    The LEDs are supplied directly by the sensors. This means that each LED
    has it's own power supply so speak. But, all supplies will either be
    14Vdc at one time, or 28Vdc at one time (you will not have both
    voltages at the same time).

    Because of the different LED colors I have to deal with a 2V and a 3V
    LED at the two voltages of 14Vdc and 28Vdc, so my resistances are 550,
    600, 1.25K and 1.3K at 20mA.

    Its easy enough just to put a 600 ohm R inline with each LED, but how
    do I switch so that ALL LEDs have a 1.3K R in front of them without
    running all the power through my voltage selector switch (which would
    defeat the purpose of using the power from the sensors and having an
    indicator light up when power is supplied by the sensor)?

    My next problem will be to DIM all the LEDs for the NIGHTTIME setting,
    yet a third resistive value????

    I'm trying to use more passive components rather than ICs and trying to
    keep it simple as possible all the way, any suggestions are hugely

    Thanks in advance.
  2. John Fields

    John Fields Guest

    I think the esaiest way to do it would be with 8 constant-current
    sources, like this:

    | |A |
    [10K] [LED] |
    | | |
    | C Q1 |
    +-----B 2N4401 |
    | E |
    | | |
    Q2 C | |
    2N4401 B-----+--[R2]--+ |
    E | | O
    | [R3] Q3 C |
    | | 2N4401 B--[4k7]--+--> >--O--> |
    | | E | S1
    | | | [100K]
    | | | |

    Vin is the output voltage from your sensor, and Q1 and Q2 form a
    constant current source where R3 determines the current through the
    LED. I just built one to see how well it would work, and with 39
    ohms for R3 I got 17.07mA through the LED with Vin = 14V, and
    17.83mA with Vin = 28V. Not bad!

    R2 and Q3 do the dimming, and when Q3 is turned on by closing S1,
    (the common BRIGHT/DIM switch) R2 will be placed in parallel with
    R3, requiring more current to flow in order to bring the circuit
    into regulation. That means that "BRIGHT" will be when the switch
    is closed, and "DIM" will be when it's open.

    After I tried the basic circuit I added on the dimmer, and with R2
    and R3 both equal to 39 0hms, here's what I got:

    Vin Idim Ibrt
    V mA mA
    14 16.4 29.8
    28 16.0 32.9

    You'll have to fiddle with R2 and R3 to get the ratio of bright to
    dim to be what you want but, basically, it works.

    Also, I forgot to show it on the schematic, but I bypassed the
    supply, at the circuit, with 0.1µF.
  3. John Fields

    John Fields Guest


    2N4401's are rated for 625mW max, and Q1 will be dissipating about
    500mW with a 28V supply, so if you decide to use this circuit you
    may want to get a transistor that can handle a little more power or
    put a dropping resistor in series with the LED or even glue all the
    Q1's to a heat sink...

    And, BTW, the BRIGHT/DIM switch needs to be wired to the 14V/28V
    POWER switch, not to the output of a sensor, as I showed before.

    Like this:

    | |A
    [10K] [LED]
    | |
    | C Q1
    +-----B 2N4401 14V O--> |<--O 28V
    | E |
    | | O
    Q2 C | |
    2N4401 B-----+--[R2]--+ |
    E | | O
    | [R3] Q3 C |
    | | 2N4401 B--[4k7]--+--> >--O--> |
    | | E | S1
    | | | [100K]
    | | | |
  4. Gman

    Gman Guest

    Hi John,

    Thanks. With how much posting you do, I really appreciate you taking
    the time for my simple questions. Can you tell me what the 1uF cap is
    for, noise, filter? I'm not skilled in electronics so I'm just curious.

    Thanks again, it really is appreciated.

  5. Gman

    Gman Guest


    Do you have any recommendations on the higher rated transistor?

    Mucho gracias
  6. John Fields

    John Fields Guest

    It's to lower the impedance of the supply. What happens is that the
    wiring between the supply (in this case, the outputs of your
    sensors) and the load (the constant current LED drivers) often can
    cause problems because of the indutance and capacitance it can add
    to the circuit, which can result in oscillation. Placing a
    capacitor across the supply, at the load, will generally stop any
    foolisness from happening since it will provide a nice low impedance
    path to ground for the potentially offending signals. It cuts them
    off at the knees, so to speak, before they have a chance to grow and
    do any damage.

    That's especially important with devices like your sensors, which
    are supplying "courtesy" outputs capable of sourcing fairly decent
    amounts of current, but which aren't really power supplies.
  7. Gman

    Gman Guest

    Thanks again John,

    I just breadboarded the circuit, if I am understanding the circuit (it
    came a little out of whack in alignment), R2 should be between the Base
    of Q2 and Collector of Q3? Also, SW1 should be supplied system voltage
    not supplied from the sensor?

    I'm gonna go out on a limb and say that I got it right (far limb), when
    I pull R3 the "dimness" doesn't change, changing the value of R3 seems
    to have no effect on "dimness" if you will. Which asks the question (at
    least in my feable mind), why is it there? Should I rather mess with

    Thanks again,
  8. John Fields

    John Fields Guest

    You should have your newsreader set to display text in a
    non-proportional font like Courier or Courier New and then the
    schematic will line up.

    That end of R2 should be connected to the junction of Q2 base, Q1
    emitter, and the ungrounded end of R3. Yes, system voltage goes to
    S1. Here's a better schematic, with R6 added to cut down on the
    power dissipated by Q1:

    | |R6
    | [430]
    |R1 |A
    [10K] [LED]
    | |
    | C Q1
    +-----B 2N4401 14V O--> |<--O 28V
    | E |
    | | O
    Q2 C | |
    2N4401 B-----+ |
    E | |
    | +--[R2]--+ |
    | | | O
    | [R3] Q3 C R4 |
    | | 2N4401 B--[4k7]--+--> >--O--> |
    | | E |R5 S1
    | | | [100K]
    | | | |

    Something's wrong. R3 is used to set the dimness with S1 open, and
    R2 is used to set the brightness when S1 is closed.

    I've posted a picture of the working circuit on abse so you can see
    what it looks like and check your wiring against it. I just noticed
    (after I posted it, of course) that there are two R5's on the photo.
    Aaarghh! The top one is supposed to be R6.
  9. Gman

    Gman Guest

    Hi John,

    Sorry for being such a simpleton, I have only found this forum in the
    last few days. You say you posted the picture on "abse", I feel like an
    idiot, but what is "abse"?

    Also, if we get the circuit working the way it should, I probably will
    want to go for a higher rated transistor, any suggestions on that?

  10. John Fields

    John Fields Guest

    Don't feel bad, this is sci.electronics.basics (seb) where there are
    no stupid questions. Abse is a newsgroup
    (alt.binaries.schematics.electronic) where you can post binaries,
    unlike this one (seb) where you can only post text.
    With that 430 ohm resistor in series with the LED, the dissipation
    in the transistor went down to about 350mW, and the case temperature
    rose to 42° with an ambient temp of 25°C so that ought to be fine.

    Fairchild spec's the junction-to-ambient thermal resistance of the
    2N4401 at 200°C per watt, so with a dissipation of 350mW that puts
    the junction at:

    200°C * 0.35W
    Tj = --------------- + Ta = 95°C

    Since the part is rated for a maximum junction temp of 150°C, I'd go
    with it but, if you want something a little stronger I'd recommend a
    Zetex ZTX451.
  11. ehsjr

    ehsjr Guest

    This circuit will work at either 14 or 28 volts Vcc
    from the sensors, and includes switchable dimming:

    | |
    [Zd] [LED]
    | |
    | |
    +---o o---+
    Bright/Dim switch

    The zener is 12 volts and R1 is 470 ohms, both at 1 watt.
    The the LED and R2 "see" 12 volts regardless of the input,
    so R2 is computed for 20 mA at 12 volts, or 500 ohms for
    the 2V LED, and 450 for the 3 volt LED. The bright/dim
    switch shorts out R3 in the bright position. You'll need
    to choose R3 experimentally for the degree of dimness
    you want.

    A note regarding R2. There is not much difference in
    current if you use the same resistance for both the
    2V and the 3V leds. If you pick a value of 470 ohms,
    the 2V LED draws ~21.27 mA. The 3V LED draws ~19.14 mA.
    I don't think you will be able to see any difference.

  12. Gman

    Gman Guest

    Hi Ed,

    Thanks a bunch. I will do a breadboard and look at that one to. That
    has even less complexity over the other circuit, do you guys see
    advantages/disadvantes between the two?

    Best regards,
  13. Gman

    Gman Guest

    Hi Ed,

    I found that the sensors operate by providing ground instead of power.
    How does this effect the suggested circuit above, if at all?

    Thanks and regards,
  14. Chris

    Chris Guest

    Hi, Gman. Just to restate the bidding here:
    * You've want a circuit whose power supply can be switched between
    14VDC and 28VDC.
    * You've got a sensor which turns sinks current to GND (low resistance
    to GND) when the light is bright.
    * You want to drive 8 LEDs in such a manner that, for either voltage
    selected, they have higher current (say, 20mA) during the day, and a
    lower current (say, 12mA) at night.
    * For some reason you want to do the job with only discrete components
    -- no ICs.

    The responses you've been getting from others that you should be
    driving the LEDs with a constant current source are good ones.
    Actually, a transistor current source is a fairly good "one-trick pony"
    which should do most of the work for your circuit.

    ` NPN Current Sink PNP Current Source`
    ` VCC VCC
    ` + +
    ` | |
    ` | | +
    ` | .-.
    ` R | |
    ` | |
    ` Load '-'
    ` | | -
    ` || |Vdrive + 0.7V
    ` || Vb|<
    ` |V Vdrive >---|
    ` |Ic |\
    ` | | |
    ` Vb|/ | |
    ` Vdrive>----| | V
    ` |> | Ic
    ` |Vdrive - 0.7V |
    ` | +
    ` .-. Load
    ` R | |
    ` | | |
    ` '-' |
    ` | - |
    ` | |
    ` === ===
    ` GND GND
    created by Andy´s ASCII-Circuit v1.24.140803 Beta

    The idea goes something like this: If you have an NPN transistor and
    set it up so the base is driven with a stiff voltage source, the
    transistor will try to keep it's emitter about 0.7V less than the base
    by allowing current to pass through the collector. If you put a
    resistor from the emitter to GND, that will mean the transistor will
    try to keep the steady voltage across that resistor -- in other words,
    constant current sink through the load. Likewise, with a PNP
    transistor, the emitter will be kept about 0.7V higher than the base,
    meaning you get a constant current source. Here's the simple way to
    get the eight individual LED drivers (view in fixed font or M$

    ` VCC
    ` +
    ` |
    ` |
    ` V ~
    ` - ~
    ` |
    ` |
    ` Vb|/
    ` Vdrive>---| Q1 - Q8
    ` |>
    ` |
    ` | +
    ` .-.
    ` 100| |
    ` | |
    ` '-'
    ` | -
    ` |
    ` ===
    ` GND
    created by Andy´s ASCII-Circuit v1.24.140803 Beta

    Your largish NPN transistor will have a voltage applied to the base,
    and the collector current will be about 0.7V less than that. (This is,
    of course, an approximation, but it should be sufficient for the needs
    of the day.) So, if you've got a 100 ohm collector resistor, applying
    2.7V at the base will mean 2V across the 100 ohm resistor. Since the
    base current is only a very small fraction of the collector current
    (usually about 1/40th for TO-200 power transistors), you can assume
    your LED current will be about 20mA too, whether the supply voltage is
    14VDC or 28VDC. If you put about 1.9V at the base, you'll get about
    12mA through the collector. You'll need 8 of these -- 1 for each LED.

    Now let's talk about supplying the eight NPN transistor bases with a
    steady 2.7V in daylight (20mA) or 1.9V for darkness (12mA). I'm not
    sure what you're using as a light sensor, but you give the impression
    that it acts like a switch -- it has a high resistance to GND if it's
    dark, and a low resistance to GND if it's light. Of course, you could
    give more information if this isn't exactly what you have. But for the
    sake of discussion, let's assume it is a switch (SW1). That would make
    it fairly easy to provide the constant voltage source to the bases of
    Q1 - Q8 with two more transistors:

    ` + + + +
    ` | | | |
    ` | | | |
    ` | DZ2 .-. | DZ1 .-.
    ` /-/ | | /-/ | |
    ` ^ | | ^ | |
    ` | '-' | '-'
    ` | | | |
    ` | | | |
    ` | |< | |<
    ` o-----| o----|
    ` | |\ | |\
    ` .-. | .-. |
    ` | | | | | |
    ` | | | | | |
    ` SW1 '-' | '-' |
    ` _/ | | | |
    ` .--o/ o--' | === |
    ` | | GND |
    ` | | | Vdrive
    ` === '------------------o------->
    ` GND |
    ` .-.
    ` | |47 ohms
    ` | |
    ` '-'
    ` |
    ` |
    ` ===
    ` GND
    created by Andy´s ASCII-Circuit v1.24.140803 Beta

    The zener diode shown would be a 1N4733, a 5.1V zener with a test
    current of 49mA and a knee current of 1mA. Q9 is set up to supply a
    constant 40 mA to the 47 ohm resistor (that's about 1.88V, for those
    who are following with their calculators). The base of Q10 will
    normally not be drawing any current, so it's off when it's dark. But
    when the switch is turned on (it lights up), the 5.1V appears between
    the base of Q10 and V+ (whether 14V or 28V), which means Q10 will
    supply another 16.2mA to the 47 ohm resistor. That will total 56.2mA,
    which means about 2.64V. Of course, the other transistors will draw
    typically 0.3mA to 0.5mA each, but that total 2.4mA to 4mA won't affect
    the voltage that much. If you find it's not quite there, tweak the 110
    ohm resistor above Q9 down to 100 ohms, and the 270 ohm resistor down
    to 240 ohms. That will increase the drive voltages to well over 2.7V
    (light) and 1.9V (dark).

    So that's 8 power NPNs, 2 power PNPs, 2 1N4733 zener diodes, and 13 1/4
    watt resistors. I don't think you're going to reduce that parts count
    too much.

    Again, I'm kind of wondering what you'll use as a light sensor. I get
    a feeling it might be a little more difficult than a switch to GND.
    Feel free to post again with more information.

    Good luck
  15. Chris

    Chris Guest

    Sorry -- Try again with the drive voltage section...

    + + + +
    | | | |
    | | | |
    | DZ2 .-. | DZ1 .-.
    /-/ | |270 /-/ | |110
    ^ | | ^ | |
    | '-' | '-'
    | | | |
    | | | |
    | |< | |<
    o-----| Q10 o----| Q9
    | |\ | |\
    .-. | .-. |
    | | | | | |
    | | | | | |
    SW1 '-' | '-' |
    _/ | | | |
    .--o/ o--' | === |
    | | GND |
    | | | Vdrive
    === '------------------o------->
    GND |
    | |47 ohms
    | |
    created by Andy´s ASCII-Circuit v1.24.140803 Beta

    Left out the labels. Q1-8 could be TIP31 or equivalent, and Q9-10
    could be TIP41 or equivalent.

    Q9 should get a small heat sink for greater reliability. It will
    dissipate a little over 1 watt.

  16. ehsjr

    ehsjr Guest

    No change to the circuit - just wire the Gnd line to the
    sensor and the Vcc line to the supply.

  17. ehsjr

    ehsjr Guest

    Chris replied, and at first I wondered why he offered
    a complicated circuit, until I realized he's thinking
    about making all the LEDS either bright or dim with
    one switch, while my circuit, although simple, requires
    individual switches to dim each LED. Therefore,
    I'll offer a different simple circuit to dim all the
    LEDS with one switch, and add adjustable dimming.

    ----- | | | |
    adj [R1] [Rled] [Rled] [Rled]
    | | | | |
    +---------+ [LED1] [LED2] [LED8]
    | | | |
    | Sensor1 Sensor2 Sensor8
    | dim
    | | o bright
    [R3] o
    | |

    R1 = 240 ohm 1/4 w
    R2 = 47 ohm 1/4 w
    R3 = 1500 ohm 1/4 w
    POT = 5K linear taper potentiometer
    Rled = 330 (will work for both 2V and 3V leds)

    How it works: The LM317 is configured to supply ~9.06 volts
    when the switch is in the bright position, regardless of whether
    Vcc is 14 or 28 volts. When the switch is in the bright position,
    Rled limits the current to a 2 volt LED to ~21 mA; for a 3 volt
    LED Rled limits it to ~18 mA.

    When the switch is moved to the dim position, R2 and the pot
    are placed in parallel with R3. The resistance from the adj pin
    to ground can be varied by the pot from ~1252 ohms to ~45.5 ohms,
    meaning that the LM317 will supply from ~7.77 volts down to
    ~1.48 volts. That means you can vary the current to the LED
    between ~17mA and 0 for the 2 volt leds, and between ~14 mA
    and 0 for 3 volt LEDs

    You will need a heatsink for the LM317. Under worst case
    conditions (Vcc = 28 volts, all leds lit, switch in bright
    position), it will need to dissipate ~3.34 watts.

  18. Gman

    Gman Guest

    Thanks guys,

    Whew! For a babe in the woods I have to read that about 20 times to
    "get it".

    Here is the gist again.

    I have both magnetic and proximity sensors. I have a total of 8
    sensors, 4 of which are magnetic 4 are proximity. When the sensors
    close (sense), they provide a ground, not power.

    That is the sensor side of things that you were wondering about.

    Separate Issue: Supply will be either 14 volts or 28 volts and only
    want one unit that will handle both voltages.
    Separate Issue: I will need to be able to have 3 levels of dimming for
    all LEDs
    Separate Issue ***New***: I have had to add clusters of backlighting
    LEDs on the front panel. Groups consist of 4 to 6 SMT LEDS in series.
    Need to be able to dim these at the same time as the indicator LEDs

    I didn't want to go with ICs because of static, extra driver circuits
    and components. But I see that that might not be an option. If
    necessary I may tell the powers that be that we should just go back to
    incandescent indicators. I want something that is almost mechanical
    (not literally, but you know what I mean).

    I know this is simple to you guys, but I'm not above admitting I may be
    in over my head on this. I thought I had the schematic wrapped up and
    about the same time I got the reply I realized that all of the grounds
    and the dimming circuit were tied together and that it wouldnt work
    that way.

    One more thing. I need to try and pack all this onto a 3.036" square.

    Thanks again guys (did I say anything that made sense?)
  19. ehsjr

    ehsjr Guest

    Up to this point, all of the above requirements have been met by
    the designs posted.

    3 levels of dimming is a new requirement - and is easy to meet.
    See below.
    We can work that out as a separate but related issue. First we need
    to know: What is the voltage for these leds? How many groups?

    Second: Your groups will be 4 LEDs each if they are 2 volt leds,
    and 3 LEDs each if they are 3 volt leds.
    The ground that the sensor supplies to the circuit *MUST* be common
    with the 14 volt or 28 volt supply ground. The circuits posted after
    you told us that the output of the sensor is ground will work fine.


    ----- | | | |
    adj [R1] [Rled] [Rled] [Rled]
    | | | | |
    +---------+ [LED1] [LED2] [LED8]
    | | | |
    | Sensor1 Sensor2 Sensor8
    | (Sensors connect to ground when active)
    | dim bright dim off
    +---[R2]---o o +---o o
    | \ sw1 | \ sw2
    [R3] o----------+ o
    | | |
    | P P
    +----------->O 1 +---->O 2
    | T | T
    | |

    R1 = 240 ohm 1/4 w
    R2 = 47 ohm 1/4 w
    R3 = 1500 ohm 1/4 w
    POT = 5K linear taper potentiometer
    Rled = 330 (will work for both 2V and 3V leds)

    When sw1 is in the bright position, a LED will light at full brightness
    when its sensor activates and goes to ground.
    When sw1 is in the dim position and sw2 is in the off position,
    pot 1 will control the brightness. Set it for medium.
    When both sw1 and sw2 are in the dim position, use pot 2 to
    set the brightness to the low level. Once you have set the pots
    for the brightness levels you want, you do not need to touch
    them again. The circuit works on either 14 volts or 28 volts.

  20. Gman

    Gman Guest

    Thanks Ed,

    I breadboarded the circuit with only 3 leds and accidently put in 47
    ohm RLEDs, of course the LM317 overheated and shut down, but before it
    did, you could work the circuit exactly as described. The LM317 came
    back on after cooling down and I changed to 330R for the LEDs, but I
    only have 3 LEDs in the breadboard, and can not adjust the brightness
    at all. Is this because there isn't enough load? Going to load it up
    and see if that changes anything.

Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day