You are on page 1of 23

Setting up and Programming Controllers

ACTIVITY NO#1
Course Code: CPE006 Program:BSCPE
Course Title: Microprocessor Systems Date Performed:09/01/2021
Section: CPE51S1 Date Submitted:09/07/2021
Student Name: Yunsay, Ken Justin G. Instructor: Engr. Arriane D. Cabreros
1. Objective(s):
This activity aims to introduce the microcontroller as an integral part of implementing Embedded Systems by
demonstrating how it is used to control electronic components.
2. Intended Learning Outcomes (ILOs):
After performing the laboratory activity, the students should be able to
● Apply C/C++ language programming in creating and manipulating the Arduino code
● Create a program that uses digital output.
● Use delay in the implementation of sequence output.
3. Discussion:
<Write your discussion here >
Provide some introduction on the topic with illustrations.
Include citations/references.
The contents in this document will be detected by TurnItIn when submitted.

4. Resources:
Computer System with internet connection
TinkerCAD simulation software
5. Procedure:
A: BLINKING A LIGHT EMITTING DIODE
COMPONENTS:
Arduino UNO board or its variant.
1 x LED
1 x 220 Ω resistor
CIRCUIT & SCHEMATIC DIAGRAM

Figure 1. Circuit diagram of Experiment A Figure 2. Schematic diagram of Experiment A

PROCEDURE
1. Open your TinkerCAD account and create a new circuit.
2. Gather the components needed through the Components Tab at the right side.
3. Attach a 220-ohm resistor to pin 13 of your Arduino board.
4. Connect the positive side (Anode) of the LED to the resistor, and the negative side (Cathode) of
the LED to the
ground.
5. Using the Code button, encode and verify the program below, if no errors occurred start the
simulation by
clicking the Start Simulation button.
Delay (value) Observation

B. MODIFYING DELAYS OF BLINKING LEDS


COMPONENTS:
Arduino UNO board or its variant.
3 x LED
3 x 220 Ω resistor

CIRCUIT & SCHEMATIC DIAGRAM

Figure 3. Circuit diagram of Experiment B


Figure 4: Schematic diagram of Experiment A.

PROCEDURE
1. Wire the circuit shown below (Digital Pins 3, 4, 5 are used).
2. Write the appropriate codes for these three LEDs applying the basic structure of the Arduino
program.
3. Simulate the program and observe output.
4. Measure the voltages for each LED.
PINS Measured Voltages
HIGH LOW
3
4
5
4. Add another 2 LEDS to make it a total of 5 LEDs. Use other digital output pins you prefer.
5. Modify the delay(1000) and write your observations on the table below:

Delay (value) Observation


2000
1000
500
100
10

C. USING FOR LOOP WITH ARRAY TO CONTROL LED DISPLAY


1. Apply the same connections and procedures of Experiment B.
2. Apply the appropriate codes using looping structure with array for variable declaration.
3. Simulate and observe output.
4. Modify the delay(1000) and write your observations on the table below:

Delay (value) Observation


2000
1000
500
100
10
6. Output/Results: (For each Circuit)

Figure 1.1: The Output of the Procedure A. It has 2000ms delay value of an LED.
Figure 1.2: The Output of the Procedure A. It has 1000ms delay value of an LED.

Figure 1.3: The Output of the Procedure A. It has 500ms delay value of an LED.
Figure 1.4: The Output of the Procedure A. It has 100ms delay value of an LED.

Figure 1.5: The Output of the Procedure A. It always lights up because the delay value is 10ms.
Figure 2.1: The Output of the Procedure B. It has 1000ms delay value of an LED.
Figure 2.2: The Output of the Procedure B. It has 1000ms delay value of an LED.

Figure 2.3: The Output of the Procedure B. It has 1000ms delay value of an LED.
Figure 2.4: The Output of the Procedure B. It has 1000ms delay value of an LED.

Figure 2.5: The Output of the Procedure B. It has 2000ms delay value of an LED.
Figure 2.6: The Output of the Procedure B. It has 500ms delay value of an LED.

Figure 2.6: The Output of the Procedure B. It has 100ms delay value of an LED.
Figure 2.6: The Output of the Procedure B. It has 10ms delay value of an LED.
Figure 3.1: The Output of the Procedure C. It has 1000ms delay value of an LED.

Figure 3.2: The Output of the Procedure C. It has 2000ms delay value of an LED.
Figure 3.3: The Output of the Procedure C. It has 500ms delay value of an LED.

Figure 3.4: The Output of the Procedure C. It has 100ms delay value of an LED.
Figure 3.5: The Output of the Procedure C. It has 10ms delay value of an LED.

Screenshot or print screen of TinkerCAD (sc the whole user interface including your taskbar showing the time and
date you accomplished the activity and your ARIS profile) with different output simulations (5 points deductions for
only one output). Include a readable source code for every circuit. Write at least one sentence definition or label for
each figure or image.
Also, upload a video of the simulated circuit showing connections and input-output combinations. Failure to comply
with each instruction will result in 5 points deductions. Please include the recorded simulation video (gdrive link) in this
section.
Data Analysis and Observations

Delay (value) Observation


2000 It blinks longer than 1000 because it changes
the output in 2000 milliseconds.
1000 It blinks normally, it changes the output in 1000
milliseconds.
500 It blinks faster than 1000, it changes the output
in 500 milliseconds.
100 It blinks faster than 500, it changes the output
in 100 milliseconds.
10 The LED lights up because the delay value is
10 milliseconds. You can only see the HIGH
output.
Table 1.1: The Delay value from Procedure A. It shows that the lower the delay the output of the LED will be
HIGH and the higher the delay, the longer will change the output of the LED.
PINS Measured Voltages
HIGH LOW
3 4.44V 0V
4 4.44V 0V
5 4.44V 0V
Table 2.1: The Measured Voltages from Procedure B. it shows that only 1 LED can get the HIGH output and
transfer it to the next LED the remaining value from the first LED is 0V.

Delay (value) Observation


2000 It lights up and transfer slower, it changes the
output in 2000 milliseconds
1000 It lights up and transfer normally, it changes
the output in 1000 milliseconds
500 It lights up and travel fast to the LED next to it
because we change the output in 500
milliseconds
100 It lights up and travel faster to the LED next to
it because we change the output in 100
milliseconds
10 It almost light all the LED because it changes
the output in 10 milliseconds to transfer on
other LED
Table 2.2 The Delay value from Procedure B. It shows that the lower the delay, the faster the voltage run to the
LED.

Delay (value) Observation


2000 It lights up and transfer slower, it changes the
output in 2000 milliseconds
1000 It lights up and transfer normally, it changes
the output in 1000 milliseconds
500 It lights up and travel fast to the LED next to it
because we change the output in 500
milliseconds
100 It lights up and travel faster to the LED next to
it because we change the output in 100
milliseconds
10 It almost light all the LED because it changes
the output in 10 milliseconds to transfer on
other LED
Table 3.1 The Delay value from Procedure B. It shows that the lower the delay, the faster the voltage run to the
LED and the difference in the Table 2.2 is that we use the for-loop command in coding on the Arduino Device.

7. Supplementary Task/s:
Figure 4.1: The Alternating Lights of the LED the Output is ODD.

Figure 4.2: The Alternating Lights of the LED the Output is Even.
Figure 4.3: The Alternating Lights of the LED, it shows the green LED means that GO.

Figure 4.4: The Alternating Lights of the LED, it shows the orange LED means that slowdown.
Figure 4.5: The Alternating Lights of the LED, it shows the red LED means that stop.
Figure 4.6: The Running Lights of the LED

Screenshot or print screen of TinkerCAD (sc the whole user interface including your taskbar showing the time and
date you accomplished the activity and your ARIS profile) with different output simulations (5 points deductions for
only one output). Include a readable source code for every circuit. Write at least one sentence definition or label for
each figure or image.
Also, upload a video of the simulated circuit showing connections and input-output combinations. Failure to comply
with each instruction will result in 5 points deductions. Please include the recorded simulation video (gdrive link) in this
section.

Data Analysis and Observations


In the first part of the supplementary, we use the ODD/EVEN by using loop command and x is divisible by 2.
For the second part of the supplementary, we create a Traffic light by using the delay value, for the red and
green light is in 3 sec while the orange is in 1 sec. On the last part of the supplementary, we use loop command
and delay value to manipulate the LEDs so that it looks like a running light.
Create a table for every simulation (summary of the output)
Showing different Trials/Values and their corresponding output.
(Or if there are inputs and different conditions, show the output for each)
Label each table based (or related to) your label in your circuit.Provide your observations for every table.

8. Answers to Questions:
Questions are given during Synchronous session, so better to review the conference
1. ______________________________________________________________________________________
____________________________________________________________________________
2. ______________________________________________________________________________________
______________________________________________________________________________________
__________________________________________________________________________
3.
4.
5. _____________________________________________________________________________________
______________________________________________________________________________________
______________________________________________________________________________

9. Conclusion:
Also, write a one paragraph (at least 5 sentences) Conclusion for this activity.
This must answer the learning outcomes/objectives.

10. Assessment Rubric:

You might also like