You are previewing Practical Arduino: Cool Projects for Open Source Hardware.
O'Reilly logo
Practical Arduino: Cool Projects for Open Source Hardware

Book Description

Create your own Arduino-based designs, gain in-depth knowledge of the architecture of Arduino, and learn the user-friendly Arduino language all in the context of practical projects that you can build yourself at home. Get hands-on experience using a variety of projects and recipes for everything from home automation to test equipment.

Arduino has taken off as an incredibly popular building block among ubicomp (ubiquitous computing) enthusiasts, robotics hobbyists, and DIY home automation developers. Authors Jonathan Oxer and Hugh Blemings provide detailed instructions for building a wide range of both practical and fun Arduino-related projects, covering areas such as hobbies, automotive, communications, home automation, and instrumentation.

  • Take Arduino beyond "blink" to a wide variety of projects from simple to challenging

  • Hands-on recipes for everything from home automation to interfacing with your car engine management system

  • Explanations of techniques and references to handy resources for ubiquitous computing projects

Supplementary material includes a circuit schematic reference, introductions to a range of electronic engineering principles and general hints & tips. These combine with the projects themselves to make Practical Arduino: Cool Projects for Open Source Hardware an invaluable reference for Arduino users of all levels. You'll learn a wide variety of techniques that can be applied to your own projects.

Table of Contents

  1. Copyright
  2. About the Author
  3. About the Technical Reviewers
  4. Acknowledgments
  5. Introduction
  6. 1. Introduction
    1. 1.1. Fundamentals
    2. 1.2. Sharing Your Work
    3. 1.3. Practical Electronics for Software Developers
      1. 1.3.1. Current, Voltage, and Power
      2. 1.3.2. Mains Is Nasty
      3. 1.3.3. Reading Schematics
      4. 1.3.4. Resistance and Resistors
      5. 1.3.5. Ohm's Law and Current Limiting
      6. 1.3.6. Choosing Wire
      7. 1.3.7. Diodes
      8. 1.3.8. Power Supplies
      9. 1.3.9. USB Power
      10. 1.3.10. Batteries
      11. 1.3.11. Wall Warts/Plugpacks
      12. 1.3.12. Capacitance and Capacitors
      13. 1.3.13. Fundamentals
      14. 1.3.14. Capacitor Types
      15. 1.3.15. Power Supply Bypass
      16. 1.3.16. ESD Precautions
      17. 1.3.17. Tools
      18. 1.3.18. Parts
      19. 1.3.19. Further Reading
  7. 2. Appliance Remote Control
    1. 2.1. Parts Required
    2. 2.2. Instructions
      1. 2.2.1. Test and Investigate Appliance Remote
      2. 2.2.2. Assemble Reed Relay Shield
      3. 2.2.3. Connect Reed Relay Shield to Remote Control
      4. 2.2.4. Create Reed Relay Control Program
        1. 2.2.4.1. ApplianceRemoteControl
        2. 2.2.4.2. ApplianceRemoteControlCompact
      5. 2.2.5. Test Reed Relay Shield and Sketch
    3. 2.3. Variations
      1. 2.3.1. Wireless Link
      2. 2.3.2. Automatic Trigger
      3. 2.3.3. Socket Connections
  8. 3. Time-Lapse Camera Controller
    1. 3.1. Parts Required
    2. 3.2. Instructions
      1. 3.2.1. Assemble Prototyping Shield
      2. 3.2.2. Connect Camera Shutter Release
        1. 3.2.2.1. Remote Shutter Release Connector
          1. 3.2.2.1.1. Panasonic Cable Connection
          2. 3.2.2.1.2. Canon Connection
        2. 3.2.2.2. Infrared Remote Control
        3. 3.2.2.3. Modify Camera
      3. 3.2.3. Configure Camera
      4. 3.2.4. Calculate Photo Interval
      5. 3.2.5. Configure and Load Sketch
      6. 3.2.6. Check Memory Capacity
      7. 3.2.7. Set Up Your Shoot
      8. 3.2.8. Process the Images
      9. 3.2.9. Linux
      10. 3.2.10. Windows
        1. 3.2.10.1. Macintosh
    3. 3.3. Variations
  9. 4. Virtual USB Keyboard
    1. 4.1. Parts Required
    2. 4.2. Instructions
      1. 4.2.1. Populate Prototyping Shield
      2. 4.2.2. Prepare the UsbKeyboard Library
      3. 4.2.3. Compile and Upload Sketch
    3. 4.3. Variations
      1. 4.3.1. Chording Keyboard
  10. 5. PS/2 Keyboard or Mouse Input
    1. 5.1. Parts Required
    2. 5.2. Instructions
      1. 5.2.1. PS/2 Connections
      2. 5.2.2. Recycled 6-Pin Mini-DIN Sockets
      3. 5.2.3. 6-Pin Mini-DIN Panel Sockets
      4. 5.2.4. PS/2 Extension Cable
      5. 5.2.5. Keyboard Software
      6. 5.2.6. Mouse Software
      7. 5.2.7. Variations
        1. 5.2.7.1. Barcode Reader for a Stock Control System
    3. 5.3. Resources
  11. 6. Security/Automation Sensors
    1. 6.1. Parts Required1
    2. 6.2. Instructions
      1. 6.2.1. Security Sensor Basics
      2. 6.2.2. Assemble Four-Channel Alarm Sensor Shield
      3. 6.2.3. Install End-of-Line Resistors on Sensor
      4. 6.2.4. Load Test Program
      5. 6.2.5. PIR Placement
    3. 6.3. Variations
      1. 6.3.1. Visual Display Written in Processing
      2. 6.3.2. Home Security System
      3. 6.3.3. Multiple Buttons on One Input
  12. 7. Online Thermometer
    1. 7.1. Parts Required
    2. 7.2. Instructions
      1. 7.2.1. Mount PCB Plugs on Shield
      2. 7.2.2. Connect Data Lines
      3. 7.2.3. Assemble Sensors
    3. 7.3. Load Program
    4. 7.4. Variations
  13. 8. Touch Control Panel
    1. 8.1. Parts Required
    2. 8.2. Instructions
      1. 8.2.1. How Resistive Touch Screens Work
      2. 8.2.2. Basic Touch Screen Connection Test
      3. 8.2.3. Arduino TouchScreen Library
      4. 8.2.4. Controlling a "Processing" Program
      5. 8.2.5. Construct Hardware for Home Automation Control Panel
      6. 8.2.6. Calibrate Hot Zones
      7. 8.2.7. Mount Arduino
  14. 9. Speech Synthesizer
    1. 9.1. Parts Required
    2. 9.2. Instructions
      1. 9.2.1. Speech Output Signal
      2. 9.2.2. Beginning Assembly
      3. 9.2.3. SpeakJet PWM "Audio" Output
      4. 9.2.4. Quick Test
      5. 9.2.5. Fit Status Indicators
      6. 9.2.6. Making a Line-Level Output Cable
      7. 9.2.7. On-Board Amplifier
      8. 9.2.8. Speech Synthesizer Software
      9. 9.2.9. Create Your Own Messages
    3. 9.3. Variations
      1. 9.3.1. Read SpeakJet Status
    4. 9.4. Resources
  15. 10. Water Flow Gauge
    1. 10.1. Parts Required
    2. 10.2. Instructions
      1. 10.2.1. Replace Sensor Connector
      2. 10.2.2. Prepare Prototyping Shield
      3. 10.2.3. Prepare LCD Module
      4. 10.2.4. Fit LCD to Case
      5. 10.2.5. Fit Arduino in Case
      6. 10.2.6. Determine Scaling Factor
      7. 10.2.7. Configure, Compile, and Test Sketch
        1. 10.2.7.1. Hardware Interrupts
        2. 10.2.7.2. Volatile Variables
      8. 10.2.8. Flow Gauge Sketch
      9. 10.2.9. Install Flow Sensor
    3. 10.3. Variations
      1. 10.3.1. Online Logging
      2. 10.3.2. Multiple Sensors
    4. 10.4. Resources
  16. 11. Oscilloscope/Logic Analyzer
    1. 11.1. Parts Required
    2. 11.2. Instructions
      1. 11.2.1. Assemble the Case
      2. 11.2.2. Fit the Prototyping Shield
      3. 11.2.3. Make Test Probes
        1. 11.2.3.1. How Successive Approximation ADC Works
      4. 11.2.4. Connection to Circuit under Test
      5. 11.2.5. Install Software in Arduino
        1. 11.2.5.1. Analog Read Version
        2. 11.2.5.2. Digital Read Version
        3. 11.2.5.3. Digital Read Sketch with Optimized Communications Format
      6. 11.2.6. Install Processing and Run Visualization Program
    3. 11.3. Variations
      1. 11.3.1. Input Voltage Prescaler
    4. 11.4. Resources
  17. 12. Water Tank Depth Sensor
    1. 12.1. Parts Required
    2. 12.2. Instructions
      1. 12.2.1. Assemble the Shield
      2. 12.2.2. Determine Sensor Installation Method
      3. 12.2.3. Assemble the Sensor Housing
      4. 12.2.4. Assemble the Arduino Housing
      5. 12.2.5. Install the WiShield Library and Driver
      6. 12.2.6. Load the Tank-Level Sketch
      7. 12.2.7. Prettier Web Interface
      8. 12.2.8. Calibrating the "Empty Tank" Level
      9. 12.2.9. Install the Sensor and Arduino
      10. 12.2.10. Calibrating the "Full Tank" Level
    3. 12.3. Variations
      1. 12.3.1. Upload Data to Pachube
      2. 12.3.2. Control Pumps or Irrigation
      3. 12.3.3. Local Level Display
      4. 12.3.4. Reading Multiple Tanks
  18. 13. Weather Station Receiver
    1. 13.1. Parts Required
    2. 13.2. Instructions
      1. 13.2.1. Test and Install the Weather Station
      2. 13.2.2. Understanding the Circuit
      3. 13.2.3. Assemble the Receiver Shield
      4. 13.2.4. Weather Station Receiver Program
      5. 13.2.5. Twitter Weather Updates
    3. 13.3. Variations
      1. 13.3.1. Private Online Weather Station
  19. 14. RFID Access Control System
    1. 14.1. Parts Required
    2. 14.2. Instructions
      1. 14.2.1. Assemble the Prototyping Shield
        1. 14.2.1.1. Power Supply
        2. 14.2.1.2. RFID Serial Connection
        3. 14.2.1.3. Relay Output
        4. 14.2.1.4. Indicator LEDs
      2. 14.2.2. Manual Release Button
      3. 14.2.3. Assemble the ID-12 Reader Module
      4. 14.2.4. Assemble the RDM630 Reader
      5. 14.2.5. Simple Stand-Alone Sketch
      6. 14.2.6. Install the Strike Plate
      7. 14.2.7. Install the Reader
      8. 14.2.8. Install the Arduino
    3. 14.3. Variations
      1. 14.3.1. Extensible Read Head
      2. 14.3.2. Speech Synthesizer Feedback
      3. 14.3.3. Intelligent Desk Pad
    4. 14.4. Resources
  20. 15. Vehicle Telemetry Platform
    1. 15.1. Parts Required
    2. 15.2. Instructions
      1. 15.2.1. Check the Vehicle Interface
      2. 15.2.2. Obtain a USB/OBD-II or RS-232 Adapter
      3. 15.2.3. Test the USB/OBD-II Adapter
      4. 15.2.4. Understanding OBD-II Modes and Parameters
      5. 15.2.5. Prepare the USB/OBD-II Adapter
      6. 15.2.6. Assemble the OBD-II Cable
      7. 15.2.7. Prepare the GPS Module
      8. 15.2.8. Assemble the Power Supply on the Shield
      9. 15.2.9. Fit the Serial Connections on the Shield
      10. 15.2.10. Prepare the VDIP1 Module
      11. 15.2.11. The LCD Module
      12. 15.2.12. Logging Control Button and Status LEDs
      13. 15.2.13. Mount in Sub-Assemblies in the Case
      14. 15.2.14. OBDuino Mega Sketch
        1. 15.2.14.1. OBDuinoMega.pde
        2. 15.2.14.2. LCD.pde
        3. 15.2.14.3. GPS.pde
        4. 15.2.14.4. VDIP.pde
        5. 15.2.14.5. Host.pde
        6. 15.2.14.6. PowerFail.pde
      15. 15.2.15. Using the OBDuinoMega Sketch
        1. 15.2.15.1. Menu Buttons
        2. 15.2.15.2. Running Logging
        3. 15.2.15.3. Generate Google Earth Track
        4. 15.2.15.4. Generate Charts of Parameters
    3. 15.3. Variations
      1. 15.3.1. Mobile Internet Connection
      2. 15.3.2. Vehicle Control
      3. 15.3.3. Speech Synthesizer Output
      4. 15.3.4. 3D Accelerometer
      5. 15.3.5. Digital Compass
      6. 15.3.6. "Knight Rider"–Style Alarm Status
      7. 15.3.7. Battery Condition Check
    4. 15.4. Resources
  21. 16. Resources
    1. 16.1. Simple Voltage Regulators
      1. 16.1.1. Power Dissipation
      2. 16.1.2. Dropout Voltage
      3. 16.1.3. Efficiency
    2. 16.2. Driving LEDs
      1. 16.2.1. Multiplexing
      2. 16.2.2. Charlieplexing
    3. 16.3. Output Circuitry and Isolation
      1. 16.3.1. Semiconductor and Mechanical Switches
        1. 16.3.1.1. Reed Relays
        2. 16.3.1.2. Relays
        3. 16.3.1.3. Bipolar Transistors
        4. 16.3.1.4. Transistor Arrays
        5. 16.3.1.5. FETs
        6. 16.3.1.6. Optocouplers
        7. 16.3.1.7. Solid State Relays
    4. 16.4. Digital Input/Output Expansion
      1. 16.4.1. Shift Registers As Outputs
      2. 16.4.2. Shift Registers As Inputs
    5. 16.5. Input Conditioning
      1. 16.5.1. Voltage Dividers and Nonisolated Input Conditioning
      2. 16.5.2. Isolated Input Conditioning
    6. 16.6. Inexpensive DIY Prototyping Shields
    7. 16.7. Writing an Arduino Library
      1. 16.7.1. Develop Functionality As a Sketch
      2. 16.7.2. Create the Library Header File
      3. 16.7.3. Create the Library Class File
      4. 16.7.4. Create the Example Sketch
      5. 16.7.5. Create Supporting Files
      6. 16.7.6. Platform-Specific Variations
    8. 16.8. Summary