Introduction To Arduino
Introduction To Arduino
2
What is the DIY paradigm
3
The Arduino project
6
Arduino Today
●
●
○
80% from
Europe and USA
7
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
8
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
9
The three key concepts of Arduino Project
10
Why should we use Arduino?
● Open source
○ Hardware & Software: permits to manufacture the boards and
software distribution by anyone
■ Arduino compatibile: Canaduino, Freeduino, Linduino, SainSmart, ...
○ GNU Lesser General Public License (LGPL)
● Opportunistic prototyping
● Community
○ Wiki
○ Forum
○ Tutorials
13
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
14
Arduino as Physical Computing Platform
15
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
16
Arduino Cloud
17
Home Control and Automation
18
Arduino Usage Examples
Beat Bearing
19
Arduino Usage Examples
Twitter Lamp
20
TeleBall (Breakout game)
21
Other Examples
22
Arduino Architecture and
Components
23
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
24
Components: mandatory
25
Components: I/O devices
26
Components: communication devices
Infrared
WiFi
Bluetooth
Zig-Bee
Ethernet
27
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
29
Digital and Analog pins
30
Digital and Analog pins
31
Programming in Arduino
32
Life Cycle of a program
power ON
reset
● Declare variables
Global Variables ● Initialize variables
33
Arduino IDE software
34
Arduino IDE software
35
Online IDE - Web Editor
36
Wiring-based Language
37
Some functions
38
Arduino's Hello World: LED blinking
/*
Blink
Turn on and off a LED every one second
*/
void setup()
{
Serial.begin(9600);
pinMode(ledPin, OUTPUT); // sets the digital pin as output
}
39
Arduino's Hello World: LED blinking
/*
Blink
Turn on and off a LED every one second
*/
int ledPin = 13; // LED connected to digital pin 13 Initialise the variable with the
pin number
void setup()
{
Serial.begin(9600);
pinMode(ledPin, OUTPUT); // sets the digital pin as output
}
40
Arduino's Hello World: LED blinking
/*
Blink
Turn on and off a LED every one second
*/
void setup()
{
Serial.begin(9600); Setup the serial
pinMode(ledPin, OUTPUT); // sets the digital pin as output
connections and LED
}
41
Arduino's Hello World: LED blinking
/*
Blink
Turn on and off a LED every one second
*/
void setup()
{
Serial.begin(9600);
pinMode(ledPin, OUTPUT); // sets the digital pin as output
}
// the loop routine runs over and over again forever: Turn the LED on and off
void loop() continuously in the loop
{
digitalWrite(ledPin, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(ledPin, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}
42
LED and Servo control via Android Application
43
Thank you for the attention
Daniele Ronzani
dronzani@math.unipd.it
44