View Full Version : Can anyone help specify the proper value for the 1K resistor in this circuit?

7-Mar-2018, 23:04
Have done my homework, and searches but most non-specific circuits are beyond my learning curve, time to learn, and available wet-ram.

Have a 15 LED array being driven by a LM317 regulator set up for current regulation (shown below). Schematic has been breadboarded and works as advertised. Supply voltage 12-15Vdc, Vf of LEDs 3V, current 20mA ea. LM317 output with 12 ohm resistor.. 20.8 mA.


Need to add (optional) photo-switch to this circuit (on at dark, off at dawn). Simplest I have found has been posted in these forums already.


Problem is, this circuit, components and values, were designed for a 3V coin cell, and my requirements are based around available 12-15Vdc power. Additional constraints due to space for components (very small) and power consumption (least is best) require a solid state solution. This solution looks good if someone can help specify the proper value for the (now) 1K resistor in a circuit such as below. Spec sheet for the 2N3904 (http://www.kynix.com/uploadfiles/pdf8798/2N3904.pdf) shows a max current of 200mA so (I think) it should suffice.


As I said earlier, my knowledge of EE is extremely limited, and I am putting this together on the fly. I can read a schematic, and do a decent job of soldering but my theoretical knowledge is sadly lacking. I may need to build several hundred of these little suckers, so any input or pointers to a better path, or a solution to my specific questions are appreciated.

Eric Woodbury
8-Mar-2018, 11:31
I don't have time right this second, but I can help more this weekend.

First schematic has one obvious problem, the LEDs will not share the current equally. Those in series will, but those parallel won't. The LEDs are not perfectly matched, therefore, more current will flow down one leg. More current will create a larger voltage drop that helps balance, but the extra heat will reduce the forward voltage and suck more current. To solve, one would add small value resistors to each leg to give current balancing.

Your 317 is delivering 100 mA, 20 mA per leg. I just mention this for clarity.

Finally, for now, when you have a control device such as a 317, easier to control the LEDs at the ADJ pin. Less current to move about. Don't forget that 317s take 3V of headroom. Depending on what you're doing, you may not even need the 317 and may build a simple current mirror with a transistor. Then control the base current with the photo xstr and balance the current with resistors as mentioned above.

Let me know if this makes sense. If you like analysis, SPICE, programs, there is a free one called LTSPICE that is wonderful. Download from linear.com. You don't need it for this circuit, but as your circuits get more sophisticated, it's a great tool.


8-Mar-2018, 15:38
This solution looks good if someone can help specify the proper value for the (now) 1K resistor in a circuit such as below. Spec sheet for the 2N3904 (http://www.kynix.com/uploadfiles/pdf8798/2N3904.pdf) shows a max current of 200mA so (I think) it should suffice

Does the LED array have to have 12 to 15 VDC? Assuming it does, and the photo-transistor switch is to also run on the same voltage, then there may be problems with the 2n3904 transistor and the ltr 4206e opto-transistor. It will be simpler to run the LED array at 3 volts, if that is possible. Are you using a car battery?

Your current measure at the LM317 of 20.8 mA (if that is what it is) indicates that the array is drawing much less current than the LM317 is able to provide, which is 1.25/12 ohms = 104 mA (see data sheet for LM317, where sizing the resistor at the output is R=1.25/maximum allowable current. The supplied voltage (12 to 15) is much higher then the LED's forward voltage (3), and since LED's current draw is very sensitive to excess voltage, make sure that supplied voltage and current limits are well specified for the array. The low current draw (your 20.8 mA) with such a high supply voltage does not make sense to me. Did you mean each LED was drawing 20.8 mA?

The diagram you attached showing the LM317 has mis-marked terminals. Pin 1 is Adjust, pin2 is Output, and pin 3 is Input.

The 2n3904 transistor has a maximum voltage limit of 6 V between the base and the emitter, so it is possible that 12 to 15 volt supply could be too much and the transistor will break. The resistor and opto-transistor form a voltage divider, and without knowing the resistance across the opto-transistor, it's hard to say what the voltage would be at the base of 2n3904. The on-off dynamics will probably change with the higher supply voltage (i.e., the LED array may still be on during the day).

Anyway, with 15 volts across the 1k resistor, the current (I) would be:

I = V/R = 15/1000 = 0.015. Resistors are rated in watts, usually as 1/8, 1/4, 1, 2 etc. Watts = VI so the power would be 15*0.015 = 0.225 watts, just under 1/4 watt, and too much to be safe. The 1k value is probably sized to limit the current at the opto-transistor (LTR 4206E), which has a power limit of 0.1 watt, and with a 3 volt supply, the current is way under its limit. The opto-transistor has an emitter-collector voltage limit of 5 volts, so be careful how you wire it in (make sure the collector is attached to positive voltage); it's collector-emitter voltage limit is 30, so plenty of headroom there, and that's how it is on the schematic.

So what to do?

If the 2n3904 can handle the 12 to 15 V supply (the voltage at the base is not too high to break it), then I think if you use a 2 to 3K resistor instead of 1K, the circuit could work. The higher resistance will increase the rise and fall time for the opto-transistor, but it will still be about 40 us (40 millionths of a second).

You can set-up the LM317 as a voltage regulator with an output voltage of 3 or so, then place the light-activated switch after the power supply. Can the LED's in the array run on 3 volts? Many LED's do. You can use a resistor to limit the current to the array. If the voltage is regulated (as it will be by the LM317), then the current will be regulated too, except for minor fluctuations due to temperature that may not be important for your purposes. Temperature effects all semiconductors, so no matter what you do, there will be some variability in voltage and current as temperature changes.

If you have to use two supplies (3 VDC for the opto-switch, 12 to 15 VDC with the LED array), add in a relay, and use a lithium battery for the 3 VDC, or a voltage divider (two resistors will do, and size them for desired current) to cut-down the 12 to 15 VDC. The relay will be a relatively expensive option if reliability is to be ensured.

Breadboard the whole thing and test it for expected conditions, measure voltages and current at key points to be sure you are well-within the safe operating area, to make a reliable prototype.

I am not an electrical engineer, so others that are could weigh-in. The circuit could be easily modeled in SPICE if the type of LED's in the array are known. There is probably a simpler solution, but without knowing the device's purpose, and the type of LED's in the array, an optimal solution will be hard to describe, and this is especially important given your plan to build several hundred of them.

I wrote most of this before Eric Woodbury's posting, and he points out some other problems, particularly the current sharing among the LED's.

Eric Woodbury
8-Mar-2018, 17:40

You might try this circuit. LED part number not important here. Easy to build, few parts. Nothing unusual. Resistor values need not be exact. I was going for about 1 mA on left of current mirror and 100 mA on right. Q3 is photo xstr. When photo xstr turns on, it will divert current to ground and short out the current source, stopping all current. Q2 is wired as a silicon diode or you can use a 1N4148 or equivalent diode if you like. Q1, the 2n3904 is okay at the lower voltages of your power supply, but if the voltage across Q1 increases very much, it will overheat and burn up. If you have a bigger xstr, something in a TO-220, it should be fine and not overheat as your supply goes beyond 12V. There are many other ways of doing this, but this is simple.

8-Mar-2018, 18:19
If you are trying to minimize power consumption, remember the power the series resistor handles is wasted. 2n3904 is sort of a generic part and actual limits vary depending on who makes it and how accurate the specifications are. Upgrading to a higher power case such as to-220 or to-3 might be good. Rather then design something, I'd probably go buy a cheap power supply meant for driving LEDs. Ebay, Alibaba, etc.. if you don't mind waiting a few weeks for international shipping.The cheaper they are the probably more efficient so as to minimize heat sinks or power hungry parts.

Bernice Loui
9-Mar-2018, 10:54
Build this.. None of the previous circuits are going to do OK. They all have various problems.
This design can be easily expanded and modified as needed.

Power transistors are NPN, TIP-41 in TO-220 package.
Emitter reistors are 1/4watt or 1/2 watt 30.1 ohm or close to this value.
Diodes are 1N4448 or similar.
Diode resistor is 475 ohm or 470 ohm, 1/4watt or 1/2 watt.
1000uF, 25 volt electrolytic capacitor.

-Your LEDs that are to be driven at 20mA. More current source sections can be added as needed.
-Add about a 100 ohm base resistor to each TIP-41 if the current sources oscillates.
-Each current source leg can be individually programmed for their own individual current by adjusting the emitter resistor,

0.6 / current needed = resistor value. This is a good enough approximation as are the circuit values illustrated.

-There will be very slight downward current drift with increasing temperature, but do not think it is significant in the application.

15 to 20 Volt power supply big enough to power all this (500mA or larger)