0

I bought this 4 digit led display

enter image description here

I'm looking at this tutorial and I don't understand why he used such big resistor for his circuit.

Excerpt:

Please note that the pinouts of LED displays vary greatly (always check your datasheets). To simplify the programming, segments A through G are wired to GPIO pins 10 to 16 in series with appropriate resistors. I start with 750Ω resistors, then lower the resistance to get the correct brightness being careful not to exceed the Pi’s 50mA limit. 220Ω resistors provide good brightness and only use 12.8mA. The common cathodes are controlled by 2 NTE2361 high speed NPN transistors connected to GPIO pins 20 and 21. You could omit the transistors and connect the common cathodes directly GPIO pins 20 and 21 as long as the total current does not exceed 16mA. You would also have to swap the start times of the pulses because the pulses would be driving the cathodes high

enter image description here

It says in the 4 digit LED schematics that the led has the forward current If = 20mA and the forward voltage of Fv = 2.5 V. If I want to hook it to my RPI GPIO pins, I know that the max current that a GPIO pin is 50mA (correct me if I'm wrong) and DC of 3.3V. If I do the ohms low I get from (3.3V - 2.5V) / 0.02 A = 40 Ω.

So in my opinion I should use 40 Ω for the anode pins of the LED . Why he used 220Ω ? Why he chosen that specific transistor? And Why he added to that transistor a 4,7k Ω resistor ? I know the transistor has a collector, emitter and a base. To open the connection on a NPN transistor you need to apply some voltage through the Base. I need to hook up the emitter to ground and the collector to the cathode of the 4 digit led component.

I know I should probably use a NPN transistor but would it matter if I use a PNP instead? I understand that the circuit changes, active high instead of active low, but are there any drawbacks to PNP over NPN?

Please correct me and explain what physics theorem I should use in order to compute and know exactly what I need in order to make this project possible.

SDsolar
  • 2,208
  • 8
  • 24
  • 42
hoenir
  • 1
  • 1
  • 1
    You are asking for someone to teach you basic electronics. That is not really the point of this site. There are plenty of tutorial sites just a google away. – joan Jul 26 '17 at 11:40
  • 99% of questions on this site are solely linux related, so see this as a welcome refreshment – mystery Jul 26 '17 at 12:31

3 Answers3

2

Most of this is off topic. The safe maximum current from a GPIO pin is 16mA

Milliways
  • 54,718
  • 26
  • 92
  • 182
1

First of all, you had some basic concept wrong. When an LED is on, the voltage between the anode and the cathode of the LED is minimum, only about 0.5-0.7v. This is why the tutorial said that the 200ohms give a readout of 12.8mA. (3.3-0.5)v/220ohm is about 12.7mA.

What kind of transistor to be used depend on the logic of the circuit that you need and how you design your circuitry. In this case, The LED has a common cathode connection, and it need to be driven to GROUND (0v) when a signal (a positive voltage) is applied at the base of the transistor so that the transistor can be 'switch on' (i.e. the resistance between collector and emitter are minimum), therefore NPN make sense for this application.

hcheung
  • 805
  • 6
  • 13
1

20mA == 0.02 A. not 0.2 ... so you would get 400 ohms, not 40 ...

Also, I don't believe you can get 50mA from a (single) Pi i/o pin == last I looked it was more like 5mA..

user70886
  • 31
  • 1