Buongiorno a tutti quanti,
mi trovo a parlare ed a fare una domanda su un argomento di cui si è davvero molto parlato nel web; e vi chiedo scusa di questo, tuttavia, non sono in possesso delle conoscenza che mi permetterebbero di ricavare le migliori resistenze da applicare al progetto che vorrei realizzare:
seguendo progetti vari ho notato nella maggior parte dei casi (al di la della solita disposizione del catodo in comune su ciascun piano e dell'anodo in comune nei LED della stessa colonna verticale), l'impiego: (considerando un cubo 3x3x3) di 9 resistenze da 220 ohm, ognuna per ciascuna colonna verticale; e l'impiego di 3 resistenze da 22 K-ohm per ciascun piano, ciascuna collegata ad un transistor NPN. per poi collegare ciascuna terminazione ai pin di controllo ovviamente...
Phoed:
Thanks for the reply cyclegadget,
but in my case will be: (5V-3V) / 0.02A = 100 ohms?
I used 1.1v as an example. If your leds drop 3volts, then yes 100 ohms is correct.
and what is the reason for the 22k-ohm resistors connected to the transistors?
is it correct?
In this case, the transistor is an amplifier. The base requires a smaller current to control the collector to emitter circuit. The 22k-ohm resistor protects the base from over-current damage. Transistor - Wikipedia
That circuit calls for NPN transistors. BC237B are PNP so not suitable. It would be possible to redesign the circuit and modify the code to use PNP transistors, and then BC237B would be suitable.
Sorry, I made a mistake, I mistook BC237 for BC327. Unfortunately, BC237 is optimised for low currents, just like 2N3904. But as the current you are switching is only 60mA (3 * 20mA), it will be OK. I suggest you use base resistors no higher than 1K.
EDIT: I got it wrong again, the transistors need to switch 9 LEDs at a time, i.e. 9 * 20mA = 180mA. So BC237 is not suitable.
THANK YOU dc42,
now it is more clear, so if I want for example to have a plan with 12 leds, for that I could use a transistor that supports 12x20mA = 240mA;
then 2N2222A is ok for my experiece?
Collector current> 240mA
Vce(sat) above the current I want to switch
hfe > 50
4... ?
is it correct?
And what is the best resistance for the ground?
Phoed:
THANK YOU dc42,
now it is more clear, so if I want for example to have a plan with 12 leds, for that I could use a transistor that supports 12x20mA = 240mA;
Yes, 2N2222A meets the requirements - although BC337 is better because it has higher hfe and lower Vce(sat). ZTX851 is better still, but more expensive.
Phoed:
And what is the best resistance for the ground?
Please explain what you mean by "resistance for the ground".
If you mean the resistor connected between the base of the transistor and the Arduino pin, then 1K (giving base current around 4mA) is rather high given that you are switching 240mA. I would use 220 ohms (base current around 18mA).
To switch a transistor full on, you need to supply it with enough base current. You could calculate the base current by dividing the collector current by the hfe, however hfe is typically measured at Vce = 10V, whereas we want Vce (the collector-to-emitter voltage) to be well under 1V when we turn the transistor on. So you need more base current than the value implied by the hfe. A guide is to look at the conditions under which Vce(sat) was measured, given on the datasheet. For the 2N2222A, Vce(sat) is measured with Ib = 0.1 * Ic. So to will achieve the manufacturer's Vce(sat) figure, we need to supply a base current of 0.1 times the collector current, which is 24mA in this case. In practice, we can usually tolerate a slightly higher voltage drop than the Vce(sat) figure given in the datasheet, so a slightly lower base current will do.
I will use the transistor you suggested (BC337 or ZTX851) for the next "cube", because I was lucky enough to find six 2N2222A from my grandfather...
now at last I understand a little 'more about the transistor, but... I hope it's last question... how to connect?
Arduino_Pin --> base of the transistor --> 220 Ohm resistor --> plane of the cube with 12 Leds
Vss --> emitter of the transistor
Vdd--> Collector of the transistor?
........or something is missing?????
I apologize but these things I've never seen