COEN 3394 Module 02 - Exploring The Arduino Board
COEN 3394 Module 02 - Exploring The Arduino Board
What is Arduino?
Arduino Boards
Arduino Shields
Arduino Uno Hardware
Arduino IDE
MICROPROCESSORS and MICROCONTROLLERS
MICROPROCESSORS and MICROCONTROLLERS
MICROPROCESSORS and MICROCONTROLLERS
for building electronic projects
Arduino consists of two components:
MICROPROCESSORS and MICROCONTROLLERS
−(1) a physical programmable circuit board designed
around an Atmel microcontroller, and
−(2) an Integrated Development Environment (IDE)
which is used to write the code on a computer, and
then upload it to the physical board.
Arduino does not need a separate piece of
MICROPROCESSORS and MICROCONTROLLERS
hardware (called a programmer) to load new
code onto the board – you can simply use a USB
cable.
Arduino IDE uses a
MICROPROCESSORS and MICROCONTROLLERS
simplified version of
C++, making it easier
to learn to program.
Arduino provides many
MICROPROCESSORS and MICROCONTROLLERS
alternative boards.
These boards vary in the
following aspects:
−the microcontroller type,
−The microcontroller speed
(frequency)
−the physical size,
−the number of input and output pins,
−the memory space for programs, and
−the board price.
Examples of Ardunio boards include:
MICROPROCESSORS and MICROCONTROLLERS
attaching shields.
A shield is a circuit board that connects via pins to
the sockets on the sides of an Arduino.
Hundreds of shields are available on the market.
Examples of these shields include:
−GSM Shield
−Ethernet Shield
−WiFi Shield
The GSM Shield with a SIM card allows an Arduino
MICROPROCESSORS and MICROCONTROLLERS
board to connect to the internet, make/receive
voice calls and send/receive SMS messages.
The Ethernet Shield allows an Arduino board to
MICROPROCESSORS and MICROCONTROLLERS
connect to the internet. It provides a network (IP)
stack capable of both TCP and UDP.
The WiFi Shield allows an Arduino board to
MICROPROCESSORS and MICROCONTROLLERS
connect to the internet using the 802.11 wireless
specification (WiFi). It provides a network (IP)
stack capable of both TCP and UDP.
MICROPROCESSORS and MICROCONTROLLERS
The Arduino Uno is a microcontroller board based
MICROPROCESSORS and MICROCONTROLLERS
on the ATmega328.
It has the following main parts:
−an ATmega382 microcontroller,
−a 16MHz clock,
−14 digital input/output pins (of which 6 can be used as
PWM outputs),
−6 analog inputs,
−an ICSP header,
−a USB connection,
−a power jack
−a reset button, and
−on board LEDs
The Universal Serial Bus (USB)
MICROPROCESSORS and MICROCONTROLLERS
connector connects the board to a
computer for three reasons:
−(1) to supply power to the
board
−(2) to upload code to the
Arduino
−(3) to send data to and receive
it from a computer.
The Power Connector is used to
power the Arduino with a
standard mains power adapter.
The microcontroller is a special type of processors
MICROPROCESSORS and MICROCONTROLLERS
that …
−includes various types of memory to hold data and
programs,
−executes instructions, and
−provides various means of sending and receiving data.
This row of pins offers power connections and the ability to use an
MICROPROCESSORS and MICROCONTROLLERS
used to measure electrical signals that vary in
voltage.
Furthermore, pins A4 and A5 can also be used for
sending data to and receiving it from other devices.
Pins numbered 0 to 13 are digital input/output (I/O)
MICROPROCESSORS and MICROCONTROLLERS
pins.
Pins 0 (RX) and 1 (TX) are also known as the serial
port, which is used to send and receive serial data to
other devices.
The pins labeled with a tilde (~) can also generate a
varying electrical signal (PWM).
The Arduino IDE
MICROPROCESSORS and MICROCONTROLLERS
Arduino's IDE is
completely based on the
Processing IDE since
September 2005
EDIT MENU
CUT, PASTE, FIND…
TOOLS MENU
COM-PORT SETTINGS,
TOOLS,
BOARD TYPE
29
VERIFY / COMPILE
MICROPROCESSORS and MICROCONTROLLERS
NEW SKETCH
OPEN SKETCH
SAVE SKETCH
UPLOAD
SERIAL MONITOR
30
Code structure
MICROPROCESSORS and MICROCONTROLLERS
Variable declaration
Variables are containers for values.
You can give a variable any name you
like.
The value of a variable can be
changed and used dynamically as
many times as you like.
Variables are good to use when you
use values more than once in your
program.
Arduino Uno has 32 kilobytes of flash
memory and can store up to 1024
bytes as variables.
31
Code structure
MICROPROCESSORS and MICROCONTROLLERS
32
Code structure
MICROPROCESSORS and MICROCONTROLLERS
33