introduction to arduino

Download Introduction to  Arduino

If you can't read please download the document

Upload: garvey

Post on 19-Mar-2016

103 views

Category:

Documents


3 download

DESCRIPTION

With ArduBlock & LilyPad Dev. Introduction to Arduino. Brian Huang Education Engineer [email protected]. Pre-Class Survey. http://bit.ly/14Xk3Ek. Resources. This PPT  ArduBlock Download & Installation  http://www.ardublock.com/. General Rules. - PowerPoint PPT Presentation

TRANSCRIPT

  • Introduction to ArduinoWith ArduBlock & LilyPad Dev

    Brian HuangEducation [email protected]

  • Pre-Class Survey

    http://bit.ly/14Xk3Ek

  • ResourcesThis PPT

    ArduBlock Download & Installation http://www.ardublock.com/

  • General RulesRaise your hand if you have a question.Be respectful.When I raise my handShare your findings with the people near you.Poke around, experiment, and have funImagine, create, and play!!!

  • ObjectivesProvide a thorough introduction to the Arduino programming environment.

    Develop a use of simple functions to interact with the LEDs, light sensor, push button, and buzzer on the Protosnap Pro Mini.

  • Arduino LilyPad Protosnap DevWhat is it?

    What can it do?

    Who cares?

  • What is it?Heart of it ATMega328 (a $4 microcontroller)Open SourceHigh tolerance for ESD and bad electronics practicesProvides easy way to interact with a computer physically a.k.a. physical computing

  • What can it do?Great for prototyping ideasGreat to teach Intro to Programming Arduino (no assembly required!)Lots and lots of options!Large pads can be sew-able

  • Who cares?Hackers / MakersEngineersArtistsMusiciansKids!Teachers!!You!!!

  • Physical Computing

  • Components, Silk Screen & Pins

    What is all this???Buzzer / SpeakerLight SensorTemp.Sensorthe Brain ATmega328RGB LEDVibe MotorSwitch / ButtonLight Emitting Diodes (LED)

  • Actual Pin-outs

  • ArduBlockIntroduction to ProgrammingScratch-like interfaceClear transition to text-based coding

  • Block OrganizationControl

  • Block OrganizationPins

  • Block OrganizationNumbers/Constants

  • Block OrganizationOperators

  • Block OrganizationOperators

  • Block OrganizationUtilities

  • Block OrganizationUtilities I2C

  • Understanding Input vs. OutputReferenced from the perspective of the microcontroller (electrical board).Inputs is a signal / information going into the board.Output is any signal exiting the board.

    Almost all systems that use physical computing will have some form of output

    What are some examples of Outputs?

  • Startup Arduino IDEDouble-click on either the Arduino Icon or wherever you installed (saved) the Arduino program.

  • Plug it in

  • Lesson #0 Configuring ArduinoSetup Board (LilyPad Arduino w/ ATmega328)Setup COM PortPC Highest COM #Mac /dev/tty.usbserial-A####xXx

  • Settings: Tools Board

  • Settings: Tools Serial Port

  • Other Board Types

  • Load ArduBlock

  • Lesson #0 Test Upload

  • Check for Status Messages

  • Lets get to hackingLesson #1 Blinking an LEDHello World of Physical Computing

    Psuedo-code how should this work?

  • Lets get to hackingLesson #1 Blinking an LEDHello World of Physical Computing

  • LED Pins161817

  • How are Analog Pins really identified?Digital Pins are numbered 0 to 13.Analog Input Pins are A0 to A5.A0 = 14A1 = 15A2 = 16A3 = 17A4 = 18A5 = 19

  • Alright? Lets blink!Challenge 1a Blink multiple LEDsPlan out a pattern can you make it?

    Challenge 1b Blink to mimic a heartbeat

    Challenge 1c Multiple LEDS Knight Rider style

  • Save your ProjectSave early, Save often!

    Enumerate your iterations (e.g. blink_10.adp, blink_11.adp, blink_12.adp)

  • Concept: Analog vs. DigitalMicrocontrollers are digital devices ON or OFF.

    An Analog signal is anything that can be a full range of values. What are some examples? Think of like a ramp or a hill.

  • Concept: Analog vs. DigitalTo create an analog signal, the microcontroller uses a technique called PWM.Pulse Width Modulation (PWM)

    Pins 3, 5, 6, 9, 10, 11 are capable of producing an Analog Output

  • Color Mixing with 3 LEDsanalogWrite()Challenge 2a:How do you turn on the RED LED?Experiment with different values what do you observe happens?How do you turn on the GREEN or the BLUE LED?

  • Color Mixing with 3 LEDsTri-color LEDThe RGB LED is a Common-Anode (means the positive side of the LED is all tied to Vcc).

    The signal line is connected to the bottom of each LED.

    Dont worry - its just a different method of completing a circuit!Pin9Pin11Pin 105 V

  • Color Mixing with 3 LEDsanalogWrite()Challenge 2b: Experiment with different values of Red, Green, and Blue to create a couple different colors. Write down the values you used. Check these values with www.colorpicker.com

    Challenge 2c: Create a unique lighting display that integrates a blink, fade, or a switching of colors. Be prepared to have a name for your art piece and show this to the rest of the class.

  • Save your Project #2

  • Concept: If(), If() elseconditional logic

  • Concept: If(), If() elseconditional logic

  • A Simple ExampleTry this bit of code.

    What do you think will happen? Test it and write down your observations.

  • digital InputsButtons / Slide SwitchesWhat about this??Analog Pin Mapping

    Analog PinDigital I/O IDA014A115A216A317A418A519A620

  • digital InputsButtons / Slide SwitchesChallenge 3a: Re-arrange the blocks or add new ones to:Turn ON an LED when the button is pressed.Otherwise blink continuouslySame as Pin A5

  • digital InputsButtons / Slide SwitchesChallenge 3b:Now, using the button / switch to start a disco/light changing pattern

    Challenge 3c:Now, using the button / switch to turn on and off the VIBE motor.

  • Serial MonitorSerial print commandAny messageglueData

  • Example

  • Open up Serial Monitor

  • Reading the Light Sensor?

  • ChallengeUse the light sensor input to affect the blink rate of the LEDs.

    Use the light sensor input to affect the speed of a knight-rider or cylon display.

    Use the light sensor to ___________.

  • Save your Project #3Sensors

  • Making MusicSetting up the Speaker

  • Making MusicLets Play a songTwinkle-Twinkle:CC GG AA G FF EE DD C GGHappy Birthday:G G A G C B G G A G D C G G G E C C B AHot Cross Buns:B A G B A G G G G G A A A A B A G Mary Had A Little Lamb:B A G A BB B AA A BB B B A G A BBBB AAA BAG.

  • Musical Notes / Frequencies

    NoteFrequency (Hz)C4261C#4/Db4277D4293D#4/Eb4311E4329F4349F#4/Gb4369G4392G#4/Ab4415A4440A#4/Bb4466B4493

    NoteFrequency (Hz)C5523C#5/Db5554D5587D#5/Eb5622E5659F5698F#5/Gb5739G5783G#5/Ab5830A5880A#5/Bb5932B5987

  • Save your Project #4Tone

  • Getting started with Arduino

  • Additional Resourceshttp://www.sparkfun.com

    http://learn.sparkfun.com

    http://www.arduino.cc

    http://www.bildr.org

  • SparkFun Tutorials and ProjectsGardenBot: www.sparkfun.com/news/598High Altitude Balloon:www.sparkfun.com/tutorials/180GPS Clock: www.sparkfun.com/tutorials/47Earthquake Data Logger: www.sparkfun.com/tutorials/235

  • Thousands of Amazing ideasThe Cat Defenderhttp://www.plasma2002.com/blenderdefender/List of projects at Sparkfun:http://goo.gl/2M3AM

  • Questions?

  • Before leaving, please fill out a quick survey so that I can get your e-mail and a little info about your familiarity with Arduino / Sparkfun.

    Thanks!http://bit.ly/ZAmDMkFeedback?

  • www.sparkfun.com6175 Longbow Drive, Suite 200Boulder, Colorado 80301

  • Buttons / Slide SwitchesDigital Input, Pull-up Resistors, and digitalRead()

  • Buttons / Slide SwitchesDigital Input, Pull-up Resistors, and digitalRead()

    *One prebuilt of each circuit for each group, who has what experience?

    *Super important. Ask people to identify what sensor is connected to what pin later on.

    *

    *Plug it in. FTDI is Serial buffer, 5V, GND, reset.40-50 miliAmps source3.3V system. 9 pins broken out. PWM and analogs. You can reconfigure analog ins to be outputs.

    *Talk about different board types

    *Talk about different board types

    *Arduino Fio Programmed using Funnel (ActionScript, Processing, Ruby)LilyPad 328 Main BoardArduino MegaMega Mini 3.3Arduino Mini Pro 3.3Arduino Uno Compatible -- Redboard

    *

    *

    *

    *

    *

    *

    *

    *

    *