# calculating correct transistor resistors

#### toekietoekie

Joined Jan 22, 2022
13
I only have a basic knowledge about electronics and need a little help with transistors.
For a project I need to drive 154 leds in 22 stings of 7. They would use a combined current of 440mA. Before every string is a resistor.
Now, what I need to achieve with the leds is to have two modes of operation.
1. I need them to automaticaly adjust to ambient light, they should be more dim when the room is darker. I want to do this with an LDR and a potentiometer for finetuning but I have no idea how I should choose the correct resistor values. I don't even know if that part of the circuit is correct, I just found it on the internet.
2. The second thing I would need them to do is to be able to mannually adjust them. I want to use a potentiometer for this and a resistor for a minimum value.
As far as i understand I can control how much current can flow trough the transistor by adjusting the voltage accross the base and the emitter. I think the voltage should be between 0,5V to "close" the transistor and 0,8V to fully "open" it? If this is correct how can I calculate the correct resistors with only the voltage?

#### dl324

Joined Mar 30, 2015
15,405
Welcome to AAC!
I need them to automaticaly adjust to ambient light, they should be more dim when the room is darker. I want to do this with an LDR and a potentiometer for finetuning but I have no idea how I should choose the correct resistor values. I don't even know if that part of the circuit is correct, I just found it on the internet.
This is not a good way to approach this problem. You should research using PWM to alter the on time for the LEDs.

#### ElectricSpidey

Joined Dec 2, 2017
2,177
The way you have it wired the two controls will interact with each other, is that what you wanted?

Personally, when using a pot to control LED brightness I would choose a follower configuration.

#### Audioguru again

Joined Oct 21, 2019
5,404
You cannot buy a 3.0V LED. White LEDs are 2.8V to 3.6V.
If they are all 2.8V then a string of seven uses 2.8V x 7= 19.6V. Your 150 ohms R2 will have 24V - 19.6V= 4.4V across it and have an LED current of 4.4V/150= 29.3mA which makes the LEDs extremely hot.
If the seven LEDs are all 3.6V then they need 3.6V x 7= 25.2V and will not light with the supply that is only 24V and even more voltage is needed for R2.

Your very simple circuit has nothing sensing the LED current or their brightness then the transistor will be very sensitive to temperature and cause the LEDs to get brighter as the transistor heats up.

#### AnalogKid

Joined Aug 1, 2013
10,169
As drawn, your circuit is critically dependent on the value of the transistor's gain. Unfortunately, this value wanders around all over the place with temperature, aging, and the value of the collector current.

I agree with ES, change to an emitter follower configuration (move the LEDs and resistor to the emitter leg). Now, changes in the transistor's gain will manifest as trivial changes in the base current. Also, R1 will have to move to the low side of the pot.

Redraw, repost, ans we'll go from there.

ak

Last edited:

#### toekietoekie

Joined Jan 22, 2022
13
Thanks for the feedback everyone!

Welcome to AAC!
This is not a good way to approach this problem. You should research using PWM to alter the on time for the LEDs.
I did think about using that but I don't think I know enough to actually use it. As far as I know I would have to start using microchips or things like controllers and seeing how I can't even design this circuit I don't see myself pulling that off.

The way you have it wired the two controls will interact with each other, is that what you wanted?

Personally, when using a pot to control LED brightness I would choose a follower configuration.
I added 2 diodes to fix that problem, I think that will work?
I also changed it to a follower.

You cannot buy a 3.0V LED. White LEDs are 2.8V to 3.6V.
If they are all 2.8V then a string of seven uses 2.8V x 7= 19.6V. Your 150 ohms R2 will have 24V - 19.6V= 4.4V across it and have an LED current of 4.4V/150= 29.3mA which makes the LEDs extremely hot.
If the seven LEDs are all 3.6V then they need 3.6V x 7= 25.2V and will not light with the supply that is only 24V and even more voltage is needed for R2.

Your very simple circuit has nothing sensing the LED current or their brightness then the transistor will be very sensitive to temperature and cause the LEDs to get brighter as the transistor heats up.
I was planning on using these leds: https://www.conrad.be/p/barthelme-led-assortiment-koud-wit-rond-3-mm-9000-mcd-30-20-ma-3-v-1692355
As far as I can see these do need 3V? Or am I wrong here? If so I can still change the resistors, I haven't ordered anything yet.

I wanted to use a transistor with a heatsink to stop it from heating up too much, would there be an easy way to have it react to it's own heat?

As drwn, your circuit is critically dependent on the value of the transistor's gain. Unfortunately, this value wanders around all over the place with temperature, aging, and the value of the collector current.

I agree with ES, change to an emitter follower configuration (move the LEDs and resistor to the emitter leg). Now, changes in the transistor's gain will manifest as trivial changes in the base current. Also, R1 will have to move to the low side of the pot.

Redraw, repost, ans we'll go from there.

ak
I changed it to a follower configuration. I also mover R1, I think that would be the correct position?

#### BobTPH

Joined Jun 5, 2013
6,035
If you want to switch between two methods of control, put the switch after the two voltage dividers, just before the base. And remove the diodes.

That said, PWM is still the far better solution. I think you will have a difficult time getting acceptable behavior with your approach. You

Bob

#### DickCappels

Joined Aug 21, 2008
9,495
Below is a pulse width modulated LED dimmer. The NE555 adjusts the duty cycle of the ON time of the transistor to vary the average brightness.

In your case instead of connecting NE555 pin 3 to an LED (through R3) you would connect it to the base of your switching transistor through R3.

You can switch between a light dependent resistor and a potentiometer connected as a rheostat to switch between automatic and manual dimming.

When the pulse on pin 3 is high the current Into the base through R3 should be about 10% of the peak current through the LEDs (peak collector current).

You will probably adjust the values of the components on pins 2,6, and 7 to adjust the brightness range for you light dependent resistor and optical design.

#### ElectricSpidey

Joined Dec 2, 2017
2,177
If you want to switch between two methods of control, put the switch after the two voltage dividers, just before the base. And remove the diodes.
You could also use a DPDT switch and not only switch the dividers at the base, but also save a little current and switch the power to the dividers.

#### dl324

Joined Mar 30, 2015
15,405
If you go the 555 timer route, this schematic might be easier to follow:

LED on time will be determined by R1 and C1 (the time it takes to charge C1 to 2/3 Vcc; off time will be determined by R2 (LDR) and C1 (time to discharge cap to 1/3 Vcc).

This circuit uses an opamp as a comparator so they could use one IC.

#### Attachments

• 76.1 KB Views: 1

#### Audioguru again

Joined Oct 21, 2019
5,404
Your new circuit does not have enough output voltage for seven white LEDs.

The LED you selected does not say its range of forward voltage like most other LED manufacturers say.
You did not select warm white (pink tint), pure white or cold white (blue tint).
Here is another LED manufacture who properly specifies its white LED forward voltage range from 2.8V to 3.6V:

#### Attachments

• 27.6 KB Views: 4
• 16.6 KB Views: 4

#### toekietoekie

Joined Jan 22, 2022
13
I switched to a pwm solution and used the second circuit as this was indeed easier to understand. I also changed the leds to use 3,6V, now its 26 strings of 6 leds with a resistor of 120 omh.
While I do understand how the circuit works I don't know how I can choose the correct components? I think I first have to figure out the range of the frequencies the leds should switch and then work from there to determine how fast the capacitor should charge? But how can I choose the correct frequency?
I found that everything from 100 Hz to 1 mHz should work but this seems like a really large range?
I also read somewhere that the constant charging and discharging of the capacitor can generate some noise, is this something I should be worried about or is one capacitor not enough to generate any sound?

#### ElectricSpidey

Joined Dec 2, 2017
2,177
From everything I have learned on the subject of LED PWM frequency 3k should be enough to avoid any health issues for just about everyone.

Oh, and don't use the follower config with this circuit, go back to the LEDs and resistor on the collector.

I know it seems like everybody is avoiding the component values, but you have to lock down the final circuit first and provide info on the LDR range.

Last edited:

#### k1ng 1337

Joined Sep 11, 2020
701
A microcontroller with PWM capability such as Arduino or Raspberry Pi Pico will simplify your goal in addition to providing precision and features you probably don't know exist. I started with analog circuits like yourself before I discovered and fell in love with microcontrollers. Even without a background in computer science, learning the code for what you want to do is pretty painless.

#### ElectricSpidey

Joined Dec 2, 2017
2,177
Yea, and after you do all of that...you still need enough electronics experience to actually light something up.

#### toekietoekie

Joined Jan 22, 2022
13
I don't want to start using microcontrollers yet because I first want to learn how to do it with just electronics. If that works I might try using them.
I have altered the circuit to place the leds after the transistor. Now I just need to calculate the right components.
As ElectricSpidey suggested i'm going to use 3000 Hz.
I would like to use this LDR: https://www.conrad.be/p/luna-optoel...-350-v-max-l-x-b-x-h-93-x-11-x-385-mm-1762903
In the dark it has a resistance of 1MOhm.
In the light it's between 12 and 58 kOhm.

I tried calculating the correct components according to a guide I found online. I don't know if they are correct.
For a frequency of 3000Hz I would have a period of 0,33ms.
In the light the leds should be bright so the duty cycle should be near 100%. This means the capacitor should be in it's charging state as much as possible and discharge very quickly.
The discharging time can be calculated with the formula T = 0,7 * Rldr * C1.
If I use a discharging time of 0,0000033s (1%) and a resistance of 12kOhm this would give me a capacitor of about 0,4nF.
R1 can then be calculated with T (99%) = 0,7 * (R1+Rldr)*C1. This would give me 139Omh for R1.
Would these calculations be correct or am i getting everything wrong?
Also thanks a lot for all the help!