and 1

bendembarrassElectronics - Devices

Nov 2, 2013 (3 years and 9 months ago)

76 views

1






Arduino

is an open
-
source electronics
prototyping platform based on
flexible, easy
-
to
-
use hardware and
software. It's intended for artists,
designers, hobbyists, and anyone
interested in creating interactive
objects or environments.


2

Arduino


Open source physical computing platform (
i.e

microcontroller board) that can interact with the
environment.


Takes input data from the
envoirment

via various
sensors, switches etc. ; makes necessary
computations and generates output via
actuators, servo motors etc.


Programming language is based on Wiring,
development
environment
is based on
Processing.

3

Why Arduino?


Open source ! (both hardware and software)


Easy to learn. You don’t need to involve with
all the messy microcontroller stuff.


Can communicate with softwares running on
PCs (e.g Processing, MaxMSP, Flash), or it can
work stand
-
alone.


Many “extension shields” around.

4


5


void

setup
()

{


// put your setup code here, to run
once:


}


void

loop
()

{


// put your main code here, to run
repeatedly:




}



6

Hardware

7

Hardware


14 Digital I/O Pins

6 Analog Input

16Mhz Crystal
Oscillator

USB Connection

ICSP Header

Power Jack

Atmel ATMega328
Microcontroller

Reset Button

8

Power Pins

Hardware


Core and Memory


μ
Processor Core
: Atmel ATmega328
http://www.atmel.com/dyn/resources/prod_d
ocuments/doc8161.pdf


Memory
:
The

ATmega328

has 32 KB (with 0.5
KB used for the
bootloader
). It also has 2 KB of
SRAM and 1 KB of EEPROM

9

Hardware
-

Input
-
Output (I/O)
Configuration


Digital Pins:


Each pin can be configured as general purpose i/o
pin. (GPIO Pins)


They operate at 5V.


Some pins have special functionalities.


Serial: 0 (RX) and 1 (TX
).


External Interrupts: 2 and
3.


PWM: 3, 5, 6, 9, 10, and 11
.


SPI: 10 (SS), 11 (MOSI), 12 (MISO), 13 (SCK
).


LED: 13.

10

Hardware
-

Input
-
Output (I/O)
Configuration


Analog Pins:


6 Analog input pins, labeled as A0,A1,...,A6.


0V (ground) to 5V


They have 10bits resolution. (1024 different
values.)


Some pins have special functionalities.


I
2
C: A4 (SDA) and A5 (SCL
).




11

Hardware
-

Powering


Arduino Board can be powered directly by
USB or by an external power supply.


Recommended range of external supplies is 7


12
Volts.


Power pins:


VIN
.


5V.


3V3


GND

12

Hardware
-

Communications


Arduino
provides UART TTL (5V) serial
communication.


Serial monitor (like Windows HyperTerminal)


The '8U2 firmware
the
standard USB COM
drivers
.


A
lso

supports

I2C

(TWI) and SPI
communication.

13

Software
-

Basics


IDE on Processing = Easy


Modular and functional programming. Many
libraries. You do not have to worry about the
low level operations behind reading pins,
serial communication, pwm generation etc.


Big community (many projects, forums...)


14

Software


Data Types


Boolean


I
nt


Float


Char


Byte


Word

15

Software


I/O


pinMode
():
Configures the specified pin to behave either as an
input or an
output
.




digitalWrite():
Write a

HIGH

or a

LOW

value to a digital pin
, if it is
configured as output.



digitalRead
():
Reads the value from a specified digital pin,
either

HIGH

or

LOW



analogRead
():
Reads the value from the specified analog pin.




analogWrite():
Writes an analog value (PWM wave) to a pin.



16

Example


Hello World


17