So you're a Noob? Post your questions here until you graduate! Don't be shy.

User avatar
By Loisaida Sam
#79442 Hello!

I've got this traffic light thing happening using a Node MCU and three LEDs.

IMG_20181109_165158.jpg


Specifically, I'm using three digital GPIO pins, each hooked up to a resistor, and then an LED, and then to ground.

Here are the specs on the LEDs from the bag they came in:

IMG_20181206_154849.jpg


I'm wondering what kind of resistor(s) I need to do this efficiently/properly. Maybe I can use that Ohm's Law thing somehow?

I currently have them wired up using 330Ω resistors that I found in another bag. No idea if that's cool, but nothing has exploded, so maybe it is?

Bonus question, does it affect anything to have fewer or more LEDs hooked up like this. Like if I had the same setup with eight LEDs, is it any different (resistor-wise) than if I use the three I currently have hooked up?

Bonus bonus question - is it dumb to solder resistors right onto jumper cables or should I really be using something like a perf board?

Thanks in advance, I have no idea what I'm doing

-Sam
You do not have the required permissions to view the files attached to this post.
User avatar
By btidey
#79448 Ohms law and knowledge of how much voltage is dropped across a LED will help you here.

1. O/P voltage from Node MCU Pin when high = 3.3V
2. LED voltage drop (Vf) varies according to colour and a bit with current. Typically at 5mA red/yellow = 1.4V, green/blue =2.5V
3. The current is then determined by the the resistor using Ohms law. Current = (3.3 -Vf) / R

So with your 330 resistor you would get

Red/ yellow = (3.3 - 1.4) / 330 = 5.6mA
Green/ blue = (3.3 - 2.5) / 330 = 2.4mA

The current will determine how bright the LED is. 1 to 10mA is the typical current used but you should aim to use less than 9mA to avoid overloading the GPIO pin driving the LED.

If you drive multiple LEDs from GPIO pins then you should aim to have less than 40mA total. So with 8 LEDs you want less than 5mA per LED.

Soldering jumper lead onto resistors will work but using a perf board is good if you have multiple LEDS as it will help line them up.