# Calculating the resistance for the base of a transistor

I'm building a circuit for my little niece's birthday (I'm already overdue with a couple of days). I started building it before I well understood enough about transistors and no I'm running a little out of time.

The whole project (it's actually a small city, build with recycled parts, in which I placed a lot of LEDS) is nearly finished, what's left are putting the resistors R10 - R19 in place. If somebody could take a look at the picture and tell me how I should calculate the value of these resistors ?

Also, Can I power the arduino (5v) with the same power source (12v) using only resistors, or should I use a step down convertor (or build one) ?

I think I'm going to choose this adapter instead of the one I was previously talking about. It was previously used for a USB Hard disk and supplies both 12v and 5v. It probably has a regulator built-in ? How do I know ?

• Just a few things so that people can help you better, what is your 12v source? Is it a 12v DC regulator with constant 12v output or is it a transformer and rectifier(which will only have 12v at rated load)? If you are not using current regulation to control the LEDs, you should add an inline resistor to the third blue chain, which has none.
– K H
Oct 4, 2018 at 1:15
• It is difficult to tell the current draw of a processor from moment to moment. So you should use a 5 volt regulator. These are very common. Please re-read your title and then the body of your question. I think you forgot to ask about how to find the value of, for example, R19 in your schematic. Oct 4, 2018 at 1:16
• @K H How do I know that ? Can I check this with a multimeter, somehow ? I suppose the second, the power source was previously used to power a Internet Router. Secondly, would adding a 10 Ohm resistor to the chain suffice ? Oct 4, 2018 at 1:20
• @st2000 Sorry, I didn't understand your remark regarding the title and the body. I'm having the impression that I am asking how to calculate the resistance for R10 to R19 ? Oct 4, 2018 at 1:26
• You can find out by metering, by taking it apart. It can be kind of tricky for a novice. You could add a picture of the device or a datasheet to your post so we can make the best possible guess. Basically it will affect the input voltage rating you need for the DC supply for your arduino.
– K H
Oct 4, 2018 at 1:27

Any serious processing device like an arduino should be provided with as stable a voltage as you can provide it, so resistive regulation will likely not be adequate. I'd recommend a 5v DC switching regulator rated for 2A(although someone who uses arduinos may have a better reccomendation) as long as your 12V supply can support both it and the LEDs. That way you can keep the 120V entirely away from the childrens toy. If you have a multimeter, it would be wise to meter the no load output of your 12V supply. Once you've confirmed your 12V supply is good for it, you can look for a "2A 5V switching regulator" and now that you know your min and max voltage, you can find a regulator that is good over that voltage range.

As far as sizing all of those resistors, you have two types of resistors to size. The ones in series with the LEDs prevent thermal runaway when current regulation is not being used. You can look up or check the LED's rated voltage at the current you want to flow, and then you can size based on the following principle:

$$\12V = V_{LED}+I_{LED}*R\$$

Plug in the values and solve for R. So if you had an LED rated for 2.4V@15mA,

$$\12V = 2.4V+15mA*R\$$

$$\9.6V = .015A*R\$$

$$\R = 640\Omega\$$

As for your transistor base resistors, if you know the gain of your transistor, divide the current you want to flow by the gain and you will have your desired base current. Then solve $$\R = E/I\$$, where E is the gate voltage and I is the gate current, to find the value of the needed resistor.

There is probably a better way to do this, but this is simple and has been adequate for me. If you have a potentiometer or other variable resistor, you can also attach it to the base where the base resistor would be, vary it to an acceptable current, then detach it, meter it and replace it with the next larger size resistor available.

• With regards to the Arduino, the on board voltage regular (Vin or barrel connector) should be given 7-12V. The USB/5V ports assume a stable 5V and are unregulated. It's only rated for 200ma nominally (500ma max). 7-9V @1-2A power supply or a 1A USB adapter is ideal. Oct 4, 2018 at 3:39
• "serious processing device ... arduino". LoL. Oct 4, 2018 at 11:33
• @Olin Lol. I meant more a device that is dedicated to processing than a supercomputer. I thought of saying cpu or microcontroller but wanted something that would suit fpgas or other things. Maybe not the best phrasing.
– K H
Oct 4, 2018 at 11:43
• Are you saying that I should use the largest possible value for the resistors between the Arduino pins and the base (i.e R19) that will still turn the LED all the way up ? I'm testing this with a simple arduino-loop providing 0-5V on the PWM Pin, but with either 2k, 10k, or 20k I don't seem to notice a lot of difference. I will try with bigger vlaues still Oct 4, 2018 at 15:17
• @oneindelijk that's more or less correct. A transistor multiplies the current that comes in on its base by its gain up to the point it's all the way on, but there is no need for the base to experience more current than is necessary to turn it all the way on. If you want you can try some resistor values in between 50 and 100k, but 50k keeps the base current to 5v/50000=100uA, which is low enough. In total the LED part of your project should use about (10 channels*12V*.015A=1.8W)
– K H
Oct 4, 2018 at 23:17