$30 off During Our Annual Pro Sale. View Details »

Arduino: Why, Which, and How

Theo Pak
September 24, 2014

Arduino: Why, Which, and How

Intro to Arduino
============

Presented by request for MANE-4220 "Inventor's Studio" (Prof. Swersey) with the support of RPI Embedded Hardware Club.

"What's an Arduino?"

1. Why use an Arduino?
2. Which type of Arduino?
3. How?

Join the Embedded Hardware Club mailing list to get info about upcoming workshops and events. Check us out at http://facebook.com/rpiEHC and http://rpiEHC.org.

- Theo Pak
- [email protected]
- facebook.com/rpiEHC

Theo Pak

September 24, 2014
Tweet

More Decks by Theo Pak

Other Decks in How-to & DIY

Transcript

  1. INTRO TO ARDUINO
    @theopak Sept 24, 2014

    View Slide

  2. WHAT’S AN
    ARDUINO?

    View Slide

  3. View Slide

  4. ARDUINO
    • Microcontroller platform
    • Open source
    • You can make cool stuff with it
    • You program it with the Arduino language 

    using the Arduino software (Mac, PC, or linux)

    View Slide

  5. 1. Why use an Arduino?
    2. Which type of Arduino?
    3. How?

    View Slide

  6. 1. Why use an Arduino?
    2. Which type of Arduino?
    3. How?

    View Slide

  7. CASE STUDY: HACKATHON WINNERS
    • Silicon Chef (Nov 2012)
    • 4 people
    • 6 hours
    • Engineering professors hated it
    • Engineering professors awarded first place

    View Slide

  8. View Slide

  9. View Slide

  10. View Slide

  11. View Slide

  12. WHY USE AN ARDUINO?
    • Easier to learn than alternatives.
    • Widely available for cheap!
    • Tons of code already exists.
    • Generally appropriate for real-time.
    • Not always the best choice, especially because:
    • Other options have better specs.
    • Other options use lower power.

    View Slide

  13. View Slide

  14. 1. Why use an Arduino?
    2. Which type of Arduino?
    3. How?

    View Slide

  15. TYPES OF ARDUINOS
    Nano >$14
    ATmega328p
    small, cheap,
    breadboardable
    Leonardo $20
    ATmega32u4
    cheap, more GPIO
    Y
    dual p
    Linux

    View Slide

  16. TYPES OF ARDUINOS
    Due $50
    32-bit ARM
    tons of GPIO
    Yún $70
    dual processors
    Linux, WiFi, etc.
    $20
    2u4
    GPIO

    View Slide

  17. 1. Why use an Arduino?
    2. Which type of Arduino?
    3. How?

    View Slide

  18. Install the Arduino IDE via
    arduino.cc/en/Main/Software

    View Slide

  19. EXAMPLE CIRCUIT: DIGITAL OUTPUT
    Switch on D5, LED on D13

    View Slide

  20. EXAMPLE CODE: FLASH AN LED
    void setup () {
    pinMode(13,OUTPUT);
    }
    void loop () {
    // Turn LED on
    digitalWrite(13,HIGH);
    delay(100); // Wait 100 milliseconds
    // Turn LED off
    digitalWrite(13,LOW);
    delay(100); // Wait 100 milliseconds
    }

    View Slide

  21. EXAMPLE CODE: BUTTON INPUT
    void setup () {
    pinMode(13,OUTPUT); // Configure Pin13 as output
    pinMode(5,INPUT); // Configure Pin5 as input
    }
    void loop () {
    // If the button is pressed...
    if (digitalRead(5)) {
    // ...then turn LED on
    digitalWrite(13,HIGH);
    } else {
    // ...if not, the turn LED off
    digitalWrite(13,LOW);
    }
    }

    View Slide

  22. EXAMPLE CODE: SERVO MOTOR
    #include
    Servo myservo; //create servo object to control a servo motor
    void setup () {
    myservo.attach(9); //attach pin 9 to the servo object
    }
    void loop () {
    for (int i = 0; i < 255; i ++) {
    // set the servo position
    myservo.write(i); // generate PPM signal
    // wait for the servo to get there
    delay(15);
    }
    }

    View Slide

  23. THEO PAK
    [email protected]
    Sage 2202 Wednesdays 6–8pm

    View Slide

  24. Embedded Hardware Club
    facebook.com/rpiEHC

    View Slide