Controlling RGB LED Using Arduino
by Phantom Electronics in Circuits > Arduino
299 Views, 1 Favorites, 0 Comments
Controlling RGB LED Using Arduino
In this tutorial I will be demonstrating how to control RGB LED using the arduino uno microcontroller board. I will be explaining step-by-step on how this beginner level project works using equations, a circuit diagram, and an oscilloscope.
Supplies
Components used:
1. Arduino uno
2. RGB LED
3. 220-ohm resistor x3
4. Connecting wires
5. Breadboard
6. Oscilloscope (optional)
Introduction
In order to fully understand how this project works I must first explain how an LED functions and elaborate the importance of a duty cycle.
An LED like any other electronic component has a forward voltage value and current value. In other words, in order to successfully turn on a Red LED you need to supply the component with a minimum voltage of 1.63V and minimum current of 2mA. The same rule applies for the green LED and blue LED but the forward voltage and current LED is different. Please refer to the table below that clearly displays forward voltage and LED current for the red, green and Blue LED.
Red LED
Forward voltage (Vf): 1.63-2.0V
LED current (Iled): 1.6-2.0mA
Green LED
Forward voltage (Vf): 1.9-4.0V
LED current (Iled): 1.9-4.0mA
Blue LED
Forward voltage (Vf): 2.48-3.7V
LED current (Iled): 2.5-3.7mA
Next, we will be calculating the current limiting resistor for each LED pin. By default, you can choose 220-ohm resistor for each LED pin and the circuit will function normal but if your goal is to build a project with accuracy and precision, it is recommended to use equations, a multimeter and an oscilloscope to build the circuit. For the purpose of this beginner level tutorial, I’ve used the default 220 ohm to make things easier for you, but I recommend building the circuit according to specifications and I’ll show you how. The equation used to calculate each resistor for LED pins goes as follows:
R=(Vs-Vf) / Iled
Vs = Supply voltage which is 5V
Vf and Iled values can be found above.
R is the current limiting resistor value for LED pin measured in ohms.
So, for this tutorial I have used pulse width modulation (PWM) which is located in the Arduino uno board in order to create a variety of colours using RGB LED. The program which is uploaded to Arduino uno will be responsible for manipulating the RGB LED duty cycle.
A duty cycle is extremely useful especially to those who want to see the behaviour of a circuit in waveforms and to understand how it functions. In order to see and understand the RGB LED project, I have used an oscilloscope called Yeapook ADS1013D Handheld digital oscilloscope. This oscilloscope is extremely useful and convenient because it is small, cheap and works efficiently.
Yeapook ADS1013D Handheld digital oscilloscope:
Oscilloscope
Duty Cycle
Schematic Diagram
Arduino Code
Youtube video link: https://youtu.be/eaHDQwVToX8