vom widerstand zum arduino

87
Vom Widerstand zum Arduino Mobile Tech Conference 2014 18.03.2014, Lars Gregori, msgGillardon AG

Upload: lars-gregori

Post on 18-Jun-2015

265 views

Category:

Internet


7 download

DESCRIPTION

IOT beginnt mit Elektronik. Wer mit IOT anfangen möchte, muss sich auch mit Elektronik auseinandersetzen. Für die meisten eine komplett neue Welt, aber Arduino & Co machen den Einstieg einfach. Dioden, Widerstände, Kondensatoren, Sensoren, etc. sollte man mal gehört haben. Man muss schon etwas Zeit investieren, aber die Hemmschwelle ist dank Arduino & Co stark gesunken.

TRANSCRIPT

Page 1: Vom Widerstand Zum Arduino

Vom Widerstand zum Arduino

Mobile Tech Conference 2014

18.03.2014, Lars Gregori, msgGillardon AG

Page 2: Vom Widerstand Zum Arduino

© 2014 Lars Gregori, msgGillardon AG | Vom Widerstand zum Arduino | 18.03.2014

Lars Gregori

Kommunikationselektroniker (Funktechnik)

Informatik Fachrichtung Wirtschaft (FH)

Softwareentwickler (Java Enterprise)

Arduino

2

Page 3: Vom Widerstand Zum Arduino

© 2014 Lars Gregori, msgGillardon AG | Vom Widerstand zum Arduino | 18.03.2014 3

Page 4: Vom Widerstand Zum Arduino

© 2014 Lars Gregori, msgGillardon AG | Vom Widerstand zum Arduino | 18.03.2014 4

Page 5: Vom Widerstand Zum Arduino

© 2014 Lars Gregori, msgGillardon AG | Vom Widerstand zum Arduino | 18.03.2014

Widerstand

Schaltbild

5

Page 6: Vom Widerstand Zum Arduino

© 2014 Lars Gregori, msgGillardon AG | Vom Widerstand zum Arduino | 18.03.2014

Widerstand

Schaltbild

Ohmsches Gesetz

R = U / I [Ohm]

I = U / R [Ampere]

U = R * I [Volt]

6

Page 7: Vom Widerstand Zum Arduino

© 2014 Lars Gregori, msgGillardon AG | Vom Widerstand zum Arduino | 18.03.2014

Widerstand

Schaltbild

Ohmsches Gesetz

R = U / I [Ohm]

I = U / R [Ampere]

U = R * I [Volt]

7

Page 8: Vom Widerstand Zum Arduino

© 2014 Lars Gregori, msgGillardon AG | Vom Widerstand zum Arduino | 18.03.2014

Widerstand

Schaltbild

Ohmsches Gesetz

R = U / I [Ohm]

I = U / R [Ampere]

U = R * I [Volt]

8

Page 9: Vom Widerstand Zum Arduino

© 2014 Lars Gregori, msgGillardon AG | Vom Widerstand zum Arduino | 18.03.2014

Widerstand

Schaltbild

Ohmsches Gesetz

R = U / I [Ohm]

I = U / R [Ampere]

U = R * I [Volt]

9

Page 10: Vom Widerstand Zum Arduino

© 2014 Lars Gregori, msgGillardon AG | Vom Widerstand zum Arduino | 18.03.2014

Widerstand

Schaltbild

Ohmsches Gesetz

R = U / I [Ohm]

I = U / R [Ampere]

U = R * I [Volt]

10

Page 11: Vom Widerstand Zum Arduino

© 2014 Lars Gregori, msgGillardon AG | Vom Widerstand zum Arduino | 18.03.2014

Widerstand

Schaltbild

Ohmsches Gesetz

R = U / I [Ohm]

I = U / R [Ampere]

U = R * I [Volt]

11

Page 12: Vom Widerstand Zum Arduino

© 2014 Lars Gregori, msgGillardon AG | Vom Widerstand zum Arduino | 18.03.2014 12

Page 13: Vom Widerstand Zum Arduino

© 2014 Lars Gregori, msgGillardon AG | Vom Widerstand zum Arduino | 18.03.2014

Schaltbild

light-emitting diode

LED

13

Page 14: Vom Widerstand Zum Arduino

© 2014 Lars Gregori, msgGillardon AG | Vom Widerstand zum Arduino | 18.03.2014 14

Page 15: Vom Widerstand Zum Arduino

© 2014 Lars Gregori, msgGillardon AG | Vom Widerstand zum Arduino | 18.03.2014

Diode

Schaltbild

15

Page 16: Vom Widerstand Zum Arduino

© 2014 Lars Gregori, msgGillardon AG | Vom Widerstand zum Arduino | 18.03.2014

Diode

Schaltbild

Sinus von +5V bis -5V

16

ohne Diode

Page 17: Vom Widerstand Zum Arduino

© 2014 Lars Gregori, msgGillardon AG | Vom Widerstand zum Arduino | 18.03.2014

Schaltbild

Sinus von +5V bis -5V

Diode

17

mit Diode

Page 18: Vom Widerstand Zum Arduino

© 2014 Lars Gregori, msgGillardon AG | Vom Widerstand zum Arduino | 18.03.2014 18

Page 19: Vom Widerstand Zum Arduino

© 2014 Lars Gregori, msgGillardon AG | Vom Widerstand zum Arduino | 18.03.2014

LED

Polung Kathode (Minus)?

19

Page 20: Vom Widerstand Zum Arduino

© 2014 Lars Gregori, msgGillardon AG | Vom Widerstand zum Arduino | 18.03.2014

LED

Polung Kathode (Minus) flache Seite

20

Page 21: Vom Widerstand Zum Arduino

© 2014 Lars Gregori, msgGillardon AG | Vom Widerstand zum Arduino | 18.03.2014

LED

Polung Kathode (Minus) kurzes Bein

21

Page 22: Vom Widerstand Zum Arduino

© 2014 Lars Gregori, msgGillardon AG | Vom Widerstand zum Arduino | 18.03.2014

LED

Polung

22

falsch

Page 23: Vom Widerstand Zum Arduino

© 2014 Lars Gregori, msgGillardon AG | Vom Widerstand zum Arduino | 18.03.2014

Polung

LED

23

richtig

Page 24: Vom Widerstand Zum Arduino

© 2014 Lars Gregori, msgGillardon AG | Vom Widerstand zum Arduino | 18.03.2014

Polung

LED

24

richtig

?

Page 25: Vom Widerstand Zum Arduino

© 2014 Lars Gregori, msgGillardon AG | Vom Widerstand zum Arduino | 18.03.2014

Vorwiderstand

LED

25

?

Page 26: Vom Widerstand Zum Arduino

© 2014 Lars Gregori, msgGillardon AG | Vom Widerstand zum Arduino | 18.03.2014

Datenblatt

LED

26

Page 27: Vom Widerstand Zum Arduino

© 2014 Lars Gregori, msgGillardon AG | Vom Widerstand zum Arduino | 18.03.2014

Datenblatt

LED

27

Page 28: Vom Widerstand Zum Arduino

© 2014 Lars Gregori, msgGillardon AG | Vom Widerstand zum Arduino | 18.03.2014

Vorwiderstand

LED

28

?

ILED = 18mA ULED = 2,2V

Page 29: Vom Widerstand Zum Arduino

© 2014 Lars Gregori, msgGillardon AG | Vom Widerstand zum Arduino | 18.03.2014

Vorwiderstand

LED

29

ILED = 18mA ULED = 2,2V

IR = 18mA UR = R = ?

Page 30: Vom Widerstand Zum Arduino

© 2014 Lars Gregori, msgGillardon AG | Vom Widerstand zum Arduino | 18.03.2014

Vorwiderstand

LED

30

ILED = 18mA ULED = 2,2V

IR = 18mA UR = 5V – 2,2V = 2,8V R =

Page 31: Vom Widerstand Zum Arduino

© 2014 Lars Gregori, msgGillardon AG | Vom Widerstand zum Arduino | 18.03.2014

Vorwiderstand

LED

31

ILED = 18mA ULED = 2,2V

IR = 18mA UR = 5V – 2,2V = 2,8V R = U / I = 2,8V / 18mA = 155 Ohm

Page 32: Vom Widerstand Zum Arduino

© 2014 Lars Gregori, msgGillardon AG | Vom Widerstand zum Arduino | 18.03.2014

Vorwiderstand

LED

32

ILED = 18mA ULED = 2,2V

IR = 18mA UR = 5V – 2,2V = 2,8V R = U / I = 2,8V / 18mA = 155 Ohm

Page 33: Vom Widerstand Zum Arduino

© 2014 Lars Gregori, msgGillardon AG | Vom Widerstand zum Arduino | 18.03.2014 33

Page 34: Vom Widerstand Zum Arduino

© 2014 Lars Gregori, msgGillardon AG | Vom Widerstand zum Arduino | 18.03.2014

LED

Ein-Schalten

34

Page 35: Vom Widerstand Zum Arduino

© 2014 Lars Gregori, msgGillardon AG | Vom Widerstand zum Arduino | 18.03.2014

LED

Ein-Schalten

35

int led = 13; void setup() { pinMode(led, OUTPUT); } void loop() { digitalWrite(led, HIGH); }

Page 36: Vom Widerstand Zum Arduino

© 2014 Lars Gregori, msgGillardon AG | Vom Widerstand zum Arduino | 18.03.2014

LED

Blinken

36

Page 37: Vom Widerstand Zum Arduino

© 2014 Lars Gregori, msgGillardon AG | Vom Widerstand zum Arduino | 18.03.2014

LED

Blinken

37

Page 38: Vom Widerstand Zum Arduino

© 2014 Lars Gregori, msgGillardon AG | Vom Widerstand zum Arduino | 18.03.2014

LED

Fade

“analog”

PWM

38

int led = 9; int brightness = 0; int fadeAmount = 5; void setup() { pinMode(led, OUTPUT); } void loop() { analogWrite(led, brightness); brightness = brightness + fadeAmount; if (brightness == 0 || brightness == 255) { fadeAmount = -fadeAmount; } delay(30); }

Page 39: Vom Widerstand Zum Arduino

© 2014 Lars Gregori, msgGillardon AG | Vom Widerstand zum Arduino | 18.03.2014

Pulse Width Modulation (PWM)

http://arduino.cc/en/Tutorial/PWM

39

Page 40: Vom Widerstand Zum Arduino

© 2014 Lars Gregori, msgGillardon AG | Vom Widerstand zum Arduino | 18.03.2014 40

Page 41: Vom Widerstand Zum Arduino

© 2014 Lars Gregori, msgGillardon AG | Vom Widerstand zum Arduino | 18.03.2014

Servo Motor

#include <Servo.h>

myservo.attach

myservo.write

41

Page 42: Vom Widerstand Zum Arduino

© 2014 Lars Gregori, msgGillardon AG | Vom Widerstand zum Arduino | 18.03.2014 42

Page 43: Vom Widerstand Zum Arduino

© 2014 Lars Gregori, msgGillardon AG | Vom Widerstand zum Arduino | 18.03.2014

Motor

“Each pin can provide or receive a maximum of 40 mA” http://arduino.cc/en/Main/arduinoBoardUno

43

Page 44: Vom Widerstand Zum Arduino

© 2014 Lars Gregori, msgGillardon AG | Vom Widerstand zum Arduino | 18.03.2014 44

Page 45: Vom Widerstand Zum Arduino

© 2014 Lars Gregori, msgGillardon AG | Vom Widerstand zum Arduino | 18.03.2014

Transistor

Schaltbild

Verstärker

45

Page 46: Vom Widerstand Zum Arduino

© 2014 Lars Gregori, msgGillardon AG | Vom Widerstand zum Arduino | 18.03.2014

Transistor

46

Page 47: Vom Widerstand Zum Arduino

© 2014 Lars Gregori, msgGillardon AG | Vom Widerstand zum Arduino | 18.03.2014

Transistor

47

Page 48: Vom Widerstand Zum Arduino

© 2014 Lars Gregori, msgGillardon AG | Vom Widerstand zum Arduino | 18.03.2014 48

Page 49: Vom Widerstand Zum Arduino

© 2014 Lars Gregori, msgGillardon AG | Vom Widerstand zum Arduino | 18.03.2014

Motor

Schutzdiode

49

Page 50: Vom Widerstand Zum Arduino

© 2014 Lars Gregori, msgGillardon AG | Vom Widerstand zum Arduino | 18.03.2014 50

Page 51: Vom Widerstand Zum Arduino

© 2014 Lars Gregori, msgGillardon AG | Vom Widerstand zum Arduino | 18.03.2014

Relais

51

Page 52: Vom Widerstand Zum Arduino

© 2014 Lars Gregori, msgGillardon AG | Vom Widerstand zum Arduino | 18.03.2014 52

Page 53: Vom Widerstand Zum Arduino

© 2014 Lars Gregori, msgGillardon AG | Vom Widerstand zum Arduino | 18.03.2014

Microcontroller ATmega328

Operating Voltage 5V

Input Voltage (recommended) 7-12V

Input Voltage (limits) 6-20V

Digital I/O Pins 14 (of which 6 provide PWM output)

Analog Input Pins 6

DC Current per I/O Pin 40 mA

DC Current for 3.3V Pin 50 mA

Flash Memory 32 KB (ATmega328) of which 0.5 KB used by bootloader

SRAM 2 KB (ATmega328)

EEPROM 1 KB (ATmega328)

Clock Speed 16 MHz

Arduino Uno : http://arduino.cc/en/Main/ArduinoBoardUno

53

Page 54: Vom Widerstand Zum Arduino

© 2014 Lars Gregori, msgGillardon AG | Vom Widerstand zum Arduino | 18.03.2014

Schaltplan

54

Page 55: Vom Widerstand Zum Arduino

© 2014 Lars Gregori, msgGillardon AG | Vom Widerstand zum Arduino | 18.03.2014

Schaltplan

55

Page 56: Vom Widerstand Zum Arduino

© 2014 Lars Gregori, msgGillardon AG | Vom Widerstand zum Arduino | 18.03.2014

Language

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

Structure setup

loop

Variables HIGH, LOW

Functions pinMode

digitalWrite

digitalRead

56

Page 57: Vom Widerstand Zum Arduino

© 2014 Lars Gregori, msgGillardon AG | Vom Widerstand zum Arduino | 18.03.2014

Standard Libraries

EEPROM

LiquidCrystal - for controlling liquid crystal displays (LCDs)

Servo - for controlling servo motors

57

Page 58: Vom Widerstand Zum Arduino

© 2014 Lars Gregori, msgGillardon AG | Vom Widerstand zum Arduino | 18.03.2014 58

Page 59: Vom Widerstand Zum Arduino

© 2014 Lars Gregori, msgGillardon AG | Vom Widerstand zum Arduino | 18.03.2014

LiquidCrystal.h

http://www.arduino.cc/en/Tutorial/LiquidCrystal

59

#include <LiquidCrystal.h> LiquidCrystal lcd(12, 11, 5, 4, 3, 2); void setup() { lcd.begin(16, 2); lcd.print("hello, world!"); }

Page 60: Vom Widerstand Zum Arduino

© 2014 Lars Gregori, msgGillardon AG | Vom Widerstand zum Arduino | 18.03.2014

LiquidCrystal.h

http://www.arduino.cc/en/Tutorial/LiquidCrystal

60

Page 61: Vom Widerstand Zum Arduino

© 2014 Lars Gregori, msgGillardon AG | Vom Widerstand zum Arduino | 18.03.2014 61

Page 63: Vom Widerstand Zum Arduino

© 2014 Lars Gregori, msgGillardon AG | Vom Widerstand zum Arduino | 18.03.2014 63

Page 64: Vom Widerstand Zum Arduino

© 2014 Lars Gregori, msgGillardon AG | Vom Widerstand zum Arduino | 18.03.2014

Sensoren

64

Page 65: Vom Widerstand Zum Arduino

© 2014 Lars Gregori, msgGillardon AG | Vom Widerstand zum Arduino | 18.03.2014

Sensoren

65

Page 66: Vom Widerstand Zum Arduino

© 2014 Lars Gregori, msgGillardon AG | Vom Widerstand zum Arduino | 18.03.2014

Sensoren DIY

Capacitive Sensing Library

http://playground.arduino.cc/Main/CapacitiveSensor?from=Main.CapSense

66

Page 67: Vom Widerstand Zum Arduino

© 2014 Lars Gregori, msgGillardon AG | Vom Widerstand zum Arduino | 18.03.2014 67

Page 68: Vom Widerstand Zum Arduino

© 2014 Lars Gregori, msgGillardon AG | Vom Widerstand zum Arduino | 18.03.2014

Kommunikation Master-Slave-Bus

Two Wire Interface (TWI) bzw. I²C 2 Signalleitungen (SDA und SCL)

Serial Peripheral Interface (SPI) 4 Signalleitungen (SCK, MOSI, MOSO, SS)

68

Page 69: Vom Widerstand Zum Arduino

© 2014 Lars Gregori, msgGillardon AG | Vom Widerstand zum Arduino | 18.03.2014

Firmata

Standard Library for communicating with applications on the computer using

a standard serial protocol

http://firmata.org/

Computer ist der Host

Jede Programmiersprache, die den Serial Port unterstützt. http://firmata.org/wiki/Download

69

Page 70: Vom Widerstand Zum Arduino

© 2014 Lars Gregori, msgGillardon AG | Vom Widerstand zum Arduino | 18.03.2014 70

Page 71: Vom Widerstand Zum Arduino

© 2014 Lars Gregori, msgGillardon AG | Vom Widerstand zum Arduino | 18.03.2014 71

Page 72: Vom Widerstand Zum Arduino

© 2014 Lars Gregori, msgGillardon AG | Vom Widerstand zum Arduino | 18.03.2014 72

Page 73: Vom Widerstand Zum Arduino

© 2014 Lars Gregori, msgGillardon AG | Vom Widerstand zum Arduino | 18.03.2014 73

Page 74: Vom Widerstand Zum Arduino

© 2014 Lars Gregori, msgGillardon AG | Vom Widerstand zum Arduino | 18.03.2014 74

Page 75: Vom Widerstand Zum Arduino

© 2014 Lars Gregori, msgGillardon AG | Vom Widerstand zum Arduino | 18.03.2014

ATTiny 85

Atmel 8-bit AVR Microcontroller

8 KBytes In-System Programmable Program Memory Flash

512 Bytes In-System Programmable EEPROM

512 Bytes Internal SRAM

2.7V - 5.5V (ATtiny85), 1.8V - 5.5V (ATtiny85V)

75

Page 76: Vom Widerstand Zum Arduino

© 2014 Lars Gregori, msgGillardon AG | Vom Widerstand zum Arduino | 18.03.2014

ATTiny 85

6 I/O Pins

2 High Frequency PWM Outputs

4 ADC (10-bit)

76

Page 77: Vom Widerstand Zum Arduino

© 2014 Lars Gregori, msgGillardon AG | Vom Widerstand zum Arduino | 18.03.2014 77

Page 78: Vom Widerstand Zum Arduino

© 2014 Lars Gregori, msgGillardon AG | Vom Widerstand zum Arduino | 18.03.2014 78

Page 79: Vom Widerstand Zum Arduino

© 2014 Lars Gregori, msgGillardon AG | Vom Widerstand zum Arduino | 18.03.2014

Shields

Standard Libaries SD

Ethernet

WiFi

GSM

TFT

79

Page 80: Vom Widerstand Zum Arduino

© 2014 Lars Gregori, msgGillardon AG | Vom Widerstand zum Arduino | 18.03.2014 80

Page 81: Vom Widerstand Zum Arduino

© 2014 Lars Gregori, msgGillardon AG | Vom Widerstand zum Arduino | 18.03.2014

IOIO Board

pronounced "yo-yo"

https://github.com/ytai/ioio/wiki

Host für Android und PC USB oder Bluetooth

high-level Java API (Android Apps)

Digital Input/Output, PWM, Analog Input, I2C, SPI und UART

81

Page 82: Vom Widerstand Zum Arduino

© 2014 Lars Gregori, msgGillardon AG | Vom Widerstand zum Arduino | 18.03.2014 82

Page 83: Vom Widerstand Zum Arduino

© 2014 Lars Gregori, msgGillardon AG | Vom Widerstand zum Arduino | 18.03.2014

Raspberry PI

http://www.raspberrypi.org/faqs

700-MHz-ARM11-Prozessor

256 oder 512 MB RAM

Ethernet

2 USB

Linux

83

Page 84: Vom Widerstand Zum Arduino

© 2014 Lars Gregori, msgGillardon AG | Vom Widerstand zum Arduino | 18.03.2014

GPIO - General Purpose Input / Output

17 GPIO Pins für Ein- oder Ausgabe

3,3V (level shifter)

SPI, I²C und UART

Programmierung zum Beispiel mit Python

… oder Bash

84

echo "4" > /sys/class/gpio/export echo "in" > /sys/class/gpio/gpio4/direction cat /sys/class/gpio/gpio4/value 0 echo "4" > /sys/class/gpio/unexport

Page 85: Vom Widerstand Zum Arduino

© 2014 Lars Gregori, msgGillardon AG | Vom Widerstand zum Arduino | 18.03.2014

85

Fragen

Page 86: Vom Widerstand Zum Arduino

Wir bedanken uns für Ihre Aufmerksamkeit!

msgGillardon AG

Robert-Bürkle-Str. 1

85737 Ismaning

> www.msg-gillardon.de

Page 87: Vom Widerstand Zum Arduino

© 2014 Lars Gregori, msgGillardon AG | Vom Widerstand zum Arduino | 18.03.2014

Credit

Fonts Famirids http://www.dafont.com/famirids.font

Petita http://www.dafont.com/petita.font

87