Professional Documents
Culture Documents
1
Controlling Outputs Using a Microcontroller
Course Code: CPE014/CPE400 Program: BSCPE
Course Title: Embedded Systems Date Performed:
Section: Date Submitted:
Members: Instructor:
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:
The microcontroller is used to receive input from sensors, switches, and other input components, process/store those input
data, and control outputs according to the program that is uploaded on the controller. A microcontroller has all the necessary
components to function as a computer. However, unlike a general-purpose computer, an embedded computer or
microcontroller/microprocessor is constrained in terms of size, cost, and performance as its purpose and use is for specific
applications only.
Microcontrollers can be found in almost all modern applications some but not limited to the field of Agriculture,
Communication, Electronics Tools, Entertainment, Medical Equipment, Office Equipment, Transportation, and even Space. In
this activity, you will see the capability of a microcontroller to control outputs such as LEDs, and Buzzers using an Arduino
Board. A microcontroller is an Integrated Circuit or IC that can be programmed and perform I/O control through its pins.
Prototyping and programming with only a microcontroller can be difficult as you will need to wire other electronic components
and also wire an external programmer to upload codes to the microcontroller. As such a circuit board was developed for
prototyping with a microcontroller such as the Arduino Boards.
The Arduino UNO Board
The Arduino UNO Board is a prototyping board with a microcontroller that enables rapid prototyping by allowing easy
programming through the built-in USB port and serial programmer and the header pins that makes connecting wires and
components to the microcontroller easier. The Arduino UNO Board also comes with support for external power through the
DC power barrel jack and a built-in linear regulator.
Electronic Components
Light Emitting Diodes (LEDs) are used to emit signals in the form of light which can be used to convey
message/information. It is one of the most commonly implemented electronic components to output a simple
notification/message. It can be turned on by applying a small forward bias (voltage) across the Anode pin of the LED and
connecting the Cathode pin to ground.
Resistors are used to limit the flow of electricity in a circuit. They are connected to the LED in series in order to limit the flow
of current otherwise the LED would burn out and be permanently damaged. A Resistor has bands of different colors that
represent how much is its resistance value.
Band Color Value
Black 0
Brown 1
Red 2
Orange 3
Yellow 4
Green 5
Blue 6
Violet 7
Gray 8
White 9
Gold 1/10
Silver 1/100
Example, a 270Ω resistor has a first digit 2 (red), second digit 7 (violet), and a multiplier of 1 (brown). Similarly, at 1kΩ resistor
will have bands of brown, black, and red (1, 0, 00).
A Breadboard is used to temporarily connect electronic components, Integrated Circuits (ICs), and wires together to build
prototypes to be able to see what the circuit before it is fabricated onto a Printed Circuit Board (PCB).
Note:
The Orange wire
represents the
connections of the
breadboard.
Jumping wires and solid wires are used to connect the parts of a breadboard together to form a circuit. A jumping wire
usually has plastic that supports the ends of the wires while the solid wire only has both its ends exposed. The two ends of a
solid wire can be bent to act as a jumping wire.
5. Procedure:
Blinking LEDs
1. Wire the circuit shown below (Digital Pins 3, 4, 5 are used).
Schematic Diagram
Wiring Diagram
2. On the Arduino IDE, click File then Examples then Basics, find the Blink LED or copy the program code below:
3. Connect the Arduino Board to the Computer using the USB Cable, then click Upload.
4. Observe the output.
5. Modify the code by changing 13 to 3.
6. Apply C programming by assigning a variable to hold the pin number 3.
delay(value) Observation
2000
1000
500
100
10
__________________