NodeMCU RGB LED | for Beginners

2,254

1

2

Introduction: NodeMCU RGB LED | for Beginners

In this Tutorial i will show you what is RGB Led and how it is work An RGB LED is a combination of 3 LEDs RED, GREEN and BLUE. These three colors Red, green and blue can make any color. By varying supplied voltage to RGB LEDs different colors are formed.

An RGB LED has 4 pin interfaces. 3 Pins are for Red, Blue and Green. There is a common pins for all three LEDsAn RGB LED can be two types-Common Anode:-Anode (+) pin is common.Common Cathode:- (Cathode-/GND) pin is common.

Hardware required

  1. NodeMCU
  2. Breadboard
  3. RGB LED
  4. Resistor 1k
  5. Jumper Male to male

Step 1: Schematic of Circuit

Step 2: Layout of Circuit

Step 3: Programming:

// Mechatronicslabrpi.blogspot.com Tutorial

// Hardware: NodeMCU

int RED = 5;

int GREEN = 4;

int BLUE = 0;

void setup() {

pinMode(RED, OUTPUT);

pinMode(GREEN, OUTPUT);

pinMode(BLUE, OUTPUT);

}

void loop() {

digitalWrite(RED,HIGH);

digitalWrite(GREEN,LOW);

digitalWrite(BLUE,LOW);

delay (1000);

digitalWrite(RED,LOW);

digitalWrite(GREEN,HIGH);

digitalWrite(BLUE,LOW);

delay (1000);

digitalWrite(RED,LOW);

digitalWrite(GREEN,LOW);

digitalWrite(BLUE,HIGH);

delay (1000);

}

Free download full file click here

Step 4: Video

Be the First to Share

    Recommendations

    • Make it Glow Contest

      Make it Glow Contest
    • First Time Author Contest

      First Time Author Contest
    • PCB Challenge

      PCB Challenge

    2 Discussions

    0
    punund
    punund

    7 months ago on Step 1

    Where does resistor go?

    0
    daveharnett
    daveharnett

    Reply 7 months ago

    If you are using a single resistor, put it on the the common pin. If it's a common anode, put it between 3.3v and the LED's +. If it's a common cathode, put it between ground and the LED's -.

    It seems to be better practice to use three resistors, one for each of the R,G,and B channels https://www.allaboutcircuits.com/technical-articles/led-arrays-one-resistor-or-many/ . Otherwise, the colour with the lowest current drop will tend to "eat" most of the current and make mixed colours inconsistent.