Professional Documents
Culture Documents
ENGINEERINGTECHNOLOGY
UNIVERSITI MALAYSIAPERLIS
EDJ12002
ELECTRICAL ENGINEERINGSKILLS
LAB MODULE1
INTRODUCTIONTO
ARDUINO
1. INTRODUCTION TO ARDUINO
1.1 OBJECTIVES
Arduino is an open-source electronics platform based on easy-to-use hardware andsoftware. Arduino boards
are able to read inputs - light on a sensor, a finger onabutton, or a Twitter message and turn it into an output -
activating a motor, turningonan LED, publishing something online. You can tell your board what to do by
sendinga set of instructions to the microcontroller on the board. To do so you use the Arduinoprogramming
language (based on Wiring), and the Arduino Software (IDE), basedonProcessing. This Arduino Maker UNO
is an Arduino UNO compatible board designedand developed specially for students to learn coding and
microcontroller canbeprogrammed via Arduino IDE and compatible with all the example code and libraries
for Arduino UNO.
Features:
● SMD ATmega328P microcontroller (the same microcontroller on Arduino UNO) with Optiboot (UNO)
Bootloader.
● USB Programming facilitated by the CH340.
● Input voltage: USB 5V, from computer, power bank or standard USBadapter. ● 500mA
(maximum) 3.3V voltage regulator.
● 0-5V outputs with 3.3V compatible inputs.
● 14 Digital I/O Pins (6 PWM outputs).
● 6 Analog Inputs.
● ISP 6-pin Header.
● 32k Flash Memory.
● 16MHz Clock Speed.
● R3 Shield Compatible.
● LED array for 5V, 3.3V, TX, RX and all digital pins.
● On board programmable push button (pin 2, need to configure as INPUT_PULLUP).
G RESET BUTTON
Button to restart Maker UNO program.
LABEL FUNCTION
H PROGRAMMABLE BUTTON This button is connected I ARDUINO
to pin 2 andUNO
GND.R3
ToSTANDARD FEMA
use it, user needtoconfigure it as INPUT_PULLUP. pin follows Arduino UNO R3 standard. Theo
Vin.
MAIN MICROCONTROLLER (ATMEGA328P) (Serial
J
Maker Uno is ATmega328P, same as Arduino
(Serial
K SERIES OF MOSFET
These series of MOSFET is a ‘secret’ why you can control LEDor makeit
8for
UnoR3.
AVR
The Arduino IDE is an open-source software, which is used to write and upload codeto the Arduino boards.
It supports the programming languages C and C++. ArduinoIDE is an open source software that allows you
to download and use it for free.
1. Log on to https://www.arduino.cc/en/main/software.
2. Choose your OS to proceed.
3. Double click on the downloaded to proceed. You are encouraged to make a monetary contribution to
help them to continue to fund their development. Anyway, you are free to click “JUST DOWNLOAD”.
EDJ12002: ELECTRICAL ENGINEERING SKILL ARDUINO
PROGRAMMING : MODULE 1
4. Once installation is completed, the Arduino’s icon will appear. Double click the icon to launch the
Arduino IDE.
The Integrated Development Environment of Arduino (IDE) is displayed by the IDEcontrol menu (see the
image below).
Toolbar Button - The icons displayed on the toolbar are New, Open, Save, Upload, and Verify. It
is shown below:
7. Now, you have successfully setup Maker UNO and will start making somethinginthe next
lesson.
This is a very simple practice sketch that you will use to become familiar with the basic concepts of
Arduino.
1. Connect your Maker UNO with your PC with a USB cable. 2. Launch Arduino IDE.
3. From the application menu choose File > New file. 4. Write the program below and
save as the file named Task_2
5. Click compile , wait for a few seconds until you see “Done Compiling” appear at the bottom of the
sketch.
6. Then click upload . Wait for a few seconds and you will see “Done uploading”appear at the
bottom of the sketch.
7. Check your result.
Exercise M1_1
Exercise M1_2
a) Blink LED 2, LED 3, LED 4, LED 5, LED 6 and LED 7 ON and OFF together with 1s delay.
b) Blink LED 2, LED 3, LED 4, LED 5, LED 6 and LED 7 in sequence with 1s delay.
c) Blink LED 2 to LED 13 in sequence then blink together ON and OFF 3 times with 1s delay.
In this project, we want to control an LED using the on-board push button switch.Touse the on-board push
button switch, we need to set it as “internal pullup input”. Example: pinMode(2, INPUT_PULLUP). The
on-board LED at Pin 2 will act as aninput indicator. It will turn o- if the on-board switch is pressed. The
on-board switchis internally connected to Pin 2. Meaning it is occupied and cannot be connectedtoany
other external components anymore if you would like to use it.
1. Open a new sketch then write these codes into the sketch and save as the file named Task_4.
2. Compile and upload the program.
3. Check your result.
Exercise M1_3
By using on-board switch, write a code. When the switch is pressed for the 1st time, LED 4 is turn ON.
When the switch is pressed for the 2nd time, LED4 is turn OFFand LED 5 is turn ON. When the switch is
pressed for the 3rd time, LED5 is turnOFF.
The on-board piezo buzzer is connected to Pin 8. The tone() function works withtwoarguments, but can take
up to three arguments. Let’s address the three required items first:
tone( pin number, frequency, duration);
There is always a delay after tone. The delay has to drag 30% longer than the toneduration to ensure the
tone is completed.
TASK 5:
1. Open a new sketch, write these codes into the sketch then upload to your board.
Exercise M1_4
Using the on-board push button switch SW1 and compose the fist line of the “HappyBirthday To You”
song by using information below. If the SW1 is pressed, the on- board buzzer is on for three time with
1s delay.
Instructor Approval:
Instructor Approval:
Instructor Approval:
Instructor Approval:
Instructor Approval:
© Copyright Faculty of Electrical Engineering Technology, UniMAP. 2022
13
EDJ12002: ELECTRICAL ENGINEERING SKILL
ARDUINO PROGRAMMING : MODULE 1
Rubric:
Content 5 4
NAME STUDENT
programming Student has Student has Student
made correct equipment /
writing made correct
componentconnections needed guidancemake correct
equipment
without /
guidanceper component equipment/
standarddiagram
performance connections component
as
a program.
with less guidance circuit at
connections
per standard effort
standard
and circuit
excell diagrams
ent
Satisfactory
diagrams and in writing
good performancewritingperformance
a
program. a program.