Transcript
Page 1: Intro to  Arduino  with  LilyPad

Intro to Arduino with LilyPad

Make a MakerSpace, Artisan’s Asylum

Linz Craig, Chris Taylor, Mike Hord & Joel Bartlett

Page 2: Intro to  Arduino  with  LilyPad

Overview of ClassGetting Started:

Installation and Applications

Electrical:

Components, Input and Output, Analog and Digital

Trouble Shooting:

Serial Communication

Additional Teaching Tools:

Giant Components and Breadboard, Free Teaching Materials

Page 3: Intro to  Arduino  with  LilyPad

Arduino Board“Strong Friend” Created in Ivrea, Italy

in 2005 by Massimo Banzi & David Cuartielles

Open Source Hardware

Atmel Processor

Coding is accessible (C++, Processing, ModKit and MiniBloq)

Page 4: Intro to  Arduino  with  LilyPad

The LilyPad Dev Board

Page 5: Intro to  Arduino  with  LilyPad
Page 6: Intro to  Arduino  with  LilyPad
Page 7: Intro to  Arduino  with  LilyPad
Page 8: Intro to  Arduino  with  LilyPad

Flip the Board Over

Do you see the wires that are running to the sensors, LEDs, and buttons?The microcontroller can already talk to the inputs and outputs!

Page 9: Intro to  Arduino  with  LilyPad

Board Type

Page 10: Intro to  Arduino  with  LilyPad

Other Board Type

Page 11: Intro to  Arduino  with  LilyPad

Serial Port / COM Port

Page 12: Intro to  Arduino  with  LilyPad

Analog and Digital• All Arduino signals are either Analog or

Digital • All computers including Arduino, only

understand Digital • It is important to understand the

difference between Analog and Digital signals since Analog signals require an Analog to Digital conversion

Page 13: Intro to  Arduino  with  LilyPad

Output

Output is always Digital

To Output a Digital signal (On or Off) use this code:

digitalWrite ( pinNumber , value );

Where value is HIGH or LOW

To output a signal that pretends to be Analog use this code:

analogWrite ( pinNumber, value );

Where value is a number 0 - 255

Page 14: Intro to  Arduino  with  LilyPad
Page 15: Intro to  Arduino  with  LilyPad

Output

Output is always Digital

Using a Digital signal that pretends to be an Analog signal is called Pulse Width Modulation

Use Pulse Width Modulation, or P.W.M., for anything that requires a signal between HIGH and LOW

P.W.M. is available on Arduino pins # 3, 5, 6, 9, 10, and 11

Page 16: Intro to  Arduino  with  LilyPad

OutputOutput is always Digital, even when it’s P.W.M.

For P.W.M. the Arduino pin turns on then off very fast

P.W.M. Signal @ 25% P.W.M. Signal @ 75% P.W.M. Signal rising

0 25 50 75 1000

50

100

150

200

250

300

PWM Percentage

PW

M V

alu

e

0 25 50 75 100

0

1

2

3

4

5

6

PWM Percentage

Vo

ltag

e V

alu

e

Page 17: Intro to  Arduino  with  LilyPad

InputInput is any signal entering an electrical system

•Both digital and analog sensors are forms of input

•Input can also take many other forms: Keyboards, a mouse, infared sensors, biometric sensors, or just plain voltage from a circuit

Page 18: Intro to  Arduino  with  LilyPad
Page 19: Intro to  Arduino  with  LilyPad

Analog Input• To connect an analog Input to your Arduino

use Analog Pins # 0 - 5

• To get an analog reading:

analogRead ( pinNumber );

• Analog Input varies from 0 to 1023 on an Arduino

Page 20: Intro to  Arduino  with  LilyPad

Digital Input• To connect digital input to your Arduino use Digital

Pins # 0 – 13 (Although pins # 0 & 1 are also used for serial)

• Digital Input needs a pinMode command:

pinMode ( pinNumber, INPUT );

Make sure to use caps for INPUT

• To get a digital reading: digitalRead ( pinNumber );

• Digital Input values are only HIGH (On) or LOW (Off)

Page 21: Intro to  Arduino  with  LilyPad

Digital Sensors

•No matter what the sensor there are only two settings: On and Off

•Signal is always either HIGH (On) or LOW (Off)

•Voltage signal for HIGH will be a little less than 5V on your Uno

•Voltage signal for LOW will be 0V on most systems

Page 22: Intro to  Arduino  with  LilyPad

Setup, Internal Pullup Resistors

void setup ( ) { digitalWrite (12, HIGH); }

You will need to create internal pullup resistors in setup, to do so digitalWrite the pin HIGH

Page 23: Intro to  Arduino  with  LilyPad

Serial Communication

Serial Communication is the transferring and receiving of information between two machines, the Arduino dedicates pin # 0 to receiving information and pin 1 to transferring information

Page 24: Intro to  Arduino  with  LilyPad

Serial in Setup

Page 25: Intro to  Arduino  with  LilyPad

Serial Monitor

Page 26: Intro to  Arduino  with  LilyPad

Serial Communication:Serial Setup

void setup ( ) {Serial.begin ( 9600 ) ;}

In this case the number 9600 is the baud rate at which the computer and Arduino

communicate

Page 27: Intro to  Arduino  with  LilyPad

Serial Communication:Sending a Message

void loop ( ) {Serial.print ( “Constructivism & “

) ;

Serial.println ( “Mechatronics” ) ;}

Page 28: Intro to  Arduino  with  LilyPad

Serial Communication

Page 29: Intro to  Arduino  with  LilyPad

Serial Communication:Serial Debugging

void loop ( ) {int xVar = 10 ;Serial.print ( “Variable xVar is “ )

;Serial.println ( xVar ) ;}

Page 30: Intro to  Arduino  with  LilyPad

Serial Communication:Serial Troubleshooting

void loop ( ) {Serial.print ( “Digital pin 9 reads

“ ) ;Serial.println ( digitalRead

( 9 ) ) ;}

Page 31: Intro to  Arduino  with  LilyPad

Making the World’s Worst Musical Instrument

Now for some really crappy dubstep…. If we have time.

Because, really, who has time for crappy dubstep?

Page 32: Intro to  Arduino  with  LilyPad

MODKit: WWW.modk.itGraphical User Interface for intuitive coding of

Arduino

Developed by Ed Baafi and Collin Reisdorf

Page 33: Intro to  Arduino  with  LilyPad

FritzingVirtual Electrical Prototyping Project

started in 2007 by the Interaction Design Lab

at the University of Applied Science Potsdam, Germany

Open Source

Prototypes: Document, Share, Teach, Manufacture

Page 34: Intro to  Arduino  with  LilyPad

Murphy’s Law

If it can go wrong, it will… eventually.

Be ready to improvise.

Page 35: Intro to  Arduino  with  LilyPad

Developing Instructors

They will surprise you.

Being open will lead you to some interesting places.

Have some student leaders.

Get some laughs to make people comfortable.

Page 36: Intro to  Arduino  with  LilyPad

Other Teaching ToolsSewing:

http://www.sparkfun.com/tutorials/category/16

Processing:

http://processing.org/

Ohm’s Law Board:

http://learn.sparkfun.com/curriculum/26

Giant Breadboard and Components:

http://learn.sparkfun.com/curriculum/22,

http://learn.sparkfun.com/curriculum/23

Additional Resources:

http://learn.sparkfun.com/curriculum

http://www.arduino.cc/

Page 37: Intro to  Arduino  with  LilyPad

Questions?

Page 38: Intro to  Arduino  with  LilyPad

www.sparkfun.com6175 Longbow Drive, Suite 200

Boulder, Colorado 80301


Top Related