42
MAKING THINGS TALK An introduction to the basics of making with Arduino | HAW x MASE | Hamburg, Germany | 16.04.2012 Jörn Sandner | Prof. Franziska Hübler | Jeremy Tai Abbett flickr user hildeengwenverbouwen

Arduino Basics

Embed Size (px)

DESCRIPTION

The basics of understanding electronics and physical interaction with Arduino presented and taught by Jörn Sandner, Prof. Franziska Hübler and Jeremy Abbett for the University of Applied Arts - Hamburg and Miami Ad School Europe.

Citation preview

Page 1: Arduino Basics

MAKING THINGS TALKAn introduction to the basics of making with Arduino |  HAW x MASE |  Hamburg, Germany |  16.04.2012

Jörn Sandner |  Prof. Franziska Hübler |  Jeremy Tai Abbett

flick

r use

r hild

eeng

wen

verb

ouw

en

Page 2: Arduino Basics

Introduction

Basic Electronics

The Arduino Board

Introduction in Programming

Getting Started

Exercises

TOPICS

Imag

e vi

a ht

tp://

vasa

stud

io.c

om/

Page 3: Arduino Basics

Introduction

Basic Electronics

The Arduino Board

Introduction in Programming

Getting Started

Exercises

TOPICS

Page 4: Arduino Basics

WHAT ARE WE DOING

SoftwareWriting simple software for hardware

HardwareGetting closer to electronic circuits

Page 5: Arduino Basics

Study at the FH Heideplus one semester at the HAW Hamburg

Master Microelectronic Systems

THE ONE IN FRONT

Jörn Sandner

Page 6: Arduino Basics
Page 7: Arduino Basics

Introduction

Basic Electronics

The Arduino Board

Introduction in Programming

Getting Started

Exercises

TOPICS

Page 8: Arduino Basics

VOLTAGE & CURRENT

Voltage: speed of the electrons> potential difference

Current: amount of electrons> resistance of the circuit

Page 9: Arduino Basics

CIRCUIT

+ -

battery

button light (LED)

resistor

Page 10: Arduino Basics

CIRCUIT

+ -

battery

current direction

Page 11: Arduino Basics

FUNCTIONAL VIEW

+ -

battery

button light (LED)

resistor

“input” “output”

Page 12: Arduino Basics

FUNCTIONAL VIEW

+ -

battery

button light (LED)

resistor

“input” “output”

NOW: Put some “intelligence” in between

Page 13: Arduino Basics

Introduction

Basic Electronics

The Arduino Board

Introduction in Programming

Getting Started

Exercises

TOPICS

Page 14: Arduino Basics

THE ARDUINO BOARD

USB Port

Serial to USB Converter

Power Supply Connection

Digital In & Out Pins

Power LED

Microcontroller

Analog Input PinsPower Pins

Page 15: Arduino Basics

SOFTWARE

arduino.cc fritzing.org

Page 16: Arduino Basics

DIGITAL OUT / DIGITAL IN

‣Two States‣ ON / HIGH / 1 ‣ OFF / LOW / 0

‣Port mode (in/out)controlled by software

‣12 Ports available ‣ some with special functions

Page 17: Arduino Basics

DIGITAL OUT / DIGITAL IN

time

voltage

GND

5V+

4

3

2

1

0 1 2 3 4 5 6 7 8 9 10

HIGH

LOW

Page 18: Arduino Basics

DIGITAL PORTS

“input”On/Off

“output”On/Off

Page 19: Arduino Basics

ANALOG PORTS

‣Value range insteadof state‣ Input 0 -1023‣Output 0 -255 (analog output

shared with digital out)

Page 20: Arduino Basics

ANALOG PORTS

0 1023

0

255

Page 21: Arduino Basics

ANALOG IN

time

voltage

GND

5V+

4

3

2

1

0 1 2 3 4 5 6 7 8 9 10

Page 22: Arduino Basics

ANALOG OUT

‣There is no real variable voltage output

‣Analog signal is generated by waveform with constant voltage and constant frequency

Page 23: Arduino Basics

ANALOG OUT

time

voltage

GND

5V+

4

3

2

1

0 1 2 3 4 5 6 7 8 9 10

Page 24: Arduino Basics

ANALOG OUT

time

voltage

GND

5V+

4

3

2

1

0 1 2 3 4 5 6 7 8 9 10

Always same period

Always 5V

Page 25: Arduino Basics

ANALOG OUT

time

voltage

GND

5V+

4

3

2

1

0 1 2 3 4 5 6 7 8 9 10

Always same period

Always 5V

Getting different values by moving the middle line within the period

Page 26: Arduino Basics

ANALOG OUT

time

voltage

GND

5V+

4

3

2

1

0 1 2 3 4 5 6 7 8 9 10

50% 75% 25% 100%

Page 27: Arduino Basics

ANALOG OUT

time

voltage

GND

5V+

4

3

2

1

0 1 2 3 4 5 6 7 8 9 10

Page 28: Arduino Basics

ANALOG RANGE ADAPTION

1023

0

255

0

Page 29: Arduino Basics

Introduction

Basic Electronics

The Arduino Board

Introduction in Programming

Getting Started

Exercises

TOPICS

Page 30: Arduino Basics

PROGRAMMING

void setup() { // running one time // do basic setup of the Arduino Board}

void loop() { // running for ever // your code

}

Basic setup (bare minimum)

Page 31: Arduino Basics

PROGRAMMING

/*void setup() { // Pin 13 connected pinMode(13, OUTPUT); }

void loop() { digitalWrite(13, HIGH); // set the LED on delay(1000); // wait for a second digitalWrite(13, LOW); // set the LED off delay(1000); // wait for a second}

Blink

Page 32: Arduino Basics

SOME STRUCTURES

‣Your Arduino is busy when busy‣ One task at time

‣The program code is executed sequentially – step by step‣ A command has to wait until it‘s previous has executed

Page 33: Arduino Basics

SOME PROGRAMMING BASICS

‣Save and recall values‣ int myValue = 54;

‣Call functions‣ digitalWrite(myValue, HIGH);

‣ myValue = analogRead(0);

‣Conditional execution‣ if (myValue == 54) { // } else { // }

‣Repeat commands‣ for(int i = 0; i<10; i++) { // }

Page 34: Arduino Basics

‣pinMode()

‣digitalWrite()‣digitalRead()‣ analogReference()‣ analogRead() ‣ analogWrite() – PWM‣outValue = map (inValue, 0, 1023, 0, 255); //

remember range conversion

SOME FUNCTIONS

See http://arduino.cc/en/Reference/HomePage

Page 35: Arduino Basics

Introduction

Basic Electronics

The Arduino Board

Introduction in Programming

Getting Started

Exercises

TOPICS

Page 36: Arduino Basics

GETTING STARTEDWITH BLINKING LED

‣Gather in groups

‣Get a Fritzing Kit‣Start Arduino software‣Follow me…

Page 37: Arduino Basics

Introduction

Basic Electronics

The Arduino Board

Introduction in Programming

Getting Started

Exercises

TOPICS

Page 38: Arduino Basics

ANALOG OUTWITH FADING

http://www.youtube.com/watch?v=Y2cLxmNnpOE

Page 39: Arduino Basics

ANALOG IN WITH SERVO AND POT

http://www.youtube.com/watch?v=SS6cntJ_LqQ

Page 40: Arduino Basics

ANALOG IN WITH SERVO AND LDR

http://www.youtube.com/watch?v=m9J3mDYy0Sg

Page 41: Arduino Basics

PANDORA’S BOX

20 cm

20 cmLady Ada Sensorshttp://www.ladyada.net/learn/sensors/

Interfacing With Hardwarehttp://arduino.cc/playground/Main/InterfacingWithHardware

Index of Arudino Knowledgehttp://www.freeduino.org/

Page 42: Arduino Basics

THE END OF THE BEGINNINGJörn Sandner |  Prof. Franziska Hübler |  Jeremy Tai Abbett

Truth Dare Double Dare |  www.truthdaredoubledare.com |  [email protected]