0

In my NodeMCU I want a statement to turn on an LED, which is easy, just use pinnumber, HIGH. But, what I'm trying to do here is connect multiple LEDs to one pin like this:Diagram showing multiple LEDs on a breadboard using a single current limiting resistor.

I just wanted to know if this will work and whether all the LEDs will turn on by one command write (pinnumber, high) or do I have to do something else to this circuit? Please help I'm a noob to electronics.

And also, is the resistor correct(1k ohm) or is it 220ohm, because different places suggest different things.

3

No! Most likely it will not work.

An LED lights up if the Voltage between the Anode (one side of the LED) and cathode (the other leg) exceeds a so called forward voltage (Vf).

This Vf depends on the creation process and differs between different colors. Vf can be between abt. 1.8 Volt (red LEDs) and abt. 4.2 Volt (blue LEDs). Even if the LEDs would have the same color, they might have different forward voltages. If you arrage 4 LEDs in parallel, like you did above, the Voltage over the 4 LEDS is as low as the Vf of the LED with the lowest Vf among the four. If the four LED would not have equal (Vf)s, only one LED will light up and all others stay dark or just glow a little bit.

The sum of the current that flows through the 4 LEDs must also flow through the resistor. So the resistor must let pass 4 times the current that is required for one LED. An normal 3mm or 5mm LED works best at about 10mA to 20mA. Let's say the LEDs have all the same Vf = abt. 2 Volts, and you choose to drive them with 15 mA. You need 60 mA in sum for the 4 LEDs, that must pass the resistor. You can compute the required resistance with Ohms law. R = U / I.

  • R is the resistance in Ohms.

  • U is the voltage over the resistor in Volts.

  • I is the current through the resistor in Ampere.

    U = Voltage of the ESP (3.3 Volt) minus the lowest forward voltage of the LEDs (2 Volt) I = the wanted current 60mA = 0.06 Ampere

    R = (3.3-2) / 0.06 = 140 / 6 = abt. 23 Ohm (27 Ohm resistors should be available.)

The resistor depends on the Voltage of the ESP, the kind of the LED and the amount of current you need to reliably light up the LEDs. You can not just take values from schematics or discussions the internet. Also 60 mA is very much current for the ESP pin. That might be a problem.

The best way the Light up 4 LEDs from one pin would be to use one resistor for each LED and a MOS FET Transistor that is connected to 5 Volts with its Drain pin, the parallel LED resistor pairs with its Source and to the ESP pin with its Gate. You should also be sure that the MOS FET you use is able to switch with a 3.3 V voltage from the ESP on its Gate.

If you did not understand what I have written, I advice you to learn the basics before experimenting further. The values above are all useless if the conditions change.

0

Yes, technically your circuit works. But don't do like this.

TLDR;

This applies only to what you are doing

  1. LED is current device. We control brightness by control current flow through it.
  2. Each IO pin (of ESP8266) has current drive capable (source/sink) 12mA only, so calculate it wisely or you risk killing it.
  3. Simplest way to control current of LED is using current limiter or just a resistor in series
  4. Voltage drop across red LED (Vf) is 1.8v
  5. 4 LEDs in parallel work just like 1 LED, assuming the same kind, but of course 4 times dimmer
  6. Current goes through each LED = 1/4 of current goes through resistor (kirchhoff law of current)
  7. Equation: 3v3 = 1.8v + V_R hence , V_R = 1.5v
  8. Current goes through resistor I_R = V_R / R
  9. 5mm LED has nominal current of 20mA to be considered brightest that last VERY long time.
  10. BUT ESP8266 can only do 12mA. You go 20mA, ESP8266 goes bye bye.
  11. So choose 10mA to be on safe side. Plug 10mA into #8, hence R = 1.5v / 10mA = 150 ohm
  12. You can choose resistor value from 220R up to 1K, no problem. Higher resistance, less current.
  13. You can do rough calculation, ignore voltage drop across LED, just use 3v3 / 10mA = 330R. Hence you will see people usually use resistor 330 ohm regardless 3v3 or 5v, red LED or green LED. Because at 5v it is 15mA, red or green makes only 0.3mA different. Nothing to worry.
  14. But your circuit has 4 LEDs in parallel, hence current through each LED = 10mA/4 = 2.5mA
  15. Fact: Even as low as 0.15mA (R=10k with 3v3 power supply), RED and GREEN LEDs are still bright enough for indication.

Note:

  • My guess is, you are using LEDs like a torch. More LEDs = more brightness, right? Unfortunately, it won't work like that. You want to use transistor (BJT) or mosfet as a switch to turn on power supply for LED instead of driving LED from IO pin. Google high side switch or low side switch for that matter. Better solution is to use LED driver IC.
  • Normally for simple indicator, I just whack a 470R resistor in series of a LED regardless voltage to drive it (5v or 3v3). It still gives quite intense brightness when you stare directly on it. Sometime you want to use 1k ohm just to reduce the brightness further or even sanding the LED from crystal clear into translucent white.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.