Find all your DIY electronics in the MakerShed. 3D Printing, Kits, Arduino, Raspberry Pi, Books & more!

Make: Projects

Arduino + 4 pin 5mm Full-Color LED

Play around with a Full-Color 5mm LED with four pins (3 cathodes which are RGB, and 1 anode) and an Arduino.

Steps

Step #1: Schematic

PrevNext
Arduino + 4 pin 5mm Full-Color LED
  • This circuit uses an Arduino UNO but it still works on an Arduino MEGA 2560.
  • In this project we only use one 5mm LED, but since the LED has four pins, I used three LED symbols in place of the four-pin LED. The three cathodes of the LEDs in the schematic are the three cathodes on the Full-Color 5mm LED. The three anodes of the LEDs are the one anode on the Full-Color 5mm LED.

Step #2:

PrevNext
Arduino + 4 pin 5mm Full-Color LEDArduino + 4 pin 5mm Full-Color LEDArduino + 4 pin 5mm Full-Color LED
  • Remember, the longest pin of the LED is the anode, the other three short pins are the cathodes (RGB)
  • Also, while the flat side of the transistor is facing you, the left pin is the collector, the middle is the base, and the right pin is the emitter.
  • The photo notes the 2N2222 transistor. For the 2N3904 and 2N4401, the Collector and Emitter are switched.

Step #3: Circuit Assembly

PrevNext
Arduino + 4 pin 5mm Full-Color LEDArduino + 4 pin 5mm Full-Color LEDArduino + 4 pin 5mm Full-Color LEDArduino + 4 pin 5mm Full-Color LED
  • Connect the LED to the breadboard.
  • Connect the anode of the LED to the other half of the breadboard.
  • Connect the cathode (frist pin) to the other side of the breadboard.

Step #4: LED to Transistor

PrevNext
Arduino + 4 pin 5mm Full-Color LEDArduino + 4 pin 5mm Full-Color LEDArduino + 4 pin 5mm Full-Color LEDArduino + 4 pin 5mm Full-Color LED
  • Connect the collector of one transistor to the first cathode of the LED.
  • Connect the other transistors as shown in the image. Connect the collector of the second transistor to the second cathode of the LED.
  • Connect the collector of the third transistor to the third cathode of the LED.
  • I'm using the 2N2222 transistor, so in my case the transistor faces my direction. If the 2N3904 or 2N4401 transistor are used, the transistor will face the opposite direction.

Step #5: Transistor to Resistor

PrevNext
Arduino + 4 pin 5mm Full-Color LEDArduino + 4 pin 5mm Full-Color LEDArduino + 4 pin 5mm Full-Color LEDArduino + 4 pin 5mm Full-Color LED
  • Connect one resistor to the base of the third transistor.
  • Connect the second resistor to the base of the second transistor.
  • Connect the third resistor to the base of the first transistor.

Step #6: Transistor to Ground

PrevNext
Arduino + 4 pin 5mm Full-Color LED

Connect the emitter of all three transistors to ground.

Step #7: Resistor to Arduino

PrevNext
Arduino + 4 pin 5mm Full-Color LEDArduino + 4 pin 5mm Full-Color LEDArduino + 4 pin 5mm Full-Color LEDArduino + 4 pin 5mm Full-Color LED
  • Connect the resistor from the third transistor to pin 9 on the Arduino.
  • Connect the resistor from the second transistor to pin 10 on the Arduino.
  • Connect the resistor from the first transistor to pin 11 on the Arduino.

Step #8: Ground and LED anode to Arduino

PrevNext
Arduino + 4 pin 5mm Full-Color LEDArduino + 4 pin 5mm Full-Color LEDArduino + 4 pin 5mm Full-Color LED
  • Connect the anode of the LED to pin 12 on the Arduino.
  • Connect ground from the Arduino to the ground strip of the breadboard.

Step #9: Arduino Program

PrevNext
Arduino + 4 pin 5mm Full-Color LEDArduino + 4 pin 5mm Full-Color LEDArduino + 4 pin 5mm Full-Color LEDArduino + 4 pin 5mm Full-Color LED
  • Connect your Arduino to your computer (running Windows, OSX, Linux).
  • Open the Arduino program and upload the Arduino code within the following images.

Step #10: Arduino Serial Monitor Testing

PrevNext
Arduino + 4 pin 5mm Full-Color LED
  • After uploading the code, open the serial monitor and input a character from 1 - 8.
  • 1 = RED, 2 = GREEN, 3 = BLUE
  • The LED only has three pins for RGB (Red, Green, Blue), but turning on more then one pin creates diverse colors.
  • 4 = PURPLE, 5 = AQUA, 6 = ORANGE, 7 = BRIGHT WHITISH PURPLE
  • 8 = OFF

Step #11: RGB colors

PrevNext
Arduino + 4 pin 5mm Full-Color LEDArduino + 4 pin 5mm Full-Color LEDArduino + 4 pin 5mm Full-Color LEDArduino + 4 pin 5mm Full-Color LED

Normal RGB light settings.

Step #12: RB, GB, and RG colors

PrevNext
Arduino + 4 pin 5mm Full-Color LEDArduino + 4 pin 5mm Full-Color LEDArduino + 4 pin 5mm Full-Color LEDArduino + 4 pin 5mm Full-Color LED

Other RGB settings. RB, GB, or RG.

Step #13: LED all on or off

PrevNext
Arduino + 4 pin 5mm Full-Color LEDArduino + 4 pin 5mm Full-Color LEDArduino + 4 pin 5mm Full-Color LED

All RGB cathodes on or off.


blog comments powered by Disqus

Featured Products from the MakerShed