12v RGB LED with Arduino

12v RGB LED with Arduino © GPL3+

Program a 12v RGB LED strip with Arduino and how to make different color combinations and fading animations.

  • 1,744 views
  • 1 comment
  • 17 respects

Components and supplies

Necessary tools and machines

Apps and online services

About this project

Introduction

In this tutorial, we are going to learn about how to connect a 12v RGB LED strip with Arduino and how to program to make different color combinations and fading animations.

Pin Out – TIP120

You can use any NPN transistors like TIP120, TIP121, TIP122 of N-Channel MOSFETs like IRF540, IRF 530, based on your application you can change the transistors. the difference is that they have a different collector-emitter current rating. For example, if you are using a large length of RGB LED strip then to drive them you will be needing high current transistors like IRF540 which have Drain Current (Id): 28 Amps. Or if you need only a few LEDs then you can use any other NPN transistors like TIP120 which have Collector Current of 5 Amps continuous and 8 Amps peak

In this tutorial, I am using TIP120 and the pinout diagram is shown below. You can download the datasheet from here.

Circuit

  • Connect the emitter of all the transistors to the Ground of Arduino.
  • Connect the Ground of 12V power supply to the Ground of Arduino.
  • Connect the positive terminal of 12V power supply to the 12V pin of RGB LED strip.
  • Connect 1 K resistor to the base of the each transistors as shown.
  • Connect wires form the digital pins D9, D10, D11 to the other end of the resistors as shown in the circuit diagram.
  • Finally connect wires from the R, G and B terminals of the RGB LED strip to the collector (middle pin) if the TIP120 transistors as shown.

Complete Video Tutorial

Subscribe and support

Code

Color Changing ProgramC/C++
//www.diyusthad.com
//www.youtube.com/c/diyusthad

#define red 9
#define green 10
#define blue 11
int t = 500;

void setup()
{

}

void loop()
{
  analogWrite(red, 255);
  delay(t);
  analogWrite(green, 255);
  delay(t);
  analogWrite(blue, 255);
  delay(t);
  analogWrite(red, 0);
  delay(t);
  analogWrite(green, 0);
  delay(t);
}
Fading ProgramC/C++
//www.diyusthad.com
//www.youtube.com/c/diyusthad

#define red 9
#define green 10
#define blue 11
int brightness;
int fadeAmount = 5;

void setup()
{

}

void loop()
{

  analogWrite(red, brightness); //writing brightness value to red
  analogWrite(green, brightness); //writing brightness value to green

  brightness += fadeamount; //increasing brightness value by 5 in each loop

  if (brightness < 0 || brightness > 255 )
  {
    fadeAmount = -fadeAmount; //reversing the direction of fading when brightness reachs 0 or 255
  }
  delay(30); //delaying the speed of fading 
}

Schematics

Circuit
Uploads2ftmp2fd91418e0 6cc8 439c a8bd 0ee57d5a05b22fscreenshot2019 08 17at10 12 28pm vfehcrwpcj

Comments

Similar projects you might like

LED Emergency Lights using WS2812 RGB LED Module

Project tutorial by bigboystoys13

  • 13,118 views
  • 7 comments
  • 30 respects

How to Use an RGB LED

by MisterBotBreak

  • 5,113 views
  • 0 comments
  • 20 respects

Not Your Typical RGB LED

by Alexander Vaughn

  • 2,645 views
  • 1 comment
  • 11 respects

RGB LED Snowflake with Arduino Uno

Project in progress by James Cameron

  • 4,738 views
  • 5 comments
  • 26 respects

Kids RGB LED Star Nightlight

Project tutorial by Unexpected Maker

  • 2,662 views
  • 1 comment
  • 14 respects
Add projectSign up / Login