SlideShare a Scribd company logo
Spooky Projects
Introduction to Microcontrollers with Arduino
Class 1
7 Oct 2006 - machineproject - Tod E. Kurt
Everyone’s had a little programming experience, right?
Who’s had any electrical experience?
What’s for Today
• Introduction to Arduino
• Building an LED flashlight
• Making some blinky LED eyes
Class Kit
What’s in your goodie bag
Class Kit Manifest
• Arduino NG USB board
• Arduino ProtoShield
• Solderless breadboard
• USB cable
• RC servo
• piezo buzzer
• 6m hookup wire in ghastly
colors
• potentiometer with knob
• R,G,B and mystery LEDs
• two push switches
• 9V battery and connector
• 220, 330, 10k, and 1M
resistors
• light sensitive resistor
• 5.1v zener diode
• square of velcro
• scary eyeballs
And other bits as we progress
Ignore most of the kit for now, just use Arduino board and USB cable
Complete kit manifest with part numbers will be online
A Word on Safety
• Electronics are toxic to you
• Lead in some of the parts
• Wash up afterwards
• You are toxic to electronics
• Static-sensitive: don’t shuffle your feet
• Wires only bend so much
What is Arduino?
• Open Source Physical Computing Platform
• open source: free to inspect & modify
• physical computing. er, what?ubiquitous computing, pervasive
computing, ambient intelligence, calm computing, everyware, spimes, blogjects, smart objects...
• A physical board, a programming
environment, a development philosophy
• Tiny computer you can program
• Completely stand-alone, talks to other devices
Physical computing as invisible computing
Can run off a battery
Can talk to other computers, cell phones, etc.
What is Arduino?
• Based on AVR-GCC, avr-libc, AVRlib and
Processing (all open source projects)
• Very similar to Basic Stamp (if you know it)
• but cheaper, faster, & open
• Uses AVR ATmega8 microcontroller chip
Basic Stamp uses PIC microcontroller chip.
PICs and AVRs are very comparable, one’s not necessarily better than the other
AVRs are a little better if you’re using a language like C (stack-based)
Don’t need to worry about the chip particulars for now
What is Arduino?
• Why not just use a bare AVR ATmega8 chip?
• Arduino is also a standardized “bootloader”
• A tiny program that loads other programs
• It’s alive during first 5 seconds
A bootloader is akin to an BIOS on a real computer. It handles the startup of the chip
After 5 seconds, your program runs
Don’t need special programmer board with a bootloader
Arduino can work with other AVR chips, some are smaller than your fingernail, cost ~ 40 cents
What is Arduino?
• Capabilities
• 8 kBytes of Flash program memory
• 1 kByte of RAM
• 12 MHz (Apple II: 1 MHz)
• Inputs and Outputs
• 13 digital input/output pins
• 5 analog input pins
Digital I/O can read switches and buttons, control LEDs and motors
Analog input can read knobs or other varying sensors
Analog output can be done with PWM
What is Arduino?
• Write programs on your PC
• Download them into the Arduino board
• Arduino board can then be used by itself
But how do you program it?
No keyboard, mouse or display
Your PC becomes the “head”
Arduino Board
2”
1.7”
reset
button
power
LED
test
LED
TX/RX
LEDs
digital input/output
analog input
Also: USB input, power input, ICSP programming header
Arduino Board
analog inputs
reset
button
power
LED
test
LED
digital I/O
Diagrammatic version, to simplify
But of a slightly older version of the board
Digital? Analog?
• Digital – only has two values: on/off
• Analog – has many (infinite) values
• Computers don’t really do analog
• So they fake it, with quantization
Quantization = breaking up the analog range into bins. The number of bins is the resolution.
More bins = higher accuracy, but is more complex
Digital can be thought of as only two bins.
Arduino Software
compile
(verify)
upload to board
status
area
That’s the full code for blinking an LED, btw.
Arduino defines several useful functions like digitalWrite() and delay(). more on that later
Processing and Wiring not needed
Arduino & Processing
http://processing.org/
build generative art or other applets easily
not needed for Arduino, but can work with it
Arduino has essentially the same GUI as Processing
Easier than Arduino, since all software
Though similar UI and philosophy, Arduino is a different language
We’ll use Processing later in the class to let the computer control Arduino & vice-versa
• Download software: http://arduino.cc/
• Mac OS X PPC or Intel (must pick)
• Windows 2000/XP
• Install drivers
• In “drivers” folder, pick appropriate one
• Windows: unzip driver, plug in board, setup
• “macosx-setup-command” for Mac folk
• Reboot
Installing Arduino
Different Arduino downloads for each operating system
Different drivers for each OS too
“macosx-setup-command” must be run before reboot,
but, it will go away in next version
Using Arduino
• Programs are called “sketches”
• Load up example sketch “led_blink”
Errors
Must select
serial port
“Programmer is
not responding”
What’s my serial port?
Windows: Use Device Manager to find COM port
Mac: It’s called “/dev/tty.usbserial-something”
Using Arduino
• Write program
• Compile (check for errors)
• Reset board
• Upload to board
Try it out with “led_blink”!
On reset, board will flash on-board pin 13 LED really fast for a split-second to indicate bootloader
exists
When uploading, TX/RX lights will flash as data is transferred
Then the board resets, pin 13 will flash fast again
Finally, your program will run
Arduino Board Lifecycle
Take a Break
Making Circuits
heart pumps, blood flows voltage pushes, current flows
LEDs
physical characteristics schematic symbol
• LED = Light-Emitting Diode
• electricity only flows one way in a diode
• Needs a “current limiting” resistor, or burns
out
bar = minus
Many types of integrated lenses.
Some project a narrow beam (like the ones in this class), some project a very wide beam
LED flashlight
wiring diagram schematic
All LED circuits are essentially this: power source, current limiter, LED
Flat part of LED goes to negative, like bar in schematic
The higher the resistance, the dimmer the LED; the lower, the brighter
LED flashlight
Take out solderless breadboard, resistor, LED, and battery and make a circuit
LEDs have been marked a little as to what color they are, but color doesn’t matter here
Solderless Breadboards
groups of 5
connected
but not connected
across the jump not
connected
Insert wires into holes to make a connection.
*Much* easier, quicker than soldering
But, they wear out, are expensive ($8 for this little one)
Using Solderless
Breadboards
Using needle nose pliers can help
Grab wire or lead toward end and push into hole
Blinky LED circuit
wiring diagram schematic
“hello world” of microcontrollers
In schematics signals often flow from top-left to bottom-right
Common nodes like “gnd” are given their own symbol
Pick any digital pin to hook up to, doesn’t matter which
Blinky LED circuit
• Plug shield on top of Arduino board
• Stick breadboard to shield
Blinky LED Software
You’ve already seen it.
Arduino Sketch
Structure
• Declare variables at top
• Initialize
• setup() – run once at beginning, set pins
• Running
• loop() – run repeatedly, after setup()
Pins can be changed in loop() too, but conceptually easier in setup()
Arduino “Language”
• Language is standard C (but made easy)
• Lots of useful functions
• pinMode() – set a pin as input or output
• digitalWrite() – set a digital pin high/low
• digitalRead() – read a digital pin’s state
• analogRead() – read an analog pin
• analogWrite() – write an “analog” PWM value
• delay() – wait an amount of time
• millis() – get the current time
• And many others. And libraries. And examples!
Also: serial library, LCD library, servo examples
Development Cycle
• Make as many changes as you want
• Not like most web programming: edit ➝ run
• Edit ➝ compile ➝ upload ➝ run
edit
compile
upload
run
More Blinky Madness
Add LEDs
Next Week
• Reading buttons
• Reading analog values (knobs)
• Detecting the dark
• More complex LED circuits
• Stand-alone Arduino
Tod E. Kurt
tod@todbot.com
END Class 1
ATmega8 & Arduino

More Related Content

PDF
Arduino electronics cookbook
PDF
Apostila arduino
PDF
Presentation S4A
PPTX
Arduino Day 1 Presentation
PPTX
Arduino
PDF
Arduino uno
PDF
2015-10-21 - Arduino workshop
PPTX
Arduino tutorial A to Z
Arduino electronics cookbook
Apostila arduino
Presentation S4A
Arduino Day 1 Presentation
Arduino
Arduino uno
2015-10-21 - Arduino workshop
Arduino tutorial A to Z

What's hot (20)

PPTX
What are the different types of arduino boards
PDF
Arduino Lecture 1 - Introducing the Arduino
KEY
Intro to Arduino
PDF
Introduction to Arduino
PPTX
Ardui no
PDF
IOTC08 The Arduino Platform
DOCX
The arduino uno is a microcontroller board based on the
PPTX
Introduction to the Arduino
PPTX
Arduino Workshop Day 2
PPTX
Introduction to arduino
PPTX
Arduino Workshop
DOCX
Arduino Full Tutorial
PDF
Ardublock tutorial
PPTX
Introduction to arduino!
PPTX
Introduction to Arduino Microcontroller
PDF
Intro to Arduino Revision #2
PDF
Arduino Lecture 4 - Interactive Media CS4062 Semester 2 2009
PPTX
Arduino as an embedded industrial controller
PDF
Arduino Workshop Day 1 - Basic Arduino
PDF
Arduino: Tutorial de Arduino
What are the different types of arduino boards
Arduino Lecture 1 - Introducing the Arduino
Intro to Arduino
Introduction to Arduino
Ardui no
IOTC08 The Arduino Platform
The arduino uno is a microcontroller board based on the
Introduction to the Arduino
Arduino Workshop Day 2
Introduction to arduino
Arduino Workshop
Arduino Full Tutorial
Ardublock tutorial
Introduction to arduino!
Introduction to Arduino Microcontroller
Intro to Arduino Revision #2
Arduino Lecture 4 - Interactive Media CS4062 Semester 2 2009
Arduino as an embedded industrial controller
Arduino Workshop Day 1 - Basic Arduino
Arduino: Tutorial de Arduino
Ad

Similar to Arduino spooky projects_class1 (20)

PPT
Intro to Arduino
PDF
Introduction to arduino
PPT
arudino introction and types of boards main aruduni uno
PPT
ArduinoPart1.ppt
PPT
ArduinoPart1ArduinoPart1ArduinoPart1.ppt
PPT
ArduinoPart1.ppt
PPT
ArduinoPart1.ppt
PPT
Arduino description and interfacing details
PPT
Arduino un curso de corta duración - Parte 1
PPT
Arduino Uno and micro controller atmega328p
PPT
arduino wit c pp programing gchchchdf.ppt
PPTX
Arduino01.pptx
PPTX
This will give the basic introduction to a arduino
PPS
What is Arduino ?
PDF
Arduino spooky projects_class3
PDF
arduinoworkshop-160204051621.pdf
PPTX
Getting started with arduino uno
PPTX
Internet of Things prescribed by University
PPTX
Basic arduino components and more things about arduino
PDF
aurduino-200107075953.pdf
Intro to Arduino
Introduction to arduino
arudino introction and types of boards main aruduni uno
ArduinoPart1.ppt
ArduinoPart1ArduinoPart1ArduinoPart1.ppt
ArduinoPart1.ppt
ArduinoPart1.ppt
Arduino description and interfacing details
Arduino un curso de corta duración - Parte 1
Arduino Uno and micro controller atmega328p
arduino wit c pp programing gchchchdf.ppt
Arduino01.pptx
This will give the basic introduction to a arduino
What is Arduino ?
Arduino spooky projects_class3
arduinoworkshop-160204051621.pdf
Getting started with arduino uno
Internet of Things prescribed by University
Basic arduino components and more things about arduino
aurduino-200107075953.pdf
Ad

Recently uploaded (20)

PDF
Encapsulation theory and applications.pdf
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Approach and Philosophy of On baking technology
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Machine learning based COVID-19 study performance prediction
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Empathic Computing: Creating Shared Understanding
PPTX
MYSQL Presentation for SQL database connectivity
Encapsulation theory and applications.pdf
Mobile App Security Testing_ A Comprehensive Guide.pdf
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Advanced methodologies resolving dimensionality complications for autism neur...
Approach and Philosophy of On baking technology
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Network Security Unit 5.pdf for BCA BBA.
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
The Rise and Fall of 3GPP – Time for a Sabbatical?
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Encapsulation_ Review paper, used for researhc scholars
Building Integrated photovoltaic BIPV_UPV.pdf
Machine learning based COVID-19 study performance prediction
Chapter 3 Spatial Domain Image Processing.pdf
Programs and apps: productivity, graphics, security and other tools
Empathic Computing: Creating Shared Understanding
MYSQL Presentation for SQL database connectivity

Arduino spooky projects_class1

  • 1. Spooky Projects Introduction to Microcontrollers with Arduino Class 1 7 Oct 2006 - machineproject - Tod E. Kurt Everyone’s had a little programming experience, right? Who’s had any electrical experience?
  • 2. What’s for Today • Introduction to Arduino • Building an LED flashlight • Making some blinky LED eyes
  • 3. Class Kit What’s in your goodie bag
  • 4. Class Kit Manifest • Arduino NG USB board • Arduino ProtoShield • Solderless breadboard • USB cable • RC servo • piezo buzzer • 6m hookup wire in ghastly colors • potentiometer with knob • R,G,B and mystery LEDs • two push switches • 9V battery and connector • 220, 330, 10k, and 1M resistors • light sensitive resistor • 5.1v zener diode • square of velcro • scary eyeballs And other bits as we progress Ignore most of the kit for now, just use Arduino board and USB cable Complete kit manifest with part numbers will be online
  • 5. A Word on Safety • Electronics are toxic to you • Lead in some of the parts • Wash up afterwards • You are toxic to electronics • Static-sensitive: don’t shuffle your feet • Wires only bend so much
  • 6. What is Arduino? • Open Source Physical Computing Platform • open source: free to inspect & modify • physical computing. er, what?ubiquitous computing, pervasive computing, ambient intelligence, calm computing, everyware, spimes, blogjects, smart objects... • A physical board, a programming environment, a development philosophy • Tiny computer you can program • Completely stand-alone, talks to other devices Physical computing as invisible computing Can run off a battery Can talk to other computers, cell phones, etc.
  • 7. What is Arduino? • Based on AVR-GCC, avr-libc, AVRlib and Processing (all open source projects) • Very similar to Basic Stamp (if you know it) • but cheaper, faster, & open • Uses AVR ATmega8 microcontroller chip Basic Stamp uses PIC microcontroller chip. PICs and AVRs are very comparable, one’s not necessarily better than the other AVRs are a little better if you’re using a language like C (stack-based) Don’t need to worry about the chip particulars for now
  • 8. What is Arduino? • Why not just use a bare AVR ATmega8 chip? • Arduino is also a standardized “bootloader” • A tiny program that loads other programs • It’s alive during first 5 seconds A bootloader is akin to an BIOS on a real computer. It handles the startup of the chip After 5 seconds, your program runs Don’t need special programmer board with a bootloader Arduino can work with other AVR chips, some are smaller than your fingernail, cost ~ 40 cents
  • 9. What is Arduino? • Capabilities • 8 kBytes of Flash program memory • 1 kByte of RAM • 12 MHz (Apple II: 1 MHz) • Inputs and Outputs • 13 digital input/output pins • 5 analog input pins Digital I/O can read switches and buttons, control LEDs and motors Analog input can read knobs or other varying sensors Analog output can be done with PWM
  • 10. What is Arduino? • Write programs on your PC • Download them into the Arduino board • Arduino board can then be used by itself But how do you program it? No keyboard, mouse or display Your PC becomes the “head”
  • 12. Arduino Board analog inputs reset button power LED test LED digital I/O Diagrammatic version, to simplify But of a slightly older version of the board
  • 13. Digital? Analog? • Digital – only has two values: on/off • Analog – has many (infinite) values • Computers don’t really do analog • So they fake it, with quantization Quantization = breaking up the analog range into bins. The number of bins is the resolution. More bins = higher accuracy, but is more complex Digital can be thought of as only two bins.
  • 14. Arduino Software compile (verify) upload to board status area That’s the full code for blinking an LED, btw. Arduino defines several useful functions like digitalWrite() and delay(). more on that later Processing and Wiring not needed
  • 15. Arduino & Processing http://processing.org/ build generative art or other applets easily not needed for Arduino, but can work with it Arduino has essentially the same GUI as Processing Easier than Arduino, since all software Though similar UI and philosophy, Arduino is a different language We’ll use Processing later in the class to let the computer control Arduino & vice-versa
  • 16. • Download software: http://arduino.cc/ • Mac OS X PPC or Intel (must pick) • Windows 2000/XP • Install drivers • In “drivers” folder, pick appropriate one • Windows: unzip driver, plug in board, setup • “macosx-setup-command” for Mac folk • Reboot Installing Arduino Different Arduino downloads for each operating system Different drivers for each OS too “macosx-setup-command” must be run before reboot, but, it will go away in next version
  • 17. Using Arduino • Programs are called “sketches” • Load up example sketch “led_blink”
  • 19. What’s my serial port? Windows: Use Device Manager to find COM port Mac: It’s called “/dev/tty.usbserial-something”
  • 20. Using Arduino • Write program • Compile (check for errors) • Reset board • Upload to board Try it out with “led_blink”! On reset, board will flash on-board pin 13 LED really fast for a split-second to indicate bootloader exists When uploading, TX/RX lights will flash as data is transferred Then the board resets, pin 13 will flash fast again Finally, your program will run
  • 23. Making Circuits heart pumps, blood flows voltage pushes, current flows
  • 24. LEDs physical characteristics schematic symbol • LED = Light-Emitting Diode • electricity only flows one way in a diode • Needs a “current limiting” resistor, or burns out bar = minus Many types of integrated lenses. Some project a narrow beam (like the ones in this class), some project a very wide beam
  • 25. LED flashlight wiring diagram schematic All LED circuits are essentially this: power source, current limiter, LED Flat part of LED goes to negative, like bar in schematic The higher the resistance, the dimmer the LED; the lower, the brighter
  • 26. LED flashlight Take out solderless breadboard, resistor, LED, and battery and make a circuit LEDs have been marked a little as to what color they are, but color doesn’t matter here
  • 27. Solderless Breadboards groups of 5 connected but not connected across the jump not connected Insert wires into holes to make a connection. *Much* easier, quicker than soldering But, they wear out, are expensive ($8 for this little one)
  • 28. Using Solderless Breadboards Using needle nose pliers can help Grab wire or lead toward end and push into hole
  • 29. Blinky LED circuit wiring diagram schematic “hello world” of microcontrollers In schematics signals often flow from top-left to bottom-right Common nodes like “gnd” are given their own symbol Pick any digital pin to hook up to, doesn’t matter which
  • 30. Blinky LED circuit • Plug shield on top of Arduino board • Stick breadboard to shield
  • 31. Blinky LED Software You’ve already seen it.
  • 32. Arduino Sketch Structure • Declare variables at top • Initialize • setup() – run once at beginning, set pins • Running • loop() – run repeatedly, after setup() Pins can be changed in loop() too, but conceptually easier in setup()
  • 33. Arduino “Language” • Language is standard C (but made easy) • Lots of useful functions • pinMode() – set a pin as input or output • digitalWrite() – set a digital pin high/low • digitalRead() – read a digital pin’s state • analogRead() – read an analog pin • analogWrite() – write an “analog” PWM value • delay() – wait an amount of time • millis() – get the current time • And many others. And libraries. And examples! Also: serial library, LCD library, servo examples
  • 34. Development Cycle • Make as many changes as you want • Not like most web programming: edit ➝ run • Edit ➝ compile ➝ upload ➝ run edit compile upload run
  • 36. Next Week • Reading buttons • Reading analog values (knobs) • Detecting the dark • More complex LED circuits • Stand-alone Arduino