SlideShare a Scribd company logo
1 of 112
Download to read offline
Intro to Arduino 
The Basics of Open Hardware and Circuits 
Code4LibDC 2014 
Jason Griffey 
Evenly Distributed LLC 
http://evenlydistributed.net
SSID: LibraryBox - Free Content! 
Connect to wifi signal, then launch/refresh any browser 
Folder: Code4LibDC 
http://librarybox.us
Software install?
Let’s Plug In
Open Source Hardware
Moore’s Law 
Photo by Marcin Wichary - http://flic.kr/p/4v4DSq
Koomey’s Law 
Photo by LisaW123 - http://flic.kr/p/7eiqaq
Photo by sobczak.paul - http://flic.kr/p/aDD8ep
Arduino
Photo by bjepson - http://flic.kr/p/8EVHqm
Why Arduino?
Open Hardware
Photo by dam - http://flic.kr/p/8hLXBM
Photo by dam - http://flic.kr/p/8hLXwT
Photo by dam - http://flic.kr/p/8hQcJs
Photo by dam - http://flic.kr/p/8hQcDG
Photo by dam - http://flic.kr/p/8hQcDG
Photo by Nathan Chantrell - http://flic.kr/p/aALqhd
Photo by Nathan Chantrell - http://flic.kr/p/aALqhd
Photo by antonw - http://flic.kr/p/91daJe 
Shields
A La Mode
Sensors 
http://learn.adafruit.com/system/assets/assets/000/000/426/original/FSR402_MED.jpg?1340650766
Arduino Software
Our Hardware
Fritzing
Arduino 
IDE
Our Sketch
int val; 
! 
void setup() 
{ 
pinMode(2,OUTPUT); 
pinMode(3,OUTPUT); 
pinMode(4,OUTPUT); 
pinMode(5,OUTPUT); 
Serial.begin(9600); 
} 
! 
void loop() 
{ 
Serial.println(analogRead(0)); 
val = analogRead(0); 
! 
if (val > 256) 
digitalWrite(2,HIGH); 
if (val < 256) 
digitalWrite(2,LOW); 
if (val > 512) 
digitalWrite(3,HIGH); 
if (val < 512) 
digitalWrite(3,LOW); 
! 
if (val > 768) 
digitalWrite(4,HIGH); 
if (val < 768) 
digitalWrite(4,LOW); 
! 
if (val > 769) 
digitalWrite(5,HIGH); 
if (val < 1020) 
digitalWrite(5,LOW); 
} 
Globals 
Setup 
Loop
int val; 
! 
void setup() 
{ 
pinMode(2,OUTPUT); 
pinMode(3,OUTPUT); 
pinMode(4,OUTPUT); 
pinMode(5,OUTPUT); 
Serial.begin(9600); 
} 
! 
void loop() 
{ 
Serial.println(analogRead(0)); 
val = analogRead(0); 
! 
if (val > 256) 
digitalWrite(2,HIGH); 
if (val < 256) 
digitalWrite(2,LOW); 
if (val > 512) 
digitalWrite(3,HIGH); 
if (val < 512) 
digitalWrite(3,LOW); 
! 
if (val > 768) 
digitalWrite(4,HIGH); 
if (val < 768) 
digitalWrite(4,LOW); 
! 
if (val > 769) 
digitalWrite(5,HIGH); 
if (val < 1020) 
digitalWrite(5,LOW); 
} 
Globals 
Setup 
Loop
int val; 
! 
void setup() 
{ 
pinMode(2,OUTPUT); 
pinMode(3,OUTPUT); 
pinMode(4,OUTPUT); 
pinMode(5,OUTPUT); 
Serial.begin(9600); 
} 
! 
void loop() 
{ 
Serial.println(analogRead(0)); 
val = analogRead(0); 
! 
if (val > 256) 
digitalWrite(2,HIGH); 
if (val < 256) 
digitalWrite(2,LOW); 
if (val > 512) 
digitalWrite(3,HIGH); 
if (val < 512) 
digitalWrite(3,LOW); 
! 
if (val > 768) 
digitalWrite(4,HIGH); 
if (val < 768) 
digitalWrite(4,LOW); 
! 
if (val > 769) 
digitalWrite(5,HIGH); 
if (val < 1020) 
digitalWrite(5,LOW); 
} 
Globals 
Setup 
Loop
int val; 
! 
void setup() 
{ 
pinMode(2,OUTPUT); 
pinMode(3,OUTPUT); 
pinMode(4,OUTPUT); 
pinMode(5,OUTPUT); 
Serial.begin(9600); 
} 
! 
void loop() 
{ 
Serial.println(analogRead(0)); 
val = analogRead(0); 
! 
if (val > 256) 
digitalWrite(2,HIGH); 
if (val < 256) 
digitalWrite(2,LOW); 
if (val > 512) 
digitalWrite(3,HIGH); 
if (val < 512) 
digitalWrite(3,LOW); 
! 
if (val > 768) 
digitalWrite(4,HIGH); 
if (val < 768) 
digitalWrite(4,LOW); 
! 
if (val > 769) 
digitalWrite(5,HIGH); 
if (val < 1020) 
digitalWrite(5,LOW); 
} 
Globals 
Setup 
Loop
Can you:
Can you: 
• Change one of the Pin Numbers?
Can you: 
• Change one of the Pin Numbers? 
• Re-wire the ground wires?
Can you: 
• Change one of the Pin Numbers? 
• Re-wire the ground wires? 
• Change the order the LEDs light up?
Can you: 
• Change one of the Pin Numbers? 
• Re-wire the ground wires? 
• Change the order the LEDs light up? 
• Light up 2 LEDs at once?
Can you: 
• Change one of the Pin Numbers? 
• Re-wire the ground wires? 
• Change the order the LEDs light up? 
• Light up 2 LEDs at once? 
• Add another LED?
Can you: 
• Change one of the Pin Numbers? 
• Re-wire the ground wires? 
• Change the order the LEDs light up? 
• Light up 2 LEDs at once? 
• Add another LED? 
• Swap the sensor?
Structure 
/* Each Arduino sketch must contain the 
following two functions. */ 
void setup() 
{ 
/* this code runs once at the beginning of 
the code execution. */ 
} 
void loop() 
{ 
/* this code runs repeatedly over and over 
as long as the board is powered. */ 
} 
Comments 
// this is a single line 
/* this is 
a multiline */ 
Setup 
pinMode(pin, [INPUT  OUTPUT  INPUT_PULLUP]); 
/* Sets the mode of the digital I/O pin. 
It can be set as an input, output, or an 
input with an internal pull-up resistor. 
*/ 
Control Structures 
if(condition) 
{ 
// if condition is TRUE, do something here 
} 
else 
{ 
// otherwise, do this 
} 
for(initialization; condition; increment) 
{ 
// do this 
} 
/* The ‘for’ statement is used to repeat 
a block of statements enclosed in curly 
braces. An increment counter is usually 
used to increment and terminate the loop. 
*/ 
Digital I/O 
digitalWrite(pin, val); 
/* val = HIGH or LOW. Sets the 
digital pin to either ON or OFF. */ 
int var = digitalRead(pin); 
/* Reads the voltage from a digital 
pin. Returns either HIGH or LOW. */ 
int var = digitalRead(pin); 
/* Reads the value from a specified digital 
pin, either HIGH or LOW. */ 
Analog I/O 
analogWrite(pin, val); 
/* Writes an analog voltage to a pin. 
val = integer value from 0 to 255 */ 
int var = analogRead(pin); 
/* Reads the voltage from the specified 
analog pin. */ 
int var = analogRead(pin); 
/* Reads the value from the specified 
analog pin. */ 
Time 
delay(time_ms); 
/* Pauses the program for the amount of time 
(in milliseconds). */ 
delayMicroseconds(time_us); 
/* Pauses the program for the amount of time 
(in microseconds). */ 
millis(); 
/* Returns the number of milliseconds since 
the board began running the current program. 
max: 4,294,967,295 */ 
micros(); 
/* Returns the number of microseconds since 
the board began running the current program. 
max: 4,294,967,295 */ 
Serial Communication 
Serial.begin(baudrate); 
/* Sets the data rate in bits per second 
(baud) for serial data transmission. */ 
Serial.print(""); 
/* Sets the data rate in bits per second 
(baud) for serial data transmission. */ 
Serial.print("Hello World!!"); 
/* Sends a string "Hello World!!" to the 
serial bus. This will be seen on the Serial 
Monitor in Arduino. */ 
Serial.println("Hello World!"); 
/* Identical to Serial.print(), but this 
also adds a carriage-return / line-feed to 
advance to the next line. */ 
Serial.println(""); 
/* Identical to Serial.print(), but this 
also adds a carriage-return / line-feed to 
advance to the next line. */ 
boolean Serial.available() 
/* Serial.available() returns TRUE if there 
is data available on the Serial bus. */ 
int Serial.read(); 
/* Returns a single byte of data available 
from the Serial buffer. */ 
int Serial.read(); 
/* Returns a single byte of data available 
from the Serial buffer. */ 
Data Types 
void // nothing is returned 
boolean // 0, 1, false, true 
char // 8 bits: ASCII character 
byte // 8 bits: 0 to 255, unsigned 
int // 16 bits: 32,768 to 32,767, signed 
long /* 32 bits: 2,147,483,648 
to 2,147,483,647, signed */ 
float // 32 bits, signed decimal 
Constants 
HIGH  LOW 
INPUT  OUTPUT 
true  false 
Mathematical Operators 
= // assignment 
+ // addition 
- // subtraction 
* // multiplication 
/ // division 
% // modulus 
Logical Operators 
== // boolean equal to 
!= // not equal to 
< // less than 
> // greater than 
<= // less than or equal to 
>= // greater than or equal to 
&& // Boolean AND 
|| // Boolean OR 
! // Boolean NOT 
Bitwise Operators 
& // bitwise AND 
| // bitwise OR 
^ // bitwise XOR 
~ // bitwise INVERT 
var << n // bitwise shift left by n bits 
var >> n // bitwise shift right by n bits 
Libraries 
#include <libraryname.h> 
/* this provides access to special 
additional functions for things such as 
servo motors, SD card, wifi, or bluetooth. 
*/ 
Advanced I/O 
tone(pin, freq); 
/* Generates a square wave of the specified 
frequency to a pin. Pin must be one of the 
PWM (~) pins. */ 
tone(pin, freq, duration); 
/* Generates a square wave of the specified 
frequency to a pin for a duration in 
milliseconds. Pin must be one of the PWM (~) 
pins. */ 
noTone(pin); 
// Turns off the tone on the pin. 
RedBoard: 
Power In 
LilyPad ProtoSnap Simple: 
Digital I/O 
PWM(3,5,6,9,10,11) 
ATmega328 
Microcontroller 
Temperature 
Sensor 
(Pin A1) 
Vibe Motor 
(Pin 3) 
RGB LED 
(Pins R=9, 
G=11, B=10) 
Button 
(Pin A5) 
Switch 
(Pin 2) 
Light 
Sensor 
(Pin A6) 
Buzzer/ 
Speaker 
(Pin 7) 
LEDs 
(Light Emitting Diodes) 
(Pins 5, 6, A2, A4, A3) 
Power 
5V / 3.3 / GND 
USB to Computer 
Reset 
Analog 
Inputs 
SCL/SDA 
(I2C Bus) 
ATmega328 
Microcontroller
Building Your Own Hardware
Patron Counters
$300
$280
Build One Yourself
Build One Yourself 
• Arduino - $35
Build One Yourself 
• Arduino - $35 
• Data Logger Shield - $20
Build One Yourself 
• Arduino - $35 
• Data Logger Shield - $20 
• SD Card - $10
Build One Yourself 
• Arduino - $35 
• Data Logger Shield - $20 
• SD Card - $10 
• Sensor (infrared, laser tripwire, ultrasonic, or 
PID) - $10
Build One Yourself 
• Arduino - $35 
• Data Logger Shield - $20 
• SD Card - $10 
• Sensor (infrared, laser tripwire, ultrasonic, or 
PID) - $10 
• TOTAL COST - $70
Temperature/Humidity 
Loggers
$240
$415
Build One Yourself
Build One Yourself 
• Arduino - $35
Build One Yourself 
• Arduino - $35 
• Data Logger Shield - $20
Build One Yourself 
• Arduino - $35 
• Data Logger Shield - $20 
• SD Card - $10
Build One Yourself 
• Arduino - $35 
• Data Logger Shield - $20 
• SD Card - $10 
• Temperature/Humidity Sensor - $5-10
Build One Yourself 
• Arduino - $35 
• Data Logger Shield - $20 
• SD Card - $10 
• Temperature/Humidity Sensor - $5-10 
• LCD Display screen - $15
Build One Yourself 
• Arduino - $35 
• Data Logger Shield - $20 
• SD Card - $10 
• Temperature/Humidity Sensor - $5-10 
• LCD Display screen - $15 
• TOTAL COST - $85
Other Possibilities
Other Possibilities 
• RFID Reader
Other Possibilities 
• RFID Reader 
• Barcode Scanner
Other Possibilities 
• RFID Reader 
• Barcode Scanner 
• Seat usage detector
Other Possibilities 
• RFID Reader 
• Barcode Scanner 
• Seat usage detector 
• What else?
Go Build Stuff!
Jason Griffey 
Email: griffey@gmail.com 
Site: jasongriffey.net 
gVoice: 423-443-4770 
Twitter: @griffey 
http://librarybox.us 
http://evenlydistributed.net 
! 
Founder & Principal Consultant 
http://pinboard.in/u:griffey/ Evenly Distributed LLC

More Related Content

What's hot

Arduino as an embedded industrial controller
Arduino as an embedded industrial controllerArduino as an embedded industrial controller
Arduino as an embedded industrial controller
Jose Luis Poza Luján
 

What's hot (20)

Aurdino presentation
Aurdino presentationAurdino presentation
Aurdino presentation
 
Intro to Arduino
Intro to ArduinoIntro to Arduino
Intro to Arduino
 
Arduino experimenters guide hq
Arduino experimenters guide hqArduino experimenters guide hq
Arduino experimenters guide hq
 
Introducing the Arduino
Introducing the ArduinoIntroducing the Arduino
Introducing the Arduino
 
Arduino: Arduino lcd
Arduino: Arduino lcdArduino: Arduino lcd
Arduino: Arduino lcd
 
Basics of arduino uno
Basics of arduino unoBasics of arduino uno
Basics of arduino uno
 
Arduino as an embedded industrial controller
Arduino as an embedded industrial controllerArduino as an embedded industrial controller
Arduino as an embedded industrial controller
 
Arduino Day 1 Presentation
Arduino Day 1 PresentationArduino Day 1 Presentation
Arduino Day 1 Presentation
 
Introduction to Arduino Microcontroller
Introduction to Arduino MicrocontrollerIntroduction to Arduino Microcontroller
Introduction to Arduino Microcontroller
 
Introduction to Arduino
Introduction to ArduinoIntroduction to Arduino
Introduction to Arduino
 
Arduino and c programming
Arduino and c programmingArduino and c programming
Arduino and c programming
 
Programming with arduino
Programming with arduinoProgramming with arduino
Programming with arduino
 
Introduction to Arduino
Introduction to ArduinoIntroduction to Arduino
Introduction to Arduino
 
Different Arduino Boards
Different Arduino BoardsDifferent Arduino Boards
Different Arduino Boards
 
Arduino : how to get started
Arduino : how to get startedArduino : how to get started
Arduino : how to get started
 
Cassiopeia Ltd - standard Arduino workshop
Cassiopeia Ltd - standard Arduino workshopCassiopeia Ltd - standard Arduino workshop
Cassiopeia Ltd - standard Arduino workshop
 
Arduino Lecture 1 - Introducing the Arduino
Arduino Lecture 1 - Introducing the ArduinoArduino Lecture 1 - Introducing the Arduino
Arduino Lecture 1 - Introducing the Arduino
 
CTC - What is Arduino
CTC - What is ArduinoCTC - What is Arduino
CTC - What is Arduino
 
Introduction to arduino
Introduction to arduinoIntroduction to arduino
Introduction to arduino
 
Arduino Workshop
Arduino WorkshopArduino Workshop
Arduino Workshop
 

Viewers also liked

Computers in libraries 2012
Computers in libraries 2012Computers in libraries 2012
Computers in libraries 2012
Jason Griffey
 
SANDALL: Mobile Technologies
SANDALL: Mobile TechnologiesSANDALL: Mobile Technologies
SANDALL: Mobile Technologies
Jason Griffey
 
Connecticut Library Association 2011 final
Connecticut Library Association 2011 finalConnecticut Library Association 2011 final
Connecticut Library Association 2011 final
Jason Griffey
 

Viewers also liked (20)

Computers in libraries 2012
Computers in libraries 2012Computers in libraries 2012
Computers in libraries 2012
 
The Future of Things
The Future of ThingsThe Future of Things
The Future of Things
 
The future is a platform
The future is a platformThe future is a platform
The future is a platform
 
SIUI - Libraries & the Post-PC Era
SIUI - Libraries & the Post-PC EraSIUI - Libraries & the Post-PC Era
SIUI - Libraries & the Post-PC Era
 
Maine Regional Fall Council Workshop
Maine Regional Fall Council WorkshopMaine Regional Fall Council Workshop
Maine Regional Fall Council Workshop
 
Arduino
ArduinoArduino
Arduino
 
Lita Forum 2009 Mobile Day One
Lita Forum 2009 Mobile Day OneLita Forum 2009 Mobile Day One
Lita Forum 2009 Mobile Day One
 
Mobile - Internet Librarian 2009
Mobile - Internet Librarian 2009Mobile - Internet Librarian 2009
Mobile - Internet Librarian 2009
 
Not Evenly Distributed
Not Evenly DistributedNot Evenly Distributed
Not Evenly Distributed
 
Lita Forum 2009 Mobile Day Two
Lita Forum 2009 Mobile Day TwoLita Forum 2009 Mobile Day Two
Lita Forum 2009 Mobile Day Two
 
SANDALL: Mobile Technologies
SANDALL: Mobile TechnologiesSANDALL: Mobile Technologies
SANDALL: Mobile Technologies
 
COSLINE eBook Workshop
COSLINE eBook WorkshopCOSLINE eBook Workshop
COSLINE eBook Workshop
 
Connecticut Library Association 2011 final
Connecticut Library Association 2011 finalConnecticut Library Association 2011 final
Connecticut Library Association 2011 final
 
WebJunction Gadgets webinar
WebJunction Gadgets webinarWebJunction Gadgets webinar
WebJunction Gadgets webinar
 
Realtime Web
Realtime WebRealtime Web
Realtime Web
 
Mississippi State Emerging Technologies Summit 2010
Mississippi State Emerging Technologies Summit 2010Mississippi State Emerging Technologies Summit 2010
Mississippi State Emerging Technologies Summit 2010
 
Tech Trends from ALA 2010
Tech Trends from ALA 2010Tech Trends from ALA 2010
Tech Trends from ALA 2010
 
Computers in Libraries 2011: Tablets & Superphones
Computers in Libraries 2011: Tablets & SuperphonesComputers in Libraries 2011: Tablets & Superphones
Computers in Libraries 2011: Tablets & Superphones
 
OLITA: Mobility & Post-mobility
OLITA: Mobility & Post-mobilityOLITA: Mobility & Post-mobility
OLITA: Mobility & Post-mobility
 
IOLUG Mobile Futures Keynote
IOLUG Mobile Futures KeynoteIOLUG Mobile Futures Keynote
IOLUG Mobile Futures Keynote
 

Similar to Introduction to Arduino and Circuits

What will be quantization step size in numbers and in voltage for th.pdf
What will be quantization step size in numbers and in voltage for th.pdfWhat will be quantization step size in numbers and in voltage for th.pdf
What will be quantization step size in numbers and in voltage for th.pdf
SIGMATAX1
 
Arduino shield wifi-monitorizarelocuinta
Arduino shield wifi-monitorizarelocuintaArduino shield wifi-monitorizarelocuinta
Arduino shield wifi-monitorizarelocuinta
Iulius Bors
 
teststststststLecture_3_2022_Arduino.pptx
teststststststLecture_3_2022_Arduino.pptxteststststststLecture_3_2022_Arduino.pptx
teststststststLecture_3_2022_Arduino.pptx
ethannguyen1618
 
4 IOT 18ISDE712 MODULE 4 IoT Physical Devices and End Point-Aurdino Uno.pdf
4 IOT 18ISDE712  MODULE 4 IoT Physical Devices and End Point-Aurdino  Uno.pdf4 IOT 18ISDE712  MODULE 4 IoT Physical Devices and End Point-Aurdino  Uno.pdf
4 IOT 18ISDE712 MODULE 4 IoT Physical Devices and End Point-Aurdino Uno.pdf
Jayanthi Kannan MK
 
Magnetic door lock using arduino
Magnetic door lock using arduinoMagnetic door lock using arduino
Magnetic door lock using arduino
Sravanthi Sinha
 

Similar to Introduction to Arduino and Circuits (20)

Scottish Ruby Conference 2010 Arduino, Ruby RAD
Scottish Ruby Conference 2010 Arduino, Ruby RADScottish Ruby Conference 2010 Arduino, Ruby RAD
Scottish Ruby Conference 2010 Arduino, Ruby RAD
 
Multi Sensory Communication 2/2
Multi Sensory Communication 2/2Multi Sensory Communication 2/2
Multi Sensory Communication 2/2
 
Syed IoT - module 5
Syed  IoT - module 5Syed  IoT - module 5
Syed IoT - module 5
 
Arduino windows remote control
Arduino windows remote controlArduino windows remote control
Arduino windows remote control
 
Arduino
ArduinoArduino
Arduino
 
Webshield internet of things
Webshield internet of thingsWebshield internet of things
Webshield internet of things
 
Arduino cic3
Arduino cic3Arduino cic3
Arduino cic3
 
What will be quantization step size in numbers and in voltage for th.pdf
What will be quantization step size in numbers and in voltage for th.pdfWhat will be quantization step size in numbers and in voltage for th.pdf
What will be quantization step size in numbers and in voltage for th.pdf
 
Arduino shield wifi-monitorizarelocuinta
Arduino shield wifi-monitorizarelocuintaArduino shield wifi-monitorizarelocuinta
Arduino shield wifi-monitorizarelocuinta
 
How to use an Arduino
How to use an ArduinoHow to use an Arduino
How to use an Arduino
 
Arduino Slides With Neopixels
Arduino Slides With NeopixelsArduino Slides With Neopixels
Arduino Slides With Neopixels
 
Arduino intro.pptx
Arduino intro.pptxArduino intro.pptx
Arduino intro.pptx
 
Arduino for Beginners
Arduino for BeginnersArduino for Beginners
Arduino for Beginners
 
Introduction to Arduino
Introduction to ArduinoIntroduction to Arduino
Introduction to Arduino
 
Introduction to Arduino
Introduction to ArduinoIntroduction to Arduino
Introduction to Arduino
 
teststststststLecture_3_2022_Arduino.pptx
teststststststLecture_3_2022_Arduino.pptxteststststststLecture_3_2022_Arduino.pptx
teststststststLecture_3_2022_Arduino.pptx
 
4 IOT 18ISDE712 MODULE 4 IoT Physical Devices and End Point-Aurdino Uno.pdf
4 IOT 18ISDE712  MODULE 4 IoT Physical Devices and End Point-Aurdino  Uno.pdf4 IOT 18ISDE712  MODULE 4 IoT Physical Devices and End Point-Aurdino  Uno.pdf
4 IOT 18ISDE712 MODULE 4 IoT Physical Devices and End Point-Aurdino Uno.pdf
 
Magnetic door lock using arduino
Magnetic door lock using arduinoMagnetic door lock using arduino
Magnetic door lock using arduino
 
Arduino Programming Basic
Arduino Programming BasicArduino Programming Basic
Arduino Programming Basic
 
Arduino: Intro and Digital I/O
Arduino: Intro and Digital I/OArduino: Intro and Digital I/O
Arduino: Intro and Digital I/O
 

More from Jason Griffey

KLA 2013 Mobile Technology
KLA 2013 Mobile TechnologyKLA 2013 Mobile Technology
KLA 2013 Mobile Technology
Jason Griffey
 
KLA 2013 Future Technology
KLA 2013 Future TechnologyKLA 2013 Future Technology
KLA 2013 Future Technology
Jason Griffey
 
Mid-Tennessee Region Future Technology Presentation
Mid-Tennessee Region Future Technology PresentationMid-Tennessee Region Future Technology Presentation
Mid-Tennessee Region Future Technology Presentation
Jason Griffey
 
Mid-Tennessee Region Mobile Technology Presentation
Mid-Tennessee Region Mobile Technology PresentationMid-Tennessee Region Mobile Technology Presentation
Mid-Tennessee Region Mobile Technology Presentation
Jason Griffey
 
Meredith - Guest lecture on Mobile
Meredith - Guest lecture on MobileMeredith - Guest lecture on Mobile
Meredith - Guest lecture on Mobile
Jason Griffey
 

More from Jason Griffey (16)

Making Our Futures
Making Our FuturesMaking Our Futures
Making Our Futures
 
State Library of New South Wales 2013
State Library of New South Wales 2013State Library of New South Wales 2013
State Library of New South Wales 2013
 
KLA 2013 Mobile Technology
KLA 2013 Mobile TechnologyKLA 2013 Mobile Technology
KLA 2013 Mobile Technology
 
KLA 2013 Future Technology
KLA 2013 Future TechnologyKLA 2013 Future Technology
KLA 2013 Future Technology
 
LibraryBox and Kickstarter
LibraryBox and KickstarterLibraryBox and Kickstarter
LibraryBox and Kickstarter
 
TN library association gadget precon 2013
TN library association gadget precon 2013TN library association gadget precon 2013
TN library association gadget precon 2013
 
Open Hardware and Libraries
Open Hardware and LibrariesOpen Hardware and Libraries
Open Hardware and Libraries
 
Mid-Tennessee Region Future Technology Presentation
Mid-Tennessee Region Future Technology PresentationMid-Tennessee Region Future Technology Presentation
Mid-Tennessee Region Future Technology Presentation
 
Mid-Tennessee Region Mobile Technology Presentation
Mid-Tennessee Region Mobile Technology PresentationMid-Tennessee Region Mobile Technology Presentation
Mid-Tennessee Region Mobile Technology Presentation
 
The Future is Already Here
The Future is Already HereThe Future is Already Here
The Future is Already Here
 
Minnesota ARLD Day 2011
Minnesota ARLD Day 2011Minnesota ARLD Day 2011
Minnesota ARLD Day 2011
 
Focus on the Future
Focus on the FutureFocus on the Future
Focus on the Future
 
Georgia library association 2011
Georgia library association 2011Georgia library association 2011
Georgia library association 2011
 
Meredith - Guest lecture on Mobile
Meredith - Guest lecture on MobileMeredith - Guest lecture on Mobile
Meredith - Guest lecture on Mobile
 
Building a 21st Century Library
Building a 21st Century LibraryBuilding a 21st Century Library
Building a 21st Century Library
 
Extending your blog
Extending your blogExtending your blog
Extending your blog
 

Recently uploaded

The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
KarakKing
 

Recently uploaded (20)

How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Spatium Project Simulation student brief
Spatium Project Simulation student briefSpatium Project Simulation student brief
Spatium Project Simulation student brief
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 

Introduction to Arduino and Circuits

  • 1. Intro to Arduino The Basics of Open Hardware and Circuits Code4LibDC 2014 Jason Griffey Evenly Distributed LLC http://evenlydistributed.net
  • 2.
  • 3. SSID: LibraryBox - Free Content! Connect to wifi signal, then launch/refresh any browser Folder: Code4LibDC http://librarybox.us
  • 4.
  • 5.
  • 6.
  • 10. Moore’s Law Photo by Marcin Wichary - http://flic.kr/p/4v4DSq
  • 11. Koomey’s Law Photo by LisaW123 - http://flic.kr/p/7eiqaq
  • 12. Photo by sobczak.paul - http://flic.kr/p/aDD8ep
  • 14. Photo by bjepson - http://flic.kr/p/8EVHqm
  • 15.
  • 18. Photo by dam - http://flic.kr/p/8hLXBM
  • 19. Photo by dam - http://flic.kr/p/8hLXwT
  • 20. Photo by dam - http://flic.kr/p/8hQcJs
  • 21. Photo by dam - http://flic.kr/p/8hQcDG
  • 22. Photo by dam - http://flic.kr/p/8hQcDG
  • 23. Photo by Nathan Chantrell - http://flic.kr/p/aALqhd
  • 24. Photo by Nathan Chantrell - http://flic.kr/p/aALqhd
  • 25.
  • 26.
  • 27. Photo by antonw - http://flic.kr/p/91daJe Shields
  • 28.
  • 29.
  • 30.
  • 33.
  • 34.
  • 36.
  • 37.
  • 38.
  • 39.
  • 40.
  • 41.
  • 42.
  • 43.
  • 45.
  • 46.
  • 47.
  • 48.
  • 49.
  • 50.
  • 51.
  • 52.
  • 53.
  • 54.
  • 55.
  • 56.
  • 57.
  • 58.
  • 59.
  • 60.
  • 61.
  • 62.
  • 63.
  • 65.
  • 68. int val; ! void setup() { pinMode(2,OUTPUT); pinMode(3,OUTPUT); pinMode(4,OUTPUT); pinMode(5,OUTPUT); Serial.begin(9600); } ! void loop() { Serial.println(analogRead(0)); val = analogRead(0); ! if (val > 256) digitalWrite(2,HIGH); if (val < 256) digitalWrite(2,LOW); if (val > 512) digitalWrite(3,HIGH); if (val < 512) digitalWrite(3,LOW); ! if (val > 768) digitalWrite(4,HIGH); if (val < 768) digitalWrite(4,LOW); ! if (val > 769) digitalWrite(5,HIGH); if (val < 1020) digitalWrite(5,LOW); } Globals Setup Loop
  • 69. int val; ! void setup() { pinMode(2,OUTPUT); pinMode(3,OUTPUT); pinMode(4,OUTPUT); pinMode(5,OUTPUT); Serial.begin(9600); } ! void loop() { Serial.println(analogRead(0)); val = analogRead(0); ! if (val > 256) digitalWrite(2,HIGH); if (val < 256) digitalWrite(2,LOW); if (val > 512) digitalWrite(3,HIGH); if (val < 512) digitalWrite(3,LOW); ! if (val > 768) digitalWrite(4,HIGH); if (val < 768) digitalWrite(4,LOW); ! if (val > 769) digitalWrite(5,HIGH); if (val < 1020) digitalWrite(5,LOW); } Globals Setup Loop
  • 70. int val; ! void setup() { pinMode(2,OUTPUT); pinMode(3,OUTPUT); pinMode(4,OUTPUT); pinMode(5,OUTPUT); Serial.begin(9600); } ! void loop() { Serial.println(analogRead(0)); val = analogRead(0); ! if (val > 256) digitalWrite(2,HIGH); if (val < 256) digitalWrite(2,LOW); if (val > 512) digitalWrite(3,HIGH); if (val < 512) digitalWrite(3,LOW); ! if (val > 768) digitalWrite(4,HIGH); if (val < 768) digitalWrite(4,LOW); ! if (val > 769) digitalWrite(5,HIGH); if (val < 1020) digitalWrite(5,LOW); } Globals Setup Loop
  • 71. int val; ! void setup() { pinMode(2,OUTPUT); pinMode(3,OUTPUT); pinMode(4,OUTPUT); pinMode(5,OUTPUT); Serial.begin(9600); } ! void loop() { Serial.println(analogRead(0)); val = analogRead(0); ! if (val > 256) digitalWrite(2,HIGH); if (val < 256) digitalWrite(2,LOW); if (val > 512) digitalWrite(3,HIGH); if (val < 512) digitalWrite(3,LOW); ! if (val > 768) digitalWrite(4,HIGH); if (val < 768) digitalWrite(4,LOW); ! if (val > 769) digitalWrite(5,HIGH); if (val < 1020) digitalWrite(5,LOW); } Globals Setup Loop
  • 72.
  • 74. Can you: • Change one of the Pin Numbers?
  • 75. Can you: • Change one of the Pin Numbers? • Re-wire the ground wires?
  • 76. Can you: • Change one of the Pin Numbers? • Re-wire the ground wires? • Change the order the LEDs light up?
  • 77. Can you: • Change one of the Pin Numbers? • Re-wire the ground wires? • Change the order the LEDs light up? • Light up 2 LEDs at once?
  • 78. Can you: • Change one of the Pin Numbers? • Re-wire the ground wires? • Change the order the LEDs light up? • Light up 2 LEDs at once? • Add another LED?
  • 79. Can you: • Change one of the Pin Numbers? • Re-wire the ground wires? • Change the order the LEDs light up? • Light up 2 LEDs at once? • Add another LED? • Swap the sensor?
  • 80. Structure /* Each Arduino sketch must contain the following two functions. */ void setup() { /* this code runs once at the beginning of the code execution. */ } void loop() { /* this code runs repeatedly over and over as long as the board is powered. */ } Comments // this is a single line /* this is a multiline */ Setup pinMode(pin, [INPUT OUTPUT INPUT_PULLUP]); /* Sets the mode of the digital I/O pin. It can be set as an input, output, or an input with an internal pull-up resistor. */ Control Structures if(condition) { // if condition is TRUE, do something here } else { // otherwise, do this } for(initialization; condition; increment) { // do this } /* The ‘for’ statement is used to repeat a block of statements enclosed in curly braces. An increment counter is usually used to increment and terminate the loop. */ Digital I/O digitalWrite(pin, val); /* val = HIGH or LOW. Sets the digital pin to either ON or OFF. */ int var = digitalRead(pin); /* Reads the voltage from a digital pin. Returns either HIGH or LOW. */ int var = digitalRead(pin); /* Reads the value from a specified digital pin, either HIGH or LOW. */ Analog I/O analogWrite(pin, val); /* Writes an analog voltage to a pin. val = integer value from 0 to 255 */ int var = analogRead(pin); /* Reads the voltage from the specified analog pin. */ int var = analogRead(pin); /* Reads the value from the specified analog pin. */ Time delay(time_ms); /* Pauses the program for the amount of time (in milliseconds). */ delayMicroseconds(time_us); /* Pauses the program for the amount of time (in microseconds). */ millis(); /* Returns the number of milliseconds since the board began running the current program. max: 4,294,967,295 */ micros(); /* Returns the number of microseconds since the board began running the current program. max: 4,294,967,295 */ Serial Communication Serial.begin(baudrate); /* Sets the data rate in bits per second (baud) for serial data transmission. */ Serial.print(""); /* Sets the data rate in bits per second (baud) for serial data transmission. */ Serial.print("Hello World!!"); /* Sends a string "Hello World!!" to the serial bus. This will be seen on the Serial Monitor in Arduino. */ Serial.println("Hello World!"); /* Identical to Serial.print(), but this also adds a carriage-return / line-feed to advance to the next line. */ Serial.println(""); /* Identical to Serial.print(), but this also adds a carriage-return / line-feed to advance to the next line. */ boolean Serial.available() /* Serial.available() returns TRUE if there is data available on the Serial bus. */ int Serial.read(); /* Returns a single byte of data available from the Serial buffer. */ int Serial.read(); /* Returns a single byte of data available from the Serial buffer. */ Data Types void // nothing is returned boolean // 0, 1, false, true char // 8 bits: ASCII character byte // 8 bits: 0 to 255, unsigned int // 16 bits: 32,768 to 32,767, signed long /* 32 bits: 2,147,483,648 to 2,147,483,647, signed */ float // 32 bits, signed decimal Constants HIGH LOW INPUT OUTPUT true false Mathematical Operators = // assignment + // addition - // subtraction * // multiplication / // division % // modulus Logical Operators == // boolean equal to != // not equal to < // less than > // greater than <= // less than or equal to >= // greater than or equal to && // Boolean AND || // Boolean OR ! // Boolean NOT Bitwise Operators & // bitwise AND | // bitwise OR ^ // bitwise XOR ~ // bitwise INVERT var << n // bitwise shift left by n bits var >> n // bitwise shift right by n bits Libraries #include <libraryname.h> /* this provides access to special additional functions for things such as servo motors, SD card, wifi, or bluetooth. */ Advanced I/O tone(pin, freq); /* Generates a square wave of the specified frequency to a pin. Pin must be one of the PWM (~) pins. */ tone(pin, freq, duration); /* Generates a square wave of the specified frequency to a pin for a duration in milliseconds. Pin must be one of the PWM (~) pins. */ noTone(pin); // Turns off the tone on the pin. RedBoard: Power In LilyPad ProtoSnap Simple: Digital I/O PWM(3,5,6,9,10,11) ATmega328 Microcontroller Temperature Sensor (Pin A1) Vibe Motor (Pin 3) RGB LED (Pins R=9, G=11, B=10) Button (Pin A5) Switch (Pin 2) Light Sensor (Pin A6) Buzzer/ Speaker (Pin 7) LEDs (Light Emitting Diodes) (Pins 5, 6, A2, A4, A3) Power 5V / 3.3 / GND USB to Computer Reset Analog Inputs SCL/SDA (I2C Bus) ATmega328 Microcontroller
  • 81. Building Your Own Hardware
  • 83. $300
  • 84. $280
  • 85.
  • 87. Build One Yourself • Arduino - $35
  • 88. Build One Yourself • Arduino - $35 • Data Logger Shield - $20
  • 89. Build One Yourself • Arduino - $35 • Data Logger Shield - $20 • SD Card - $10
  • 90. Build One Yourself • Arduino - $35 • Data Logger Shield - $20 • SD Card - $10 • Sensor (infrared, laser tripwire, ultrasonic, or PID) - $10
  • 91. Build One Yourself • Arduino - $35 • Data Logger Shield - $20 • SD Card - $10 • Sensor (infrared, laser tripwire, ultrasonic, or PID) - $10 • TOTAL COST - $70
  • 93. $240
  • 94. $415
  • 95.
  • 96.
  • 97.
  • 98.
  • 100. Build One Yourself • Arduino - $35
  • 101. Build One Yourself • Arduino - $35 • Data Logger Shield - $20
  • 102. Build One Yourself • Arduino - $35 • Data Logger Shield - $20 • SD Card - $10
  • 103. Build One Yourself • Arduino - $35 • Data Logger Shield - $20 • SD Card - $10 • Temperature/Humidity Sensor - $5-10
  • 104. Build One Yourself • Arduino - $35 • Data Logger Shield - $20 • SD Card - $10 • Temperature/Humidity Sensor - $5-10 • LCD Display screen - $15
  • 105. Build One Yourself • Arduino - $35 • Data Logger Shield - $20 • SD Card - $10 • Temperature/Humidity Sensor - $5-10 • LCD Display screen - $15 • TOTAL COST - $85
  • 107. Other Possibilities • RFID Reader
  • 108. Other Possibilities • RFID Reader • Barcode Scanner
  • 109. Other Possibilities • RFID Reader • Barcode Scanner • Seat usage detector
  • 110. Other Possibilities • RFID Reader • Barcode Scanner • Seat usage detector • What else?
  • 112. Jason Griffey Email: griffey@gmail.com Site: jasongriffey.net gVoice: 423-443-4770 Twitter: @griffey http://librarybox.us http://evenlydistributed.net ! Founder & Principal Consultant http://pinboard.in/u:griffey/ Evenly Distributed LLC