intro to arduino zero to virtual prototyping in seven hours nick poole, linz craig, prashanta aryal,...

32
Intro to Arduino Zero to Virtual Prototyping in Seven Hours Nick Poole, Linz Craig, Prashanta Aryal, Theo Simpson, Tai Johnson and Eli Santistevan

Upload: mervin-adams

Post on 24-Dec-2015

215 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Intro to Arduino Zero to Virtual Prototyping in Seven Hours Nick Poole, Linz Craig, Prashanta Aryal, Theo Simpson, Tai Johnson and Eli Santistevan

Intro to ArduinoZero to Virtual Prototyping in Seven Hours

Nick Poole, Linz Craig, Prashanta Aryal, Theo Simpson, Tai Johnson and Eli Santistevan

Page 2: Intro to Arduino Zero to Virtual Prototyping in Seven Hours Nick Poole, Linz Craig, Prashanta Aryal, Theo Simpson, Tai Johnson and Eli Santistevan

Overview of ClassGetting Started:

Installation, Applications and Materials

Electrical:

Components, Ohm's Law, Input and Output, Analog and Digital

One Hour Break For Lunch

Programming:

Split into groups depending on experience

Serial Communication Basics:

Troubleshooting and Debugging

Virtual Prototyping:

Schematics and PCB Layout in Fritzing

Page 3: Intro to Arduino Zero to Virtual Prototyping in Seven Hours Nick Poole, Linz Craig, Prashanta Aryal, Theo Simpson, Tai Johnson and Eli Santistevan

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 Zero to Virtual Prototyping in Seven Hours Nick Poole, Linz Craig, Prashanta Aryal, Theo Simpson, Tai Johnson and Eli Santistevan

Getting Started• Installation: Arduino (v.22) and Fritzing

Java and Drivers

• Materials: SIK GuideAnalog I/O, Digital I/O,

Serial, & Fritzing handouts

• Applications: Arduino IDE for programming board

Fritzing for creating PCBs

Modkit (combo Arduino & Scratch)

Page 5: Intro to Arduino Zero to Virtual Prototyping in Seven Hours Nick Poole, Linz Craig, Prashanta Aryal, Theo Simpson, Tai Johnson and Eli Santistevan
Page 6: Intro to Arduino Zero to Virtual Prototyping in Seven Hours Nick Poole, Linz Craig, Prashanta Aryal, Theo Simpson, Tai Johnson and Eli Santistevan
Page 7: Intro to Arduino Zero to Virtual Prototyping in Seven Hours Nick Poole, Linz Craig, Prashanta Aryal, Theo Simpson, Tai Johnson and Eli Santistevan

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 8: Intro to Arduino Zero to Virtual Prototyping in Seven Hours Nick Poole, Linz Craig, Prashanta Aryal, Theo Simpson, Tai Johnson and Eli Santistevan

Arduino ShieldsPCB Built Shield Inserted

Shield

Page 9: Intro to Arduino Zero to Virtual Prototyping in Seven Hours Nick Poole, Linz Craig, Prashanta Aryal, Theo Simpson, Tai Johnson and Eli Santistevan

Arduino Shields

Micro SD MP3 Trigger Joystick

Page 10: Intro to Arduino Zero to Virtual Prototyping in Seven Hours Nick Poole, Linz Craig, Prashanta Aryal, Theo Simpson, Tai Johnson and Eli Santistevan

MODKit, Alpha & BetaGraphical User Interface for intuitive coding of

Arduino

Developed by Ed Baafi and Collin Reisdorf

Two components: Online Editor and Download

Above: MODKit download in toolbar. Right click for quit and autostart. This download is for uploading to your Arduino board.

Left: MODKit programming environment.

Page 11: Intro to Arduino Zero to Virtual Prototyping in Seven Hours Nick Poole, Linz Craig, Prashanta Aryal, Theo Simpson, Tai Johnson and Eli Santistevan

ComponentsName Image Type Function Notes

Button Digital Input Closes or opens circuit

Polarized, needs resistor

Trimpot Analog Input Variable resistor

Photoresistor Analog Input Variable resistor

Relay Digital Output & Input

Switches between circuits

Used to control larger voltages

Temp Sensor

Analog Input Variable resistor

Flex Sensor Analog Input Variable resistor

Only bends one way

Soft Trimpot Analog Input Variable resistor

Careful of shorts

RGB LED Dig. & Analog Output

16,777,216 different colors

Ooh... So pretty.

Page 12: Intro to Arduino Zero to Virtual Prototyping in Seven Hours Nick Poole, Linz Craig, Prashanta Aryal, Theo Simpson, Tai Johnson and Eli Santistevan

Ohm’s LawOhm's Law describes the direct relationship between the Voltage, Current and Resistance of a circuit.

The three different forms of Ohm's Law are as follows:

V = I * RI = V / R R = V / I

Where V is Voltage, I is Current and R is Resistance.

Page 13: Intro to Arduino Zero to Virtual Prototyping in Seven Hours Nick Poole, Linz Craig, Prashanta Aryal, Theo Simpson, Tai Johnson and Eli Santistevan

Ohm’s Law

Why do I care about Voltage?

Voltage allows electricity to travel through all the components of the circuit. Voltage of your power source must be more than the total voltage drop of your circuit so the electricity can travel from power to ground.

Page 14: Intro to Arduino Zero to Virtual Prototyping in Seven Hours Nick Poole, Linz Craig, Prashanta Aryal, Theo Simpson, Tai Johnson and Eli Santistevan

Ohm’s Law

Why do I care about Current?

Current is the aspect of electricity that performs physical work or movement.

Page 15: Intro to Arduino Zero to Virtual Prototyping in Seven Hours Nick Poole, Linz Craig, Prashanta Aryal, Theo Simpson, Tai Johnson and Eli Santistevan

Not Ohm’s Law

Why do I care about Continuity?

Continuity is important to make portions of circuits are connect. Continuity is the simplest and possibly the most important setting on your multimeter.

Page 16: Intro to Arduino Zero to Virtual Prototyping in Seven Hours Nick Poole, Linz Craig, Prashanta Aryal, Theo Simpson, Tai Johnson and Eli Santistevan

What’s a Breadboard?One of the most useful tools in an engineer or

Maker’s toolkit. The three most important thing to remember:

• A breadboard is easier than soldering

• A lot of those little holes are connected, which ones?

• Sometimes breadboards break

Page 17: Intro to Arduino Zero to Virtual Prototyping in Seven Hours Nick Poole, Linz Craig, Prashanta Aryal, Theo Simpson, Tai Johnson and Eli Santistevan

What’s a Breadboard?

Page 18: Intro to Arduino Zero to Virtual Prototyping in Seven Hours Nick Poole, Linz Craig, Prashanta Aryal, Theo Simpson, Tai Johnson and Eli Santistevan

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 19: Intro to Arduino Zero to Virtual Prototyping in Seven Hours Nick Poole, Linz Craig, Prashanta Aryal, Theo Simpson, Tai Johnson and Eli Santistevan

OutputOutput is any signal exiting an electrical system

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

•The outputs in SIK include LEDs, a motor, a servo, a piezo element, a relay and an RGB LED

Page 20: Intro to Arduino Zero to Virtual Prototyping in Seven Hours Nick Poole, Linz Craig, Prashanta Aryal, Theo Simpson, Tai Johnson and Eli Santistevan

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 21: Intro to Arduino Zero to Virtual Prototyping in Seven Hours Nick Poole, Linz Craig, Prashanta Aryal, Theo Simpson, Tai Johnson and Eli Santistevan

Circuit 1: Electrical

Remember: the longer leg on the LED is the

positive leg and the

shorter leg is the

negativeImage created in Fritzing

Page 22: Intro to Arduino Zero to Virtual Prototyping in Seven Hours Nick Poole, Linz Craig, Prashanta Aryal, Theo Simpson, Tai Johnson and Eli Santistevan

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 23: Intro to Arduino Zero to Virtual Prototyping in Seven Hours Nick Poole, Linz Craig, Prashanta Aryal, Theo Simpson, Tai Johnson and Eli Santistevan

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 24: Intro to Arduino Zero to Virtual Prototyping in Seven Hours Nick Poole, Linz Craig, Prashanta Aryal, Theo Simpson, Tai Johnson and Eli Santistevan

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 25: Intro to Arduino Zero to Virtual Prototyping in Seven Hours Nick Poole, Linz Craig, Prashanta Aryal, Theo Simpson, Tai Johnson and Eli Santistevan

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 26: Intro to Arduino Zero to Virtual Prototyping in Seven Hours Nick Poole, Linz Craig, Prashanta Aryal, Theo Simpson, Tai Johnson and Eli Santistevan

Circuit 8: Electrical

Image created in Fritzing

Page 27: Intro to Arduino Zero to Virtual Prototyping in Seven Hours Nick Poole, Linz Craig, Prashanta Aryal, Theo Simpson, Tai Johnson and Eli Santistevan

Analog Sensors

Examples:

Sensors Variables Values Signals

Mic Volume Decibels Voltage

Photoresistor Light Photons Voltage

Potentiometer Dial Position Resistance Voltage

Temp Sensor Temperature Celsius Voltage

Flex Sensor Bend Resistance Voltage

Accelerometer Motion/Tilt/Acceleration AccelerationVoltage

Page 28: Intro to Arduino Zero to Virtual Prototyping in Seven Hours Nick Poole, Linz Craig, Prashanta Aryal, Theo Simpson, Tai Johnson and Eli Santistevan

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 29: Intro to Arduino Zero to Virtual Prototyping in Seven Hours Nick Poole, Linz Craig, Prashanta Aryal, Theo Simpson, Tai Johnson and Eli Santistevan

Circuit 7: Electrical

Image created in Fritzing

Page 30: Intro to Arduino Zero to Virtual Prototyping in Seven Hours Nick Poole, Linz Craig, Prashanta Aryal, Theo Simpson, Tai Johnson and Eli Santistevan

Digital Sensors• Digital sensors are more straight forward than Analog

• 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 31: Intro to Arduino Zero to Virtual Prototyping in Seven Hours Nick Poole, Linz Craig, Prashanta Aryal, Theo Simpson, Tai Johnson and Eli Santistevan

Questions?

Page 32: Intro to Arduino Zero to Virtual Prototyping in Seven Hours Nick Poole, Linz Craig, Prashanta Aryal, Theo Simpson, Tai Johnson and Eli Santistevan

www.sparkfun.com6175 Longbow Drive, Suite 200

Boulder, Colorado 80301