Lecture 5 Course Project. Arduino Basics.: IAT267 Introduc:on To Technological Systems
Lecture 5 Course Project. Arduino Basics.: IAT267 Introduc:on To Technological Systems
5
Course
project.
Arduino
basics.
IAT267
Introduc:on
to
Technological
Systems
1
Assignments
• Assignment
1:
due
today
– Answers
to
the
ques:ons
will
be
posted
by
the
end
of
the
week
2
Course
Project
• See
the
‘Course
Project’
folder
on
webct
– Project
descrip:on
– Project
teams
–
sign-‐up
– Resources
– Sample
student
projects
from
past
years
– Milestones
–
each
milestone
has
a
small
deliverable
3
Lecture
Topics
for
Today
• Arduino
basics
– What
is
Arduino
– Arduino
family
of
tools
– How
to
use
Arduino
• Workshop
this
week:
hands-‐on
ac:vity
using
Arduino
4
Arduino
Basics
5
What
is
Arduino?
6
Arduino:
3
Separate
Tools
• 1.
Arduino
controller
– The
hardware
• Prototyping pla\orm
8
Arduino:
Microcontroller
Board
• What
is
a
microcontroller:
Small,
inexpensive
compu&ng
device
11
Arduino
Projects
• Arduino
projects
can
be
stand-‐alone.
12
Why
Use
Arduino?
(1)
• Inexpensive
13
Why
Use
Arduino?
(2)
• Programming
is
very
easy
/
quick
– Programmed
via
a
USB
cable,
not
serial
port.
14
Arduino:
Open
Source
• Open
source
and
extensible
so+ware:
The
Arduino
so`ware
is
published
as
an
open
source
tool,
available
for
extension
by
experienced
programmers.
• Open
source
and
extensible
hardware
-‐
The
Arduino
is
based
on
Atmel's
ATMEGA8
and
ATMEGA168
microcontrollers.
The
plans
for
the
modules
are
published
under
a
Crea:ve
Commons
license,
so
experienced
circuit
designers
can
make
their
own
version
of
the
module,
extending
it
and
improving
it.
15
Open
Source
• Open
source
hardware
and
so+ware:
– if
you
wish
you
can
download
the
circuit
diagram,
buy
all
the
components
and
make
your
own
board
without
paying
anything
to
the
makers
of
Arduino
16
1.
Arduino
Board
17
To
Get
Started:
18
Hardware
Arduino
Serial
Arduino
BT
Arduino Mega
19
Arduino
Mini
Arduino Nano
Arduino
Lilypad
20
Source:
hip://todbot.com/
21
Diagram
of
the
Arduino
Board
22
Components
of
the
Arduino
Board
• Digital
inputs:
2
to
13
24
What
is
a
pin?
• A
pin
provides
an
input
or
output
through
which
the
controller
can
communicate
with
components.
25
LED
Connected
to
Pin
13
and
GND
26
Digital
vs.
analog
pins
• Digital
pins:
– Have
two
values
that
can
be
read
or
wriien
to
them:
high
and
low
• High:
means
that
5
V
(Volts)
is
being
sent
either
from
the
controller
or
from
a
component
• Low:
means
that
the
pin
is
at
0
Volts.
27
Analog
Pins
• Can
have
a
wide
range
of
informa:on
sent
to
them
(analog
pins
are
inputs)
• These
pins
are
what
we
use
to
input
informa:on
that
has
a
range
of
values,
e.g.:
– The
posi:on
of
a
dial
– The
distance
of
an
object
from
an
infrared
sensor
28
2.
Arduino
programming
environment
29
How
is
Arduino
programmed?
• Write
programs
on
your
PC
30
The
Arduino
IDE
31
Arduino
IDE
Menu
Op:ons
32
Development
Cycle
• Edit
code
• Compile
• Reset board
• Upload
33
• Run
buion:
does
not
in
fact
run
the
code;
it
checks
for
errors
and
compiles
the
code
34
• Upload
to
board:
actually
uploads
the
code
to
the
board,
assuming
that
the
board
is
properly
connected
and
all
the
drivers
are
properly
installed
35
‘Sketch’
menu
of
the
toolbar
36
‘Sketch’
menu
of
the
toolbar
• Import
Library:
allows
you
to
import
func:onality
from
a
library
created
for
a
specific
purpose
– E.g.,
sound,
working
with
motors,
communica:on
– Can
be
either
the
default
libraries
that
come
with
Arduino
or
a
library
that
you
have
created
yourself
– Line
that
appears
in
the
code
window:
•
#include
<Stepper.h>
37
‘Sketch’
menu
of
the
toolbar
• Show
Sketch
Folder:
brings
up
the
folder
where
all
your
applica:on
files
are
stored
– Helpful
if
you
want
to
check
if
a
certain
file
is
present
(e.g.,
image
file)
• Add
File:
allows
you
to
select
a
file
from
anywhere
in
your
opera:ng
system
and
save
it
to
the
folder
where
your
applica:on
is
located
38
‘Tools’
menu
of
the
toolbar
39
‘Tools’
menu
of
the
toolbar
40
‘Tools’
menu
of
the
toolbar
• Copy
for
Forum:
copies
all
the
code
in
an
applica:on
to
the
system
clipboard
if
your
computer
in
an
HTML
format
so
that
it
can
be
pasted
into
a
web
page
without
losing
formaqng.
• Archive
Sketch:
.zip
file
for
your
applica:on
• Burn
Bootloader:
needed
only
if
you
are
building
your
own
board.
41
Arduino
So`ware
42
43
3.
The
Arduino
language
(Wiring)
44
Example
Program:
Blink
• LED
connected
to
digital
pin
13
(we
choose
pin
13
because
depending
on
your
Arduino
board,
it
has
either
a
built-‐in
LED
or
a
built-‐in
resistor
so
that
you
need
only
an
LED).
45
Circuit
46
The
code
47
Minimal
Code
48
setup()
• The
setup()
func:on
is
called
when
a
sketch
starts.
– Use
it
to
ini:alize
variables,
pin
modes,
start
using
libraries,
etc.
– The
setup
func:on
will
only
run
once,
a`er
each
powerup
or
reset
of
the
Arduino
board.
49
loop()
• Loops
consecu:vely,
allowing
your
program
to
change
and
respond.
50
Thank
you
Ques:ons?
51