Cover image for Arduino Workshop

Book description

Arduino Workshop takes you through 65 electronics projects that show the full range of cool stuff you can do with Arduino.

Table of Contents

  1. Dedication
  2. Acknowledgments
  3. 1. Getting Started
    1. The Possibilities Are Endless
    2. Strength in Numbers
    3. Parts and Accessories
    4. Required Software
      1. Mac OS X
        1. Installing the IDE
        2. Setting Up the IDE
      2. Windows XP and Later
        1. Installing the IDE
        2. Installing Drivers
        3. Setting Up the IDE
      3. Ubuntu Linux 9.04 and Later
        1. Installing the IDE
        2. Setting Up the IDE
    5. Safety
    6. Looking Ahead
  4. 2. Exploring the Arduino Board and the IDE
    1. The Arduino Board
    2. Taking a Look Around the IDE
      1. The Command Area
        1. Menu Items
        2. The Icons
      2. The Text Area
      3. The Message Window Area
    3. Creating Your First Sketch in the IDE
      1. Comments
      2. The Setup Function
      3. Controlling the Hardware
      4. The Loop Function
      5. Verifying Your Sketch
      6. Uploading and Running Your Sketch
      7. Modifying Your Sketch
    4. Looking Ahead
  5. 3. First Steps
    1. Planning Your Projects
    2. About Electricity
      1. Current
      2. Voltage
      3. Power
    3. Electronic Components
      1. The Resistor
        1. Resistance
        2. Reading Resistance Values
        3. Chip Resistors
        4. Multimeters
        5. Power Rating
      2. The Light-Emitting Diode
      3. The Solderless Breadboard
    4. Project #1: Creating a Blinking LED Wave
      1. The Algorithm
      2. The Hardware
      3. The Sketch
      4. The Schematic
      5. Running the Sketch
    5. Using Variables
    6. Project #2: Repeating with for Loops
    7. Varying LED Brightness with Pulse-Width Modulation
    8. Project #3: Demonstrating PWM
    9. More Electric Components
      1. The Transistor
      2. The Rectifier Diode
      3. The Relay
    10. Higher-Voltage Circuits
    11. Looking Ahead
  6. 4. Building Blocks
    1. Using Schematic Diagrams
      1. Identifying Components
        1. The Arduino
        2. The Resistor
        3. The Rectifier Diode
        4. The LED
        5. The Transistor
        6. The Relay
      2. Wires in Schematics
        1. Crossing but Not Connected Wires
        2. Connected Wires
        3. Wire Connected to Ground
      3. Dissecting a Schematic
    2. The Capacitor
      1. Measuring the Capacity of a Capacitor
      2. Reading Capacitor Values
      3. Types of Capacitors
        1. Ceramic Capacitors
        2. Electrolytic Capacitors
    3. Digital Inputs
    4. Project #4: Demonstrating a Digital Input
      1. The Algorithm
      2. The Hardware
      3. The Schematic
      4. The Sketch
      5. Modifying Your Sketch
      6. Understanding the Sketch
      7. Creating Constants with #define
      8. Reading Digital Input Pins
      9. Making Decisions with if
      10. Making More Decisions with if-then-else
    5. Boolean Variables
      1. Comparison Operators
        1. The not Operator
        2. The and Operator
        3. The or Operator
      2. Making Two or More Comparisons
    6. Project #5: Controlling Traffic
      1. The Goal
      2. The Algorithm
      3. The Hardware
      4. The Schematic
      5. The Sketch
      6. Running the Sketch
    7. Analog vs. Digital Signals
    8. Project #6: Creating a Single-Cell Battery Tester
      1. The Goal
      2. The Algorithm
      3. The Hardware
      4. The Schematic
      5. The Sketch
    9. Doing Arithmetic with an Arduino
      1. Float Variables
      2. Comparison Operators for Calculations
    10. Improving Analog Measurement Precision with a Reference Voltage
      1. Using an External Reference Voltage
      2. Using the Internal Reference Voltage
    11. The Variable Resistor
    12. Piezoelectric Buzzers
      1. Piezo Schematic
    13. Project #7: Trying Out a Piezo Buzzer
    14. Project #8: Creating a Quick-Read Thermometer
      1. The Goal
      2. The Hardware
      3. The Schematic
      4. The Sketch
      5. Hacking the Sketch
    15. Looking Ahead
  7. 5. Working with Functions
    1. Project #9: Creating a Function to Repeat an Action
    2. Project #10: Creating a Function to Set the Number of Blinks
    3. Creating a Function to Return a Value
    4. Project #11: Creating a Quick-Read Thermometer That Blinks the Temperature
      1. The Hardware
      2. The Schematic
      3. The Sketch
    5. Displaying Data from the Arduino in the Serial Monitor
      1. The Serial Monitor
        1. Starting the Serial Monitor
        2. Sending Text to the Serial Monitor
        3. Displaying the Contents of Variables
    6. Project #12: Displaying the Temperature in the Serial Monitor
      1. Debugging with the Serial Monitor
    7. Making Decisions with while Statements
      1. do-while
    8. Sending Data from the Serial Monitor to the Arduino
    9. Project #13: Multiplying a Number by Two
    10. long Variables
    11. Project #14: Using long Variables
    12. Looking Ahead
  8. 6. Numbers, Variables, and Arithmetic
    1. Generating Random Numbers
      1. Using Ambient Current to Generate a Random Number
    2. Project #15: Creating an Electronic Die
      1. The Hardware
      2. The Schematic
      3. The Sketch
      4. Modifying the Sketch
    3. A Quick Course in Binary
      1. Byte Variables
    4. Increasing Digital Outputs with Shift Registers
    5. Project #16: Creating an LED Binary Number Display
      1. The Hardware
      2. Connecting the 74HC595
      3. The Sketch
    6. Project #17: Making a Binary Quiz Game
      1. The Algorithm
      2. The Sketch
    7. Arrays
      1. Defining an Array
      2. Referring to Values in an Array
      3. Writing to and Reading from Arrays
    8. Seven-Segment LED Displays
      1. Controlling the LED
    9. Project #18: Creating a Single-Digit Display
      1. The Hardware
      2. The Schematic
      3. The Sketch
      4. Displaying Double Digits
    10. Project #19: Controlling Two Seven-Segment LED Display Modules
      1. The Hardware
      2. The Schematic
      3. Modulo
    11. Project #20: Creating a Digital Thermometer
      1. The Hardware
      2. The Sketch
    12. LED Matrix Display Modules
      1. The LED Matrix Schematic
      2. Making the Connections
    13. Bitwise Arithmetic
      1. The Bitwise AND Operator
      2. The Bitwise OR Operator
      3. The Bitwise XOR Operator
      4. The Bitwise NOT Operator
      5. Bitshift Left and Right
    14. Project #21: Creating an LED Matrix
    15. Project #22: Creating Images on an LED Matrix
    16. Project #23: Displaying an Image on an LED Matrix
    17. Project #24: Animating an LED Matrix
      1. The Sketch
    18. Looking Ahead
  9. 7. Liquid Crystal Displays
    1. Character LCD Modules
      1. Using a Character LCD in a Sketch
      2. Displaying Text
      3. Displaying Variables or Numbers
    2. Project #25: Defining Custom Characters
    3. Graphic LCD Modules
      1. Connecting the Graphic LCD
      2. Using the LCD
      3. Controlling the Display
    4. Project #26: Seeing the Text Functions in Action
      1. Creating More Complex Display Effects
    5. Project #27: Creating a Temperature History Monitor
      1. The Algorithm
      2. The Hardware
      3. The Sketch
      4. The Result
      5. Modifying the Sketch
    6. Looking Ahead
  10. 8. Expanding Your Arduino
    1. Shields
    2. ProtoShields
    3. Project #28: Creating a Custom Shield with Eight LEDs
      1. The Hardware
      2. The Schematic
      3. The Layout of the ProtoShield Board
      4. The Design
      5. Soldering the Components
      6. Modifying the Custom Shield
    4. Expanding Sketches with Libraries
      1. Importing a Shield’s Libraries
        1. Installing the Library on Mac OS X
        2. Installing the Library on Windows XP and Later
        3. Installing the Library on Ubuntu Linux 11.04 and Later
    5. MicroSD Memory Cards
      1. Testing Your MicroSD Card
    6. Project #29: Writing Data to the Memory Card
    7. Project #30: Creating a Temperature-Logging Device
      1. The Hardware
      2. The Sketch
    8. Timing Applications with millis() and micros()
    9. Project #31: Creating a Stopwatch
      1. The Hardware
      2. The Schematic
      3. The Sketch
    10. Interrupts
      1. Interrupt Modes
      2. Configuring Interrupts
      3. Activating or Deactivating Interrupts
    11. Project #32: Using Interrupts
      1. The Sketch
    12. Looking Ahead
  11. 9. Numeric Keypads
    1. Using a Numeric Keypad
      1. Wiring a Keypad
      2. Programming for the Keypad
      3. Testing the Sketch
    2. Making Decisions with switch-case
    3. Project #33: Creating a Keypad-Controlled Lock
      1. The Sketch
      2. How It Works
      3. Testing the Sketch
    4. Looking Ahead
  12. 10. Accepting User Input with Touchscreens
    1. Touchscreens
      1. Connecting the Touchscreen
    2. Project #34: Addressing Areas on the Touchscreen
      1. The Hardware
      2. The Sketch
      3. Testing the Sketch
      4. Mapping the Touchscreen
    3. Project #35: Creating a Two-Zone On/Off Touch Switch
      1. The Sketch
      2. How It Works
      3. Testing the Sketch
    4. Project #36: Creating a Three-Zone Touch Switch
      1. The Touchscreen Map
      2. The Sketch
      3. How It Works
    5. Looking Ahead
  13. 11. Meet the Arduino Family
    1. Project #37: Creating Your Own Breadboard Arduino
      1. The Hardware
        1. 7805 Linear Voltage Regulator
        2. 16 MHz Crystal Oscillator
        3. Atmel ATmega328-PU Microcontroller IC
      2. The Schematic
        1. Identifying the Arduino Pins
      3. Running a Test Sketch
        1. Use the Microcontroller Swap Method
        2. Connect to an Existing Arduino Board
        3. Use an FTDI Programming Cable
    2. The Many Arduino Boards
      1. Arduino Uno
      2. Freetronics Eleven
      3. The Freeduino
      4. The Boarduino
      5. The Arduino Nano
      6. The Arduino LilyPad
      7. The Arduino Mega 2560
      8. The Freetronics EtherMega
      9. The Arduino Due
    3. Looking Ahead
  14. 12. Motors and Movement
    1. Making Small Motions with Servos
      1. Selecting a Servo
      2. Connecting a Servo
      3. Putting a Servo to Work
    2. Project #38: Building an Analog Thermometer
      1. The Hardware
      2. The Schematic
      3. The Sketch
    3. Using Electric Motors
      1. The TIP120 Darlington Transistor
    4. Project #39: Controlling the Motor
      1. The Hardware
      2. The Schematic
      3. The Sketch
    5. Project #40: Building and Controlling a Tank Robot
      1. The Hardware
        1. The Chassis
        2. Two Power Supplies
        3. The Mounting Plate
      2. The Schematic
        1. Connecting the Motor Shield
        2. Connecting the Jumpers
      3. The Sketch
    6. Sensing Collisions
    7. Project #41: Detecting Tank Bot Collisions with a Microswitch
      1. The Schematic
      2. The Sketch
    8. Infrared Distance Sensors
      1. Wiring It Up
      2. Testing the IR Distance Sensor
    9. Project #42: Detecting Tank Bot Collisions with IR Distance Sensor
    10. Ultrasonic Distance Sensors
      1. Connecting the Ultrasonic Sensor
      2. Using the Ultrasonic Sensor
      3. Testing the Ultrasonic Distance Sensor
    11. Project #43: Detecting Tank Bot Collisions with an Ultrasonic Distance Sensor
      1. The Sketch
    12. Looking Ahead
  15. 13. Using GPS with Your Arduino
    1. What Is GPS?
    2. Testing the GPS Shield
    3. Project #44: Creating a Simple GPS Receiver
      1. The Hardware
      2. The Sketch
      3. Displaying the Position on the LCD
    4. Project #45: Creating an Accurate GPS-based Clock
      1. The Hardware
      2. The Sketch
    5. Project #46: Recording the Position of a Moving Object over Time
      1. The Hardware
      2. The Sketch
      3. Displaying Locations on a Map
    6. Looking Ahead
  16. 14. Wireless Data
    1. Using Low-cost Wireless Modules
    2. Project #47: Creating a Wireless Remote Control
      1. The Hardware for the Transmitter Circuit
      2. The Transmitter Schematic
      3. The Hardware for the Receiver Circuit
      4. The Receiver Schematic
      5. The Transmitter Sketch
      6. The Receiver Sketch
    3. Using XBee Wireless Data Modules for Greater Range and Faster Speed
    4. Project #48: Transmitting Data with an XBee
      1. The Sketch
      2. Setting Up the Computer to Receive Data
    5. Project #49: Building a Remote Control Thermometer
      1. The Hardware
      2. The Layout
      3. The Sketch
      4. Operation
    6. Looking Ahead
  17. 15. Infrared Remote Control
    1. What Is Infrared?
    2. Setting Up for Infrared
      1. The IR Receiver
      2. The Remote Control
      3. A Test Sketch
      4. Testing the Setup
    3. Project #50: Creating an IR Remote Control Arduino
      1. The Hardware
      2. The Sketch
      3. Expanding the Sketch
    4. Project #51: Creating an IR Remote Control Tank
      1. The Hardware
      2. The Sketch
    5. Looking Ahead
  18. 16. Reading RFID Tags
    1. Inside RFID Devices
    2. Testing the Hardware
      1. The Schematic
      2. Testing the Schematic
        1. The Test Sketch
        2. Check Serial Monitor
    3. Project #52: Creating a Simple RFID Control System
      1. The Sketch
      2. How It Works
    4. Storing Data in the Arduino’s Built-in EEPROM
      1. Reading and Writing to the EEPROM
    5. Project #53: Creating an RFID Control with “Last Action” Memory
      1. The Sketch
      2. How It Works
    6. Looking Ahead
  19. 17. Data Buses
    1. The I
    2. Project #54: Using an External EEPROM
      1. The Hardware
      2. The Schematic
      3. The Sketch
      4. The Result
    3. Project #55: Using a Port Expander IC
      1. The Hardware
      2. The Schematic
      3. The Sketch
    4. The SPI Bus
      1. Pin Connections
      2. Implementing the SPI
      3. Sending Data to an SPI Device
    5. Project #56: Using a Digital Rheostat
      1. The Hardware
      2. The Schematic
      3. The Sketch
    6. Looking Ahead
  20. 18. Real-time Clocks
    1. Connecting the RTC Module
    2. Project #57: Adding and Displaying Time and Date with an RTC
      1. The Hardware
      2. The Sketch
      3. How It Works
    3. Project #58: Creating a Simple Digital Clock
      1. The Hardware
      2. The Sketch
      3. How It Works and Results
    4. Project #59: Creating an RFID Time-Clock System
      1. The Hardware
      2. The Sketch
      3. How It Works
    5. Looking Ahead
  21. 19. The Internet
    1. What You’ll Need
    2. Project #60: Building a Remote-Monitoring Station
      1. The Hardware
      2. The Sketch
      3. Troubleshooting
      4. How It Works
    3. Project #61: Creating an Arduino Tweeter
      1. The Hardware
      2. The Sketch
    4. Controlling Your Arduino from the Web
    5. Project #62: Setting Up a Remote Control for Your Arduino
      1. The Hardware
      2. The Sketch
      3. Controlling Your Arduino Remotely
    6. Looking Ahead
  22. 20. Cellular Communications
    1. The Hardware
      1. Preparing the Power Shield
      2. Hardware Configuration and Testing
      3. Changing the Operating Frequency
    2. Project #63: Building an Arduino Dialer
      1. The Hardware
      2. The Schematic
      3. The Sketch
      4. How It Works
    3. Project #64: Building an Arduino Texter
      1. The Sketch
      2. How It Works
    4. Project #65: Setting Up an SMS Remote Control
      1. The Hardware
      2. The Schematic
      3. The Sketch
      4. How It Works
    5. Looking Ahead
  23. Index
  24. About the Author
  25. Copyright