Arduino Basics

Preview:

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

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

Introduction

Basic Electronics

The Arduino Board

Introduction in Programming

Getting Started

Exercises

TOPICS

Imag

e vi

a ht

tp://

vasa

stud

io.c

om/

Introduction

Basic Electronics

The Arduino Board

Introduction in Programming

Getting Started

Exercises

TOPICS

WHAT ARE WE DOING

SoftwareWriting simple software for hardware

HardwareGetting closer to electronic circuits

Study at the FH Heideplus one semester at the HAW Hamburg

Master Microelectronic Systems

THE ONE IN FRONT

Jörn Sandner

Introduction

Basic Electronics

The Arduino Board

Introduction in Programming

Getting Started

Exercises

TOPICS

VOLTAGE & CURRENT

Voltage: speed of the electrons> potential difference

Current: amount of electrons> resistance of the circuit

CIRCUIT

+ -

battery

button light (LED)

resistor

CIRCUIT

+ -

battery

current direction

FUNCTIONAL VIEW

+ -

battery

button light (LED)

resistor

“input” “output”

FUNCTIONAL VIEW

+ -

battery

button light (LED)

resistor

“input” “output”

NOW: Put some “intelligence” in between

Introduction

Basic Electronics

The Arduino Board

Introduction in Programming

Getting Started

Exercises

TOPICS

THE ARDUINO BOARD

USB Port

Serial to USB Converter

Power Supply Connection

Digital In & Out Pins

Power LED

Microcontroller

Analog Input PinsPower Pins

SOFTWARE

arduino.cc fritzing.org

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

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

DIGITAL PORTS

“input”On/Off

“output”On/Off

ANALOG PORTS

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

shared with digital out)

ANALOG PORTS

0 1023

0

255

ANALOG IN

time

voltage

GND

5V+

4

3

2

1

0 1 2 3 4 5 6 7 8 9 10

ANALOG OUT

‣There is no real variable voltage output

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

ANALOG OUT

time

voltage

GND

5V+

4

3

2

1

0 1 2 3 4 5 6 7 8 9 10

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

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

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%

ANALOG OUT

time

voltage

GND

5V+

4

3

2

1

0 1 2 3 4 5 6 7 8 9 10

ANALOG RANGE ADAPTION

1023

0

255

0

Introduction

Basic Electronics

The Arduino Board

Introduction in Programming

Getting Started

Exercises

TOPICS

PROGRAMMING

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

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

}

Basic setup (bare minimum)

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

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

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++) { // }

‣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

Introduction

Basic Electronics

The Arduino Board

Introduction in Programming

Getting Started

Exercises

TOPICS

GETTING STARTEDWITH BLINKING LED

‣Gather in groups

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

Introduction

Basic Electronics

The Arduino Board

Introduction in Programming

Getting Started

Exercises

TOPICS

ANALOG OUTWITH FADING

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

ANALOG IN WITH SERVO AND POT

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

ANALOG IN WITH SERVO AND LDR

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

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/

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

Truth Dare Double Dare |  www.truthdaredoubledare.com |  hello@truthdaredoubledare.com

Recommended