0% found this document useful (0 votes)
23 views

1 Elec 1b - Introduction To Arduino

Uploaded by

Maoi Reyes
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views

1 Elec 1b - Introduction To Arduino

Uploaded by

Maoi Reyes
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 18

Elec 1 – Technical

Elective 1
(Embedded System)

This is a property of
PRESIDENT RAMON MAGSAYSAY STATE UNIVERSITY
NOT FOR SALE
Elec 1 – Technical Elective
First Edition, 2021

Copyright. Republic Act 8293 Section 176 provides that “No copyright shall subsist in any work of
the Government of the Philippines. However, prior approval of the government agency or office
wherein the work is created shall be necessary for exploitation of such work for profit. Such agency or
office may, among other things, impose as a condition the payment of royalties.

Borrowed materials included in this module are owned by their respective copyright holders. Every
effort has been exerted to reach and seek permission to use these materials from their respective
copyright owners. The University and authors do not claim ownership over them.

Learning Module Development Team

Assigned
Title Author
Chapter
Chapter 1: Introduction to Arduino
Chapter 2: Arduino Development Environment Dionisio M. Martin Jr.
Chapter 3: Arduino Programming
Chapter 3: Arithmetic Operators

Evaluators:

(First Name, Middle Initial, Last Name), Position


(First Name, Middle Initial, Last Name), Position
(First Name, Middle Initial, Last Name), Position
Course Overview
Introduction

Technical Elective is a three-unit (two-unit lectures and one-unit laboratory) computer


engineering professional course. This elective is designed to the third year level computer
engineering students whose interest is in both hardware and software where the intended output
is the solution in engineering problems especially the real problem in the community using the
concept of automation and technology. This elective requires knowledge both in programming
and electronic circuit.

Course General Objectives

At the end of the semester, 85% of the students have attained 90% level of understanding for
being aware in the latest technology through the Arduino technology, both in research-based
and project-based.

1. Understand basic information technology concepts;


2. Use application software and the internet technology in learning new knowledge;
3. Acquire proficiency in programming and Arduino as the platform for circuit
programming development; and
4. Use high level language and programming and circuit programming applications in
solving engineering problems.

Course Details:

 Course Code: Elec 1


 Course Title: Technical Elective 1 – Embedded System
 No. of Units: 3-units (2-units lecture and 1-unit laboratory)
 Classification: Lecture with Laboratory-based
 Pre-requisite / Co-Requisite: 3rd Year Standing
 Semester and Academic Year: 1st Semester, AY 2021-2022
 Schedule: BSCpE 3B – Tuesday and Thursday, 2:00PM-4:30PM
 Name of Faculty: Dionisio M. Martin Jr.
 Contact Details
Email: [email protected]
Mobile Number: 0939-906-0585
FB Account: Dionisio Martin Jr.
 Consultation
Day: TTH
Time: 8:00-9:30AM

Learning Management System

The University LMS will be used for asynchronous learning and assessment. The link and class
code for LMS will be provided at the start of class through the class’ official Facebook Group.
 Edmodo
 Google Classroom
 University LMS

Assessment with Rubrics

Students will be assessed in a regular basis thru quizzes, assignments, activities,


individual/group outputs using synchronous and/or asynchronous modalities or submission of
SLM exercises. Rubrics are also provided for evaluation of individual/group outputs.

Major examinations will be given as scheduled. The scope and coverage of the examination
will be based on the lessons/topics as plotted in the course syllabus.
0323

Module Overview
Introduction

This module aims to introduce the concepts of modular approach in designing and developing
projects using Arduino technology.

Arduino board is basically an in-demand development board particularly to the computer


engineering students and electronic enthusiast where integration of circuit and programs is no
hassle. Thus, through this module, computer engineering student will experience to program
and use electronic circuit in the same tine to designed project that is related to automation and
real-time application.

The students will learn how to program using operators and operators, conditional statements,
iterative statements and instruction necessary in using modules and library.

Table of Contents

Chapter 1: Introduction to Arduino


Chapter 2: Arduino Development Environment
Chapter 3: Arduino Programming
Chapter 3: Arithmetic Operators
Technical Elective 1

Chapter 1

Introduction to
Arduino
Chapter 1

Introduction to Arduino
Introduction

In 2005, building upon the work of Hernando Barragán (creator of Wiring), Massimo Banzi
and David Cuartielles created Arduino, an easy-to-use programmable device for interactive art
design projects, at the Interaction Design Institute Ivrea in Ivrea, Italy. They wanted a device
that was simple, easy to connect to various things (such as relays, motors, and sensors), and
easy to program.

Arduino Uno is a microcontroller board based on the ATmega328P. It has 14 digital


input/output pins (of which 6 can be used as PWM outputs), 6 analog inputs, a 16MHz quartz
crystal, a USB connection, a power jack, an ICSP header and a reset button. It contains
everything needed to support the microcontroller; simply connect it to a computer with a USB
cable or power it with an AC-to-DC adapter or battery to get started.

Specific Objectives

At the end of the lesson, the students should be able to:

- compared the specifications of Arduino Uno to other Arduino board.


- enumerate and identify the functions of each parts Arduino board.
- enumerate and identify the different Arduino family.
- understand the importance of Arduino board in designing and developing projects.
- identify the different application of Arduino technology most specifically the Arduino
Uno.

Duration

Chapter 1: Introduction to Arduino = 10 hours


(9.5-hours discussion;
0.5-hour assessment)

_____________________________________________

ARDUINO UNO

Arduino Uno – is an open-source microcontroller board based on the Microchip ATmega328P


microcontroller and developed by Arduino.cc.
– has board equipped with sets of digital and analog input/output (I/O) pins that may be
interfaced to various expansion boards (shields) and other circuits. The board has 14 digital
I/O pins (six capable of PWM output), 6 analog I/O pins, and is programmable with
the Arduino IDE (Integrated Development Environment), via a type B USB cable.
– can be powered by the USB cable or by an external 9-volt battery, though it accepts
voltages between 7 and 20 volts. It is similar to the Arduino Nano and Leonardo.
– has word "uno" means "one" in Italian and was chosen to mark the initial release
of Arduino Software.
– is the first in a series of USB-based Arduino boards. The ATmega328 on the board
comes preprogrammed with a bootloader that allows uploading new code to it without the
use of an external hardware programmer.

Arduino Uno Board Description


Some boards look a bit different from the one given below, but most Arduinos have
majority of these components in common

1 – Power USB. It can be powered by using the USB cable from your computer. All you
need to do is connect the USB cable to the USB connection.
2 – Power (Barrel Jack). It can be powered directly from the AC mains power supply by
connecting it to the Barrel Jack.
3 – Voltage Regulator. Its function is to control the voltage given to the Arduino board
and stabilize the DC voltages used by the processor and other elements.
4 – Crystal Oscillator. It helps Arduino in dealing with time issues. How does Arduino
calculate time? The answer is, by using the crystal oscillator. The number printed on
top of the Arduino crystal is 16.000H9H. It tells that the frequency is 16,000,000 Hertz
or 16-MHz.
5 – Arduino Reset. It is used to reset the Arduino board, i.e., start the program from the
beginning. Resetting UNO board comes in two ways: a.) First, by using the reset button
(17) on the board and b.) second, by connecting an external reset button to the Arduino
pin labelled RESET (5).
6, 7, 8, 9 – Pins (3.3, 5, GND, Vin)
• (6) 3.3V: Supply 3.3 output volt
• (7) 5V: Supply 5 output volt. Most of the components used with Arduino board
works fine with 3.3-volt and 5-volt.
• (8) GND (Ground): There are several GND pins on the Arduino, any of which can
be used to ground your circuit.
• (9) Vin: This pin also can be used to power the Arduino board from an external
power source, like AC mains power supply.
10 – Analog pins. The Arduino UNO board has five analog input pins A0 through A5.
These pins can read the signal from an analog sensor like the humidity sensor or
temperature sensor and convert it into a digital value that can be read by the
microprocessor.
11 – Main microcontroller. Each Arduino board has its own microcontroller (11). It is
assumed as the brain of your board. The main IC (integrated circuit) on the Arduino is
slightly different from board to board. The microcontrollers are usually of the ATMEL
Company. You must know what IC your board has before loading up a new program
from the Arduino IDE.
12 – ICSP pin. Mostly, ICSP is an AVR, a tiny programming header for the Arduino
consisting of MOSI, MISO, SCK, RESET, VCC, and GND. It is often referred to as an
SPI (Serial Peripheral Interface), which could be considered as an "expansion" of the
output. Actually, you are slaving the output device to the master of the SPI bus.
13 – Power LED indicator. This LED should light up when you plug your Arduino into a
power source to indicate that your board is powered up correctly. If this light does not
turn on, then there is something wrong with the connection.
14 – TX and RX LEDs. These appear in two places on the Arduino UNO board and
labelled as TX (transmit) and RX (receive). First, at the digital pins 0 and 1, to indicate
the pins responsible for serial communication. Second, the TX and RX led (13). The
TX led flashes with different speed while sending the serial data. The speed of flashing
depends on the baud rate used by the board. RX flashes during the receiving process.
15 – Digital I/O. The Arduino UNO board has 14 digital I/O pins (15) (of which 6 provide
PWM (Pulse Width Modulation) output. These pins can be configured to work as input
digital pins to read logic values (0 or 1) or as digital output pins to drive different
modules like LEDs, relays, etc. The pins labeled “~” can be used to generate PWM.
16 – AREF. AREF stands for Analog Reference. It is sometimes, used to set an external
reference voltage (between 0 and 5 Volts) as the upper limit for the analog input pins.

TYPES OF ARDUINO
Since then, the Arduino has grown in several different directions, with some versions getting
smaller than the original, and some getting larger. Each has a specific intended niche to fill. The
common element among all of them is the Arduino runtime AVR-GCC library that is supplied
with the Arduino development environment, and the on-board bootloader firmware that comes
preloaded on the microcontroller of every Arduino board.
The Arduino family of boards use processors developed by the Atmel Corporation of San Jose,
California. Most of the Arduino designs utilize the 8-bit AVR series of microcontrollers.
Although an Arduino board is, as the Arduino team states, just a basic Atmel AVR development
board, it is the Arduino software environment that sets it apart. This is the common experience
for all Arduino users, and the cornerstone of the Arduino concept.
The following are the most common Arduino board:

Arduino Uno
Processor: ATmega328 (8-bit CPU, 16MHz clock speed, 2KB SRAM, 32KB flash storage)
Features: 14 digital I/O pins, 6 analog input pins, removable microcontroller
Form Factor: 2.7” x 2.1” rectangle

The Arduino Uno is the most “standard” Arduino board currently on the market, and is
probably the best choice for beginners just getting started with the platform. The board is
compatible with more shields (add-on boards) than other models.
The Uno’s main limitation is the ATmega328 chip, which doesn’t have a lot of SRAM
or flash memory. That limit’s the kinds of programs you can load on the chip – if your project
involves a display or otherwise needs to store and use any form of images or audio data, 2KB
of memory probably isn’t going to be enough.

Arduino Mega
Processor: ATmega2560 (8-bit CPU, 16MHz clock speed, 8KB SRAM, 256KB flash storage)
Features: 54 digital I/O pins (15 PWM), 16 analog input pins, 4 UARTs, 16 MHz crystal
oscillator
Form Factor: 101.52mm x 53.3mm rectangle
The Mega is a microcontroller board based on the ATmega2560. The Mega is
compatible with most shields designed for the Arduino Duemilanove or Diecimila. It is
intended for comparatively bigger projects requiring a large number of input and output pins.

Arduino Nano
Processor: ATmega328 (8-bit CPU, 16MHz clock speed, 2KB SRAM, 32KB flash storage)
Features: 22 digital I/O pins, 8 analog input pins
Form Factor: 18mm x 45mm rectangle

The Arduino Nano is a small, complete, and breadboard-friendly board based on the
ATmega 328 (Arduino Nano 3.x). It has more or less the same functionality of the Arduino
Duemilanove, but in a different package. It lacks only a DC power jack, and works with a mini-
B USB cable instead of a standard one.

Arduino Mini
Processor: ATmega328 (8-bit CPU, 16MHz clock speed, 2KB SRAM, 32KB flash storage)
Features: 14 digital I/O pins, 8 analog input pins, 16 MHz crystal oscillator
Form Factor: 30mm x 18mm rectangle

The Arduino Mini is a small microcontroller board originally based on the ATmega168,
but now supplied with the 328 (datasheet), intended for use on breadboards and when space is
at a premium.
The new Mini (revision 05) has a new package for the ATmega, which enable all
components to be on the top of the board. It also has an onboard reset button.

Arduino Leonardo
Processor: ATmega32u4 (8-bit CPU, 16MHz clock speed, 2KB SRAM, 32KB flash storage)
Features: 20 digital I/O pins (7 PWM), 12 of which can be used as analog inputs, native USB
support
Form Factor: 68.6mm x 53.3mm rectangle
The Leonardo is, essentially, a slight upgrade to the Uno. It looks a lot like the Uno, but
it features a soldered-on ATmega32u4 microcontroller with a tiny bit more memory. The main
advantage of the ATmega32u4 isn’t the extra SRAM, though, it’s the chip’s built-in USB
compatibility. This allows the Leonardo to interface with a PC, which sees it as a generic mouse
or keyboard. It also features a few extra analog input pins.

Arduino Due
Processor: Atmel SAM3X8E ARM Cortex-M3 (32-bit CPU, 84MHz clock speed, 96KB
SRAM, 512KB flash storage)
Features: 54 digital I/O pins (12 PWM), 12 analog input pins, 2 analog output pins, native USB
port
Form Factor: 101.52mm x 53.3mm rectangle

One of the newest Arduino boards, the Due is the heavy-hitter of the family, packing a
32-bit ARM processor that handily outclasses any of the processors found in other Arduino
boards. The Due is primarily for more complicated projects that can make sure of its muscular
processor, or that need more I/O pins than are found on the smaller Arduino boards. That said,
the Due is substantially bigger and more expensive than the Uno or Leonardo, so consider
whether you really need the extra power before making a purchase.
One drawback to the Due is that it operates at 3.3 volts, which is different than the 5
volts that most other Arduino boards operate at. That limits the add-on hardware that’s
compatible with the Arduino Due – if an add-on board tries to send a 5-volt signal to the Due’s
I/O pins, it could damage the microcontroller.

Arduino Lilypad
Processor: ATmega328 (8-bit CPU, 16MHz clock speed, 2KB SRAM, 32KB flash storage)
Features: 14 digital I/O pins, 6 analog input pins
Form Factor: 2” diameter circle
The Lilypad is an Arduino board specifically designed for wearable devices. Its circular
shape and standoff-less I/O pins are designed to make it easy to sew the Lilypad into fabric-
based projects.
The hardware on a standard LilyPad board is basically the same as on and Arduino Uno.
There are a number of other LilyPad options available as well, including the LilyPad Arduino
USB, which feature’s the Leonardo’s ATmega32u4 chip, the Lilypad Arduino Simple, which
has fewer I/O connections than the basic model, and the LilyPad Arduino SimpleSnap, which
can be snapped into and out of projects, so they can be safely washed.

What Can You Do with an Arduino?


In addition to the ease of programming made possible by the Arduino IDE, the other big feature
of the Arduino is the power and capability of the AVR microcontroller it is based on. With a
handful of readily available add-on shields and a wide selection of low-cost sensor and actuator
modules, there really isn’t a whole lot you can’t do with an Arduino provided that you keep a
few basic constraints in mind.
The first constraint is memory. The AVR MCU just doesn’t have a whole lot of memory
available for program storage and variables, and many of the AVR parts don’t have any way
to add more. Arduino boards were not designed to accommodate external memory, since one
of the basic design assumptions was that the AVR chip itself would have the necessary I/O and
that the user would be running a relatively short program. The Arduino was not intended to be
a replacement for a full-on computer system with gigabytes of RAM and a hard disk drive
(HDD). There are inexpensive Intel-based single-board computers that fit that description, but
they won’t fit into an old mint tin, a section of PVC tubing strapped to a pole or a tree, a small
robot, or the payload section of a model rocket. An Arduino will.
The second constraint is speed. The Arduino CPU clock rate is typically between 8- and 20-
MHz. While this may sound slow, you should bear in mind two key facts: first, the AVR is a
very efficient RISC (reduced instruction set computer) design, and second, things in the real
world generally don’t happen very quickly from a microcontroller’s perspective. For example,
how often does a so-called smart thermostat need to sample the temperature in a home or
office? Once a second is probably overkill, and once every 5 or even 10 seconds will work just
fine. How often does a robot need to emit an ultrasonic pulse to determine if there is an obstacle
ahead? A pulse every 100-ms is probably more than enough (unless the robot is moving very,
very fast). So, for an Arduino running at 16 MHz (like the Leonardo, for example), there will
be on the order of 1,000,000 or more CPU clock ticks between sensor pulses, depending on
whatever else the CPU is doing with the pulses. Given that an AVR can execute many
instructions in one or two clock cycles, that’s a lot of available CPU activity in between each
pulse of the ultrasonic sensor.
The third main constraint is electrical power. Since the Arduino hardware is actually nothing
more than a PCB for an AVR IC to sit on, there is no buffering between the microcontroller
and the external world. You can perform a fast “charcoal conversion” of an AVR (in other
words, overheat the IC and destroy it) if some care isn’t taken to make sure that you aren’t
sourcing or sinking more current than the device can handle. Voltage is also something to
consider, since some of the AVR types have 3.3V I/O, whereas others are 5V tolerant.
Connecting 5V transistor-transistor logic (TTL) to a 3.3V device usually results in unhappy
hardware, and the potential for some smoke.
With the preceding constraints in mind, here are just a few possible applications for an
Arduino:
 Real-world monitoring
 Automated weather station
 Lightning detector
 Sun tracking for solar panels
 Background radiation monitor
 Automatic wildlife detector
 Home or business security system
 Small-scale control
 Small robots
 Model rockets
 Model aircraft
 Quadrotor UAVs
 Simple CNC for small machine tools
 Small-scale automation
 Automated greenhouse
 Automated aquarium
 Laboratory sample shuttle robot
 Precision thermal chamber
 Automated electronic test system
 Performance art
 Dynamic lighting control
 Dynamic sound control
 Kinematic structures
 Audience-responsive artwork

_____________________________________________

References/Additional Resources/Readings

Hughes, J.M. (2016). Arduino: A Technical Reference. O’Reilly Media, Inc.

Perea, F. (2015). Arduino Essentials. Packt Publishing Ltd.

http://www.arduino.cc
Activity Sheet
ACTIVITY 1

Name: ______________________Course/Year/Section: ___________ Score: _________

Direction: Identify the following.


________________ 1. The country where Arduino is originated.
________________ 2. The constraint in Arduino where storing programs and variables is the
problem.
________________ 3. A popular microcontroller board based on the ATmega328P used both
by electronic enthusiast and in academe.
________________ 4. The constraint in supplying energy for both microcontroller and other
IC power-compatibility.
________________ 5. The constraint in Arduino where peocessing operation is too slow
compared to the modern computing device.

Direction: Match the items in column A to their descriptions in column B. write only the letter
of your choice on the space provided.
A B
_____ 1. Mini a. A small, complete, and breadboard-friendly board based on
the ATmega 328 and works with a mini-B USB cable
instead of a standard one.
_____ 2. Mega b. Circular shape and standoff-less I/O pins are designed to
make it easy to sew to fabric-based projects.
_____ 3. Nano c. A small microcontroller board originally based on the
ATmega168 intended for use on breadboards and when
space is at a premium.
_____ 4. Due d. A microcontroller board based on the ATmega2560 and
intended for comparatively bigger projects requiring a large
number of input and output pins.
_____ 5. Lilypad e. Primarily for more complicated projects that can make sure
of its muscular processor, or that need more I/O pins than
are found on the smaller Arduino boards.

Direction: Place a Check () mark on the corresponding column if the given application is
either A – real-world monitoring, B – small-scale control, C – small-scale automation or D –
performance art.
A B C D
1. Dynamic lighting control
2. Quadrotor UAVs
3. Automated greenhouse
4. Automated aquarium
5. Automatic wildlife detector
Direction: Give the complete terms for the following abbreviated words.
1. USB
2. I/O
3. UAV
4. CNC
5. TTL
6. AVR
7. MCU
8. MHz
9. KB
10. UART

Direction: Give 5 each of the following:


1. Types of Arduino

2. Sample application of Arduino (not mentioned from this module)

3. Parts of Arduino Uno board


Assignment
ASSIGNMENT 1

Name: ______________________Course/Year/Section: ___________ Score: _________

Direction. Answer the following:


1. What is the difference between Arduino Uno board and ATmega328 microcontroller?

2. What do you think the importance of using Arduino board compared in using
ATmega328 microcontroller directly to the design project?

3. Why Arduino Uno is the most “standard” Arduino board currently on the market?

4. What is Arduino IDE?

5. What design could you think you want to develop from Arduino? List five.
Learner’s Feedback Form

Name of Student: ___________________________________________________


Program : ___________________________________________________
Year Level : ___________ Section: ____________
Faculty : ___________________________________________________
Schedule : ___________________________________________________

Learning Module : Number: _________ Title : ______________________

How do you feel about the topic or concept presented?


□ I completely get it. □ I’m struggling.
□ I’ve almost got it. □ I’m lost.

In what particular portion of this learning packet, you feel that you are struggling or lost?
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________

Did you raise your concern to your instructor? □ Yes □ No

If Yes, what did he/she do to help you?


___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________

If No, state your reason?


___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________

To further improve this learning packet, what part do you think should be enhanced?
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________

How do you want it to be enhanced?


___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________

NOTE: This is an essential part of course module. This must be submitted to the subject
teacher (within the 1st week of the class).

You might also like