You are on page 1of 16

MECHATRONICS

ME156P-2/E01 ONLINE EXPERIMENT NO. 3

ONLINE Experiment TITLE :

Color Mixing Lamp

STUDENT NAME: Macabeo, Rafaela Patricia D. Date Performed: Aug. 31, 22

Student No. 2017100354 Date Submitted: Sep. 12, 22

Course and Year: ME/4 Professor: Engr. Edward Ang

DISCUSSION:

The goal of this experiment is to use photoresistors to display the colors Red, Green, and
Blue on an RGB LED. In this experiment, the RGB colors are produced in response to changes
in ambient or interior lighting. Photoresistors are the resistors utilized in this case because they
are formed of semiconductor materials, which gives them the property of being light-sensitive.
Combinations of colors are also necessary in this case in order to obtain the data needed for the
experiment. The project also explains how to use PWM pins, which are crucial in this
experiment because they allow data to be transferred through the light sensors.

LEARNING OBJECTIVES:

The following are the learning goals for the experiment:

To be able to execute a code effectively.

To have the RGB LED display the RGB colors.

To comprehend the information shown in the Serial Monitor.

To show ABET results.

To understand the importance of the data values' coding.

To conduct the experiment while using engineering expertise and knowledge.


“A” Ability to apply knowledge of mathematics, science, and engineering

In this experiment, we had to use three different colored LED, which was reacting
according to the surrounding light. We observed that we can get better results when our room is
darker. We then understood how a dark room has less color and sound noise which the detector
better react to. We learned that photo resistors adjust their resistance value in response to the
quantity of incident light, which alters the intensity of the current flowing through the green
wires.

“B” Ability to design and conduct experiments as well as analyze and interpret data

In this experiment we had to understand the design, once we understood what is what, it was
relatively easy to analyze and interpret the result data. Also it was helpful that everything was
color coded

“C” Ability to design a system to meet desired needs

As I have previously mentioned, this experiment requires us students to analyze the design and
set up as a group, we understood what is needed before hand. We only did this experiment once,
so I believe we have achieved the desired needs as fast as our group can.

“D” Ability to function on multidisciplinary teams

By our 3rd experiment together we all understood everyone’s strength. We each did what we
wanted to do, and what we were good at. I myself had the most delicate hand, hence why I was
assembling the board. My teammates did coding, writing data, taking videos etc.

“E” Ability to identify, formulate, and solve engineering problems

It was a fast and short experiment. Out of the three experiment this was the easiest I believe.
There were no problems during the experiment. As for what we have solved, is what we
understood; In essence, it measures the amount of light that strikes the sensors and converts it to
an analog signal that is detected by analog inputs. The LED is then given a signal via digital
outputs. And this signal will be converted into a colored light by the tri-color LED.

“F” Understanding of professional and ethical responsibility

Yes, Some of us definitely took bigger responsibility than the others, but we all participated, and
all tried their best to understand the experiment.

“G” Ability to communicate effectively

We did communicate, Our video was actually a little bit noisy, since we were talking to each
other all throughout the experiment, on how to do it, what to do next, what is the purpose etc.
And since we finished this experiment on the 1st try, I believe our communication was effective.
“H” Broad education necessary to understand the impact of engineering solutions in a
global/societal context

The experiment was straightforward, making it an excellent starting point for people who are
new to electrical engineering. It provided us students with useful practice in the mechanical and
electrical fields.

“I” Recognition of the needs for and ability to engage in lifelong learning

This experiment reminded me of a project I once saw, which is a device for color blind people.
With a sensor, it detects the color of the object, then transmit it to the device which the user can
hear different sound waves. Each and every color has its own sound ware, and that is how the
color blind user can identify color.

“J” Knowledge on contemporary issues

None that I can think of.

“K” Ability to use the techniques, skills, and modern engineering tools for engineering
practice

I believe there was no new techniques, but helpful reminders. We learned that when it comes to
detectors, it is best be isolated, best when no once is around, and lights are off. Especially when
dealing with colored LED, we have to see the color better, and it helps that its dark. Detectors are
sensitive.

“L” Knowledge and understanding of engineering and management principles as a


member and leader in a team, to manage projects and in multidisciplinary environments

For this particular experiment I learned that sometime when you want something done quick and
accurate, you need you take charge. We struggled a lot on our Love-O-Meter experiment, so for
this next experiment on tri-colored LED, I wanted everything to go smoothly. I was a bit more
aggressive, assertive, and my teammates responded to that. They did all I asked, and they
understood what needs to be done. It was a great teamwork.
List of Materials needed for this Experiment:

1. Arduino Uno
An open-source electronics platform called Arduino is built on simple hardware and
software. Using a finger on a button or a light on a sensor, Arduino boards can read
inputs.

2. Breadboard
It is utilized to create temporary circuits. Designers may quickly remove and change
components thanks to its usefulness.

3. push button
When you press a pushbutton or switch, it connects two points in a circuit.
4.
The LED with 4 legs is a common cathode RGB LED. The LED has separate red, green, and
blue elements inside, and one common ground (the cathode). The LED has separate red, green,
and blue elements inside, and one common ground (the cathode). To light up a common anode
RGB LED, you have to connect its common terminal to the positive terminal of the power
source.

5. Ohm Resistor
A passive electrical component called a resistor prevents the flow of electric current by
introducing resistance. Different colored stripes on the resistors represents different ohms of
resistor it is. We used 3 220ohms resistors , and 3 1k ohms resistors.

6. 14 Jumper wire
Jumper wires are used to connect components on your breadboard to the header pins on your
Arduino.
7. Photoresistor
Most frequently, photoresistors are employed as light sensors. They are frequently used when it's
necessary to gauge the brightness of the light or detect its existence or absence. Nightlights and
photographic light meters are two examples.

8. USB cable
To connect Arduino Uno to our computer for coding and to check result data.
Jump wires

1 RGB LED

3 220ohms
3 Photoresistors
resistors

3 1k ohms
resistors
For Computerized Report: take a picture of the ONLINE ARDUINO AND
BREADBOARD PROTOTYPE FULLY SET UP HERE with label for each part.

1st step to do is to follow the book on how to assemble the Color Mixer Lamp. Connecting
wires, RGB LED lights, and photoresistors to its correct hole.

2nd step is to connect Arduino Uno to the laptop using the USB port. And run the code for Color
Mixer Lamp
Take note that we opened “Serial Monitor” , so that we can observe the
RED final

GREEN final
BLUE final

3rd step, make sure the room is dark, by turning off the light. The photoresistor is very sensitive,
when we tried this experiment with lights on it was very hard for us to distinguish the color, also
the values of red green blue in our reader showed high values even up to 100-300. The photos I
have shown above with lower than 100 values are gotten during the dark experiment. Makes it
more accurate.

I touched each of the photoresistors one by one to get each color from the LED.

Every time I touch one, we observe the computer screen for changes in data. And we took notes
of each trial.
List of ONLINE SAFETY procedures implemented in this experiment PUT PICTURES
WITH EXPLANATION

1. EYE CARE. When the room is dark, do not stare at the LED light too close. Rest your eyes
before turning the light on to avoid irritation or dizziness.

2. Make sure every components are connected properly in the right place to avoid incorrect result
data.

3. Keep lights off during the experiment to achieve a more precise and accurate result.

4. When touching the photoresistor, it is best to touch it gently as it is sensitive.

Write the complete Arduino Program use in this experiment with each line explanation
what are the commands/syntax used: (your understanding)

*/

const int greenLEDPin = 9; // LED connected to digital pin 9


const int redLEDPin = 10; // LED connected to digital pin 10
const int blueLEDPin = 11; // LED connected to digital pin 11

const int redSensorPin = A0; // pin with the photoresistor with the red gel
const int greenSensorPin = A1; // pin with the photoresistor with the green gel
const int blueSensorPin = A2; // pin with the photoresistor with the blue gel

int redValue = 0; // value to write to the red LED


int greenValue = 0; // value to write to the green LED
int blueValue = 0; // value to write to the blue LED

int redSensorValue = 0; // variable to hold the value from the red sensor
int greenSensorValue = 0; // variable to hold the value from the green sensor
int blueSensorValue = 0; // variable to hold the value from the blue sensor

void setup() {
// initialize serial communications at 9600 bps:
Serial.begin(9600);

// set the digital pins as outputs


pinMode(greenLEDPin, OUTPUT);
pinMode(redLEDPin, OUTPUT);
pinMode(blueLEDPin, OUTPUT);
}
void loop() {
// Read the sensors first:

// read the value from the red-filtered photoresistor:


redSensorValue = analogRead(redSensorPin);
// give the ADC a moment to settle
delay(5);
// read the value from the green-filtered photoresistor:
greenSensorValue = analogRead(greenSensorPin);
// give the ADC a moment to settle
delay(5);
// read the value from the blue-filtered photoresistor:
blueSensorValue = analogRead(blueSensorPin);

// print out the values to the Serial Monitor


Serial.print("raw sensor Values \t red: ");
Serial.print(redSensorValue);
Serial.print("\t green: ");
Serial.print(greenSensorValue);
Serial.print("\t Blue: ");
Serial.println(blueSensorValue);

/*
In order to use the values from the sensor for the LED, you need to do some
math. The ADC provides a 10-bit number, but analogWrite() uses 8 bits.
You'll want to divide your sensor readings by 4 to keep them in range
of the output.
*/
redValue = redSensorValue / 4;
greenValue = greenSensorValue / 4;
blueValue = blueSensorValue / 4;

// print out the mapped values


Serial.print("Mapped sensor Values \t red: ");
Serial.print(redValue);
Serial.print("\t green: ");
Serial.print(greenValue);
Serial.print("\t Blue: ");
Serial.println(blueValue);

/*
Now that you have a usable value, it's time to PWM the LED.
*/
analogWrite(redLEDPin, redValue);
analogWrite(greenLEDPin, greenValue);
analogWrite(blueLEDPin, blueValue);
}

Data Gathered:

The data was all taken from our serial monitor. What I personally observed is that, when
one of the photoresistors is touched, the numbers of red gets higher than the other two, when the
next photoresistor is touched, the blue value in the monitor is higher than red and green. Lastly,
when touching the last photoresistor, green value is higher than blue and red value.

Analysis of the Experiment done

In gathering the data for the experiment, the Serial Monitor was the primary source for data
gathering. The values and data needed would show up in the Serial Monitor.The main switch or
control panel in this experiment would be the three (3) Photoresistors as the resistors would
determine what color would be displayed in the RGB LED. Three colors are needed to be
displayed which are Red, Green, and Blue. With the proper exposure to light (which is lights off)
the Photoresistors would cause those three colors to appear on the RGB LED. The third
photoresistor was exposed to light in order to obtain the color red, and as a result, the following
Mapped Sensor Values were obtained for the color red: Red#16, Blue#23, and Green#15 while
its Raw Sensor Values (RSV) were: Red#64, Blue#92, and Green#62.
Recommendation:

My recommendation for this experiment is quite simple, connect everything according to


the book, and be gently with all components. Always confirm the resistor values and their
appropriate slot on the breadboard, do not get it mixed up.(Know the color difference of each
resistors) Turn off the lights when we start the photodetector touching and LED lights are on.
And lastly, rest eyes after the experiment before turning on the lights to avoided eye problems.

Conclusion:

In conclusion, all of the experiment's goals were achieved, in the end. Results from
ABET were shown during every stage of the experiment. Data from this experiment was
acquired with the aid of proper code execution and knowledge of the codes' roles in the project
and in data collection. The information demonstrates that there are various ways to achieve a
particular color. The higher number among those MSV and RSV denotes a darker colour or a
greater quantity required to produce that particular color. The photoresistor serves as a reflector
to control the color of the light. In this experiment, two sets of variables—Mapped Sensor
Values and Raw Sensor Values—were displayed on the serial monitor. These variables contain
data that reflects on obtaining RGB colors.

REFERENCES:

https://circuitdigest.com/microcontroller-projects/arduino-color-mixing-lamp
https://programminginarduino.wordpress.com/2016/03/01/project-04/
https://www.google.com/search?q=ldr+in+arduino&oq=ldr+in+&aqs=chrome.3.69i57j0i512l2j0i
67j0i512l6.3159j0j7&sourceid=chrome&ie=UTF-8
https://maker.pro/arduino/tutorial/how-to-use-an-ldr-sensor-with-arduino

## Color Mixing Lamp

1. How does the LDR Work?

LDR functions by detecting the amount of light present in its surroundings. An LDR
sensor is one that can be used to detect light. When connected to VCC (5V), the LDR
produces an analog voltage whose magnitude varies in direct proportion to the amount of
input light it receives. In other words, the voltage coming from the LDR will increase in
proportion to the brightness of the light.

2. Does the resistance increase as it receives more light?

LDRs (light-dependent resistors). As the light intensity rises, their resistance decreases.

3. What is the necessary program function to read analog inputs from your
experiment?

"analogRead()" is the program function that is used to read analog inputs. The pin name
or number is written within the (). Because the instruction translates 0-1023 voltage, the
raw sensor value had a range of 0–1023, just like in this experiment.

4. Individually suggest electrical and mechanical standards or codes and local or


international applicable in this experiment. Cite source/s.

The rapidly evolving nanotechnologies have sparked a recent explosion in nanophotonics, which
has shown that light exhibits exceptional light-matter interactions with subwavelength-scale
structures.

https://www.degruyter.com/document/doi/10.1515/nanoph-2022-0191/html?lang=en

Infrared detectors are in currently use of photoconductor, this shows how advance this simple
component can be.

https://www.rp-photonics.com/infrared_detectors.html

You might also like