MAKING THINGS TALK An introduction to the basics of making with Arduino |  HAW x MASE |  Hamburg, Germany |  16.04.2012 flickr user hildeengwenverbouwen Jörn Sandner |  Prof. Franziska Hübler |  Jeremy Tai Abbett
TOPICS Introduction Introduction in Programming Basic Electronics Getting Started The Arduino Board Exercises Image via http://vasastudio.com/
TOPICS Introduction Introduction in Programming Basic Electronics Getting Started The Arduino Board Exercises
WHAT ARE WE DOING Hardware Getting closer to electronic circuits Software Writing simple software for hardware
THE ONE IN FRONT Jörn Sandner Master Microelectronic Systems Study at the FH Heide plus one semester at the HAW Hamburg
TOPICS Introduction Introduction in Programming Basic Electronics Getting Started The Arduino Board Exercises
VOLTAGE & CURRENT Voltage: speed of Current: amount the electrons of electrons > potential difference > resistance of the circuit
CIRCUIT button light (LED) resistor + - battery
CIRCUIT current direction + - battery
FUNCTIONAL VIEW “input” “output” button light (LED) resistor + - battery
FUNCTIONAL VIEW “input” “output” button light (LED) resistor + - battery NOW: Put some “intelligence” in between
TOPICS Introduction Introduction in Programming Basic Electronics Getting Started The Arduino Board Exercises
THE ARDUINO BOARD Serial to USB Converter Digital In & Out Pins USB Port Power LED Microcontroller Power Supply Connection Power Pins Analog Input 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 voltage HIGH 5V+ 4 3 2 1 LOW GND 0 1 2 3 4 5 6 7 8 9 10 time
DIGITAL PORTS “input” “output” On/Off On/Off
ANALOG PORTS ‣ Value range instead of state ‣ Input 0 -1023 ‣ Output 0 -255 (analog output shared with digital out)
ANALOG PORTS 0 1023 255 0
ANALOG IN voltage 5V+ 4 3 2 1 GND 0 1 2 3 4 5 6 7 8 9 10 time
ANALOG OUT ‣ There is no real variable voltage output ‣ Analog signal is generated by waveform with constant voltage and constant frequency
ANALOG OUT voltage 5V+ 4 3 2 1 GND 0 1 2 3 4 5 6 7 8 9 10 time
ANALOG OUT Always same period voltage Always 5V 5V+ 4 3 2 1 GND 0 1 2 3 4 5 6 7 8 9 10 time
ANALOG OUT Always same period voltage Always 5V 5V+ 4 Getting different values by moving the middle 3 line within the period 2 1 GND 0 1 2 3 4 5 6 7 8 9 10 time
ANALOG OUT voltage 50% 75% 25% 100% 5V+ 4 3 2 1 GND 0 1 2 3 4 5 6 7 8 9 10 time
ANALOG OUT voltage 5V+ 4 3 2 1 GND 0 1 2 3 4 5 6 7 8 9 10 time
ANALOG RANGE ADAPTION 1023 255 0 0
TOPICS Introduction Introduction in Programming Basic Electronics Getting Started The Arduino Board Exercises
PROGRAMMING Basic setup (bare minimum) void setup() { // running one time // do basic setup of the Arduino Board } void loop() { // running for ever // your code }
PROGRAMMING Blink /*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 }
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++) { // }
SOME FUNCTIONS ‣ pinMode() ‣ digitalWrite() ‣ digitalRead() ‣ analogReference() ‣ analogRead() ‣ analogWrite() – PWM ‣ outValue = map (inValue, 0, 1023, 0, 255); // remember range conversion See http://arduino.cc/en/Reference/HomePage
TOPICS Introduction Introduction in Programming Basic Electronics Getting Started The Arduino Board Exercises
GETTING STARTED WITH BLINKING LED ‣ Gather in groups ‣ Get a Fritzing Kit ‣ Start Arduino software ‣ Follow me…
TOPICS Introduction Introduction in Programming Basic Electronics Getting Started The Arduino Board Exercises
ANALOG OUT WITH 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 Lady Ada Sensors http://www.ladyada.net/learn/sensors/ Interfacing With Hardware http://arduino.cc/playground/Main/InterfacingWithHardware Index of Arudino Knowledge http://www.freeduino.org/ 20 cm
THE END OF THE BEGINNING Jörn Sandner |  Prof. Franziska Hübler |  Jeremy Tai Abbett Truth Dare Double Dare |  www.truthdaredoubledare.com |  hello@truthdaredoubledare.com

Arduino Basics

  • 1.
    MAKING THINGS TALK An introduction to the basics of making with Arduino |  HAW x MASE |  Hamburg, Germany |  16.04.2012 flickr user hildeengwenverbouwen Jörn Sandner |  Prof. Franziska Hübler |  Jeremy Tai Abbett
  • 2.
    TOPICS Introduction Introduction in Programming Basic Electronics Getting Started The Arduino Board Exercises Image via http://vasastudio.com/
  • 3.
    TOPICS Introduction Introduction in Programming Basic Electronics Getting Started The Arduino Board Exercises
  • 4.
    WHAT ARE WEDOING Hardware Getting closer to electronic circuits Software Writing simple software for hardware
  • 5.
    THE ONE INFRONT Jörn Sandner Master Microelectronic Systems Study at the FH Heide plus one semester at the HAW Hamburg
  • 7.
    TOPICS Introduction Introduction in Programming Basic Electronics Getting Started The Arduino Board Exercises
  • 8.
    VOLTAGE & CURRENT Voltage:speed of Current: amount the electrons of electrons > potential difference > resistance of the circuit
  • 9.
    CIRCUIT button light (LED) resistor + - battery
  • 10.
  • 11.
    FUNCTIONAL VIEW “input” “output” button light (LED) resistor + - battery
  • 12.
    FUNCTIONAL VIEW “input” “output” button light (LED) resistor + - battery NOW: Put some “intelligence” in between
  • 13.
    TOPICS Introduction Introduction in Programming Basic Electronics Getting Started The Arduino Board Exercises
  • 14.
    THE ARDUINO BOARD Serial to USB Converter Digital In & Out Pins USB Port Power LED Microcontroller Power Supply Connection Power Pins Analog Input Pins
  • 15.
  • 16.
    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
  • 17.
    DIGITAL OUT /DIGITAL IN voltage HIGH 5V+ 4 3 2 1 LOW GND 0 1 2 3 4 5 6 7 8 9 10 time
  • 18.
    DIGITAL PORTS “input” “output” On/Off On/Off
  • 19.
    ANALOG PORTS ‣ Value range instead of state ‣ Input 0 -1023 ‣ Output 0 -255 (analog output shared with digital out)
  • 20.
    ANALOG PORTS 0 1023 255 0
  • 21.
    ANALOG IN voltage 5V+ 4 3 2 1 GND 0 1 2 3 4 5 6 7 8 9 10 time
  • 22.
    ANALOG OUT ‣ Thereis no real variable voltage output ‣ Analog signal is generated by waveform with constant voltage and constant frequency
  • 23.
    ANALOG OUT voltage 5V+ 4 3 2 1 GND 0 1 2 3 4 5 6 7 8 9 10 time
  • 24.
    ANALOG OUT Always same period voltage Always 5V 5V+ 4 3 2 1 GND 0 1 2 3 4 5 6 7 8 9 10 time
  • 25.
    ANALOG OUT Always same period voltage Always 5V 5V+ 4 Getting different values by moving the middle 3 line within the period 2 1 GND 0 1 2 3 4 5 6 7 8 9 10 time
  • 26.
    ANALOG OUT voltage 50% 75% 25% 100% 5V+ 4 3 2 1 GND 0 1 2 3 4 5 6 7 8 9 10 time
  • 27.
    ANALOG OUT voltage 5V+ 4 3 2 1 GND 0 1 2 3 4 5 6 7 8 9 10 time
  • 28.
  • 29.
    TOPICS Introduction Introduction in Programming Basic Electronics Getting Started The Arduino Board Exercises
  • 30.
    PROGRAMMING Basic setup (bare minimum) void setup() { // running one time // do basic setup of the Arduino Board } void loop() { // running for ever // your code }
  • 31.
    PROGRAMMING Blink /*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 }
  • 32.
    SOME STRUCTURES ‣ YourArduino 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
  • 33.
    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++) { // }
  • 34.
    SOME FUNCTIONS ‣ pinMode() ‣digitalWrite() ‣ digitalRead() ‣ analogReference() ‣ analogRead() ‣ analogWrite() – PWM ‣ outValue = map (inValue, 0, 1023, 0, 255); // remember range conversion See http://arduino.cc/en/Reference/HomePage
  • 35.
    TOPICS Introduction Introduction in Programming Basic Electronics Getting Started The Arduino Board Exercises
  • 36.
    GETTING STARTED WITHBLINKING LED ‣ Gather in groups ‣ Get a Fritzing Kit ‣ Start Arduino software ‣ Follow me…
  • 37.
    TOPICS Introduction Introduction in Programming Basic Electronics Getting Started The Arduino Board Exercises
  • 38.
    ANALOG OUT WITH FADING http://www.youtube.com/watch?v=Y2cLxmNnpOE
  • 39.
    ANALOG IN WITHSERVO AND POT http://www.youtube.com/watch?v=SS6cntJ_LqQ
  • 40.
    ANALOG IN WITHSERVO AND LDR http://www.youtube.com/watch?v=m9J3mDYy0Sg
  • 41.
    PANDORA’S BOX 20 cm Lady Ada Sensors http://www.ladyada.net/learn/sensors/ Interfacing With Hardware http://arduino.cc/playground/Main/InterfacingWithHardware Index of Arudino Knowledge http://www.freeduino.org/ 20 cm
  • 42.
    THE END OFTHE BEGINNING Jörn Sandner |  Prof. Franziska Hübler |  Jeremy Tai Abbett Truth Dare Double Dare |  www.truthdaredoubledare.com |  hello@truthdaredoubledare.com