You are on page 1of 4

Laboratory Exercise No.

3 – RGB LED Lights


Circuit: An Application of Analog Signal and PWM
Ma. Clarisssa B. Asid
Bachelor of Science in Geodetic Engineering
Visayas State University
Baybay City, Philippines
8clarissaasid@gmail.com

Abstract— RGB LED lights Circuit is an activity that shows int redPin = 11;
different colors that starts with red, green, blue and such that is int greenPin = 10;
commonly used for different applications like designing and etc. int bluePin = 9;
void setup()
Keywords—Arduino UNO R3, Arduino code, RGB LED,,
Arduino Software IDE {
pinMode(redPin, OUTPUT);
I. INTRODUCTION pinMode(greenPin, OUTPUT);
RGB LED has the function that can light up the red, inMode(bluePin, OUTPUT);
green, and blue using one LED only. It does not only produce }
one color but other color as well. It has four legs or terminals. void loop()
The most common application for this type of circuit are for {
home decorations, stage designing and other applications. setColor(255, 0, 0); // red
delay(1000);
II. OBJECTIVES setColor(0, 255, 0); //green
delay(1000);
A. Objectives setColor(0, 0, 255); // blue
- Use analog signals to control RGB LED in an delay(1000);
Arduino UNO R3 board; setColor(255, 255, 0); // yellow
- Utilize the analogwrite() programming command delay(1000);
to adjust color of RGB LED; and setColor(80, 0, 80); // purple
- Discuss about PWM, signal configuration control delay(1000);
that adjust the output value that an Arduino pin setColor(255, 255, 255); // white
produces. delay(1000);
B. Scope and Limitation } // create a new programming “Function” called setColor
void setColor(int red, int green, int blue)
The laboratory will answer the question on how the {
process will be done with the limiting knowledge regarding analogWrite(redPin, red);
to it. Various research could be done for further analogWrite(greenPin, green);
understanding. analogWrite(bluePin, blue);
III. METHODOLOGY }

A. Materials IV. RESULTS AND DISCUSSIONS


 1 Arduino UNO R3 By following all the procedures, write some discussions of
the following:
 1 USB Cables
1. Explain the functions of each devices/components.
 1 RGB LED
- Arduino UNO R3 is the device that is connected
 Breadboard to the computer using USB Cable. It is also the
main device that connects the computer with
 3 330 ohms resistor Arduino software to the connecting wires and
 Connecting wires LED. USB Cable connects the computer to
Arduino UNO R3. RGB LED where the
 Computer with Arduino Sofware different light will show. 330 ohms resistor use
B. Circuit Diagram to connect the connecting wires with both ends
along with LED. Connecting wires connects the
wires to the digital pin number chosen and the
C. Code GND pin. Lastly, the arduino software where the
code will be inputted and to be uploaded to the
/* UNO.
RGB LED Lights Circuit: An Application of Analog Inputs
and PWM 2. Problems encountered and how did you solve it.
*/
GEng 132n – Electrical and Electronics Engineering for Geodetic Engineers
2nd Semester SY 2020-2021
Instructor: Engr. Philip Caesar L. Ebit
- There was no problem doing the laboratory REFERENCES
since it is understandable. Aimtec. (2011). Aimtec. Retrieved from Pulse Width
3. Answers in the Post Lab Questions. Modulation (PWM) vs. Analog Dimming of LEDs:
http://www.aimtec.com/site/Aimtec/files/document
1. Try changing the “delay” value in your
s/ApplicationNotes/pwm%20vs%20analog%20dim
code, what happens as you increase or
decrease the value? ming%20of%20leds

- increasing the delay value means that the time of


transition for every color is slower to blink and
if we decrease the value means that the transition
will be much faster (Figure 1).\
2. Let’s try using a different PWM pin of the
Arduino, pins with (~) markings. Move the
wire from the PWM pins, what pins did you
use? What happens if you don’t use a non-
PWM pin?
- I tried using the different PWM pin and I use the
~6,~5, and ~3 for red, green, and blue
connecting wires respectively. Even though I
change the pins there are changes happened. If I
did not use a non-PWM pin, I observed that the
sequence of colors is different, there are new
colors like light blue, and the blink stop between
a whole loop and go on again (Figure 2).
3. Go and try different function name, change
the setColor() name or add new code
function to change and set the RGB Color
that you like. What have you observed?
- I change the blue function name to pink and I
observed that even though I change the different
function name the color that blinks is still blue .
4. What are your learning experiences in this
laboratory exercise?
- I learned about the PWM or Pulse-width
modulation that it helps to constantly turn on and
off the current of the circuit and with it also
control the power by just limiting it into 50 %
instead of full power voltage.
V. CONCLUSIONS AND RECOMMENDATIONS
Therefore, using analog signal differs in using the
PWM in creating a loop for RGB LED light circuit. It differs
in terms of brightness, the shifting of color, electrical
efficiency, in rush problems and etc (Aimtec, 2011). PWM is
about making the RGB LED turn on and off with a specific
time depends what is written on the code. The brightness can
be adjusted, it has electrical efficiency, color effects, and etc.
In addition students were able to perform the laboratory and
fully understand the function of PWM pins and Analog pins
for RGB LED light circuit.
VI. ACKNOWLEDGMENT
I would like to thank our Almighty God for all the
blessing and good health received.
I want to extend my gratitude to all of my instructors
and my classmates for doing their best everyday amidst of
problems that we are facing.
Also, I would like to thank my family and friends
for the everyday support and lastly myself for getting up and
trying her best every day.

GEng 132n – Electrical and Electronics Engineering for Geodetic Engineers


2nd Semester SY 2020-2021
Instructor: Engr. Philip Caesar L. Ebit
Figure 1. Changing the Delay value

Figure2. Using different PWM pin

GEng 132n – Electrical and Electronics Engineering for Geodetic Engineers


2nd Semester SY 2020-2021
Instructor: Engr. Philip Caesar L. Ebit
GEng 132n – Electrical and Electronics Engineering for Geodetic Engineers
2nd Semester SY 2020-2021
Instructor: Engr. Philip Caesar L. Ebit

You might also like