Introduction To Arduino
Introduction To Arduino
Ardunio Board
1
Introduction to Arduino
What are Microcontrollers
What are Microcontrollers
3
What isisthe
What DIYDIY
the paradigm
paradigm
4
The Arduino project
7
Arduino Today
●
●
○
80% from
Europe and USA
8
Some Competitors - 1
● Lego Mindstorm
○ Intelligent brick computer
○ Programmed in Brick Logo
○ Strong community
○ Too much expensive (cost: ~ $349)
● i-cubeX
○ Objects respond to human actions and
environmental parameters
○ Human Interface Devices
○ Easy but expensive
● Phidgets
○ Easy-to-assemble sensors and controllers
○ Not open source (proprietary)
○ Requires less hardware and software knowledge
○ ~ 3.5 x the cost of Arduino board
9
Some Competitors - 2
● Raspberry
○ It is closer to a computer
○ Includes CPU, USB ports, Ethernet, HDMI, ...
○ Includes an own OS (Linux)
● Teensy
○ Same Arduino firmware
○ Compatible with Arduino
○ Very small size
● UDOO
○ Merges Arduino and Raspberry
○ Powerful prototyping platform
○ Linux or Android OSs
10
The three key concepts of Arduino Project
11
Why should we use Arduino?
● Open source
○ Hardware & Software: permits to manufacture the boardsand
software distribution by anyone
■ Arduino compatibile: Canaduino, Freeduino, Linduino, SainSmart, ...
○ GNU Lesser General Public License (LGPL)
● Opportunistic prototyping
● Community
○ Wiki
○ Forum
○ Tutorials
14
Some Current Arduino Boards
UNO
● Current official reference of Arduino Boards
● Most used and documented board
Mega
● Designed for more complex projects
● 54 digital I/O pins, 16 analog inputs
● ATmega2560
LilyPad
● Designed for e-textiles and wearables projects
● Can be sewn to fabric and to power supplies
Nano
● Compact board similar to the UNO
15
Arduino as Physical Computing Platform
16
Smart Objects in the Internet Of Things
● IoT Manifest
○ Open SW & HW:
■ Possibility to share works
■ More innovation
○ Sustainable
■ Devices should be easily upgraded
○ Fair
■ You should have control of your devices
■ Security
17
Arduino Cloud
18
Home Control and Automation
19
Arduino Usage Examples
20
Arduino Usage Examples
Twitter Lamp
21
TeleBall (Breakout game)
22
Other Examples
23
Arduino Architecture and
Components
24
General Architecture
Main components
● AVR Microcontroller
● Analog and digital I/O pins
● Flash memory
○ Integrated in the microcontroller
● USB port for serial communication
USB
ATmega328
DC power jack
25
Components: mandatory
26
Components: I/O devices
27
Components: communication devices
Infrared
WiFi
Bluetooth
Zig-Bee
Ethernet
28
Characteristics - 1
Technical characteristics
● Clock speed: 16 MHz (Intel 286: 12.5 MHz) - 8-bit
● Flash program memory: 32 KBytes (0.5 used by bootloader)
● SRAM: 2 KBytes
● Input / Output
○ 14 digital input/output pins
○ 6 analog input pins
○ 6 analog output pins (PWM)
28
Characteristics - 2
5. Reset Button
5 6
6. In-circuit Serial Programmer
7. Analog In pins 0-5
8. Power and Ground pins
9
9. External Power Supply In
10. USB port
8 7
30
Digital and Analog pins
31
Digital and Analog pins
32
Programming in Arduino
33
Life Cycle of a program
power ON
reset
● Declare variables
Global Variables ● Initialize variables
34
Arduino IDE software
● Source code of IDE and library are distributed under the free
GNU GPLv2 license
35
Arduino IDE software
● Text editor containing syntax
highlighting and automatic
indentation
● Toolbar
● Text Console
● Compiler
● Serial monitor todebug
○ Allows you to read the data that
Sketch filled with the two Arduino communicates through
basic Arduino functions: the COM serial port
the setup() and loop().
36
Online IDE - Web Editor
37
Wiring-based Language
38
Some functions
39
Arduino's Hello World: LED blinking
/*
Bl i n k
Turn on and o f f a LED every one second
*/
voi d setup()
{
Se ri al .b eg in ( 960 0) ;
pinM ode (ledPin, OUTPUT); / / set s the d i g i t a l pi n as outpu t
}
40
Arduino's Hello World: LED blinking
/*
Bl i n k
Turn on and o f f a LED every one second
*/
41
Arduino's Hello World: LED blinking
/*
Bl i n k
Turn on and o f f a LED every one second
*/
voi d setup()
{
Se ri al .b eg in ( 960 0) ; Setup the serial
pinM ode (ledPin, OUTPUT); / / set s the d i g i t a l pi n as outpu t
connections and LED
}
42
Arduino's Hello World: LED blinking
/*
Bl i n k
Turn on and o f f a LED every one second
*/
voi d setup()
{
Ser ial .b egi n(9 600 );
pinM ode (ledPin, OUTPUT); / / set s the d i g i t a l pi n as outpu t
}
/ / the loop r ou ti n e runs over and over again f o r ev e r : Turn the LED on and off
voi d loop () continuously in the loop
{
d i g i t a l W r i t e ( l e d P i n, HIGH); // t u rn the LED on (HIGH i s the vol tage l e v e l )
delay (1000 ); // w a it for a second
d i g i t a l W r i t e ( l e d P i n, LOW); // t u rn the LED o f f by making the vol tage LOW
delay (1000 ); // w a it for a second
}
43
LED and Servo control via Android Application
44
Thank you
[email protected]
45