O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

iOS Sensor Apps with Arduino

Book Description

Turn your iPhone or iPad into the hub of a distributed sensor network with the help of an Arduino microcontroller. With this concise guide, you’ll learn how to connect an external sensor to an iOS device and have them talk to each other through Arduino. You’ll also build an iOS application that will parse the sensor values it receives and plot the resulting measurements, all in real-time.

iOS processes data from its own onboard sensors, and now you can extend its reach with this simple, low-cost project. If you're an Objective-C programmer who likes to experiment, this book explains the basics of Arduino and other hardware components you need—and lets you have fun in the process.

  • Learn how to connect the Arduino platform to any iOS device
  • Build a simple application to control your Arduino directly from an iPad
  • Gather measurements from an ultrasonic range finder and display them on your iPhone
  • Connect an iPhone, iPad, or iPod Touch to an XBee radio network
  • Explore other methods for connecting external sensors to iOS, including Ethernet and the MIDI protocol

Table of Contents

  1. A Note Regarding Supplemental Files
  2. Preface
    1. Who Should Read This Book?
    2. What Should You Already Know?
    3. What Will You Learn?
    4. What’s in This Book?
    5. Conventions Used in This Book
    6. Using Code Examples
    7. Safari® Books Online
    8. How to Contact Us
    9. Acknowledgments
  3. 1. Introduction to the Arduino
    1. The Arduino
      1. Powering the Board
      2. Input and Output
      3. Communicating with the Board
      4. Installing the Software
      5. Connecting to the Board
    2. Blinking an LED
      1. Uploading the Sketch
    3. Making a Serial Connection
    4. Summary
  4. 2. Connecting the iPhone to the Arduino
    1. The Apple MFi Program
    2. The Redpark Serial Cable
      1. Testing the Cable
    3. Connecting to the Arduino
    4. Connecting to an iOS Device
    5. A Simple Serial Application
      1. Adding the Redpark Serial Library
      2. Connecting the Arduino
      3. Sending Data Back to the Arduino
    6. Log Messages
    7. Summary
  5. 3. Controlling the Arduino from the iPad
    1. An Arduino on Your iPad
      1. Adding the Serial Library
      2. Building the User Interface
      3. Integrating the Serial Library
    2. Listening for Messages on the Arduino
    3. Putting It All Together
    4. Going Further
      1. Adding a Log Window
    5. Summary
  6. 4. Using External Sensors from the iPhone
    1. The LV-MaxSonar-EZ1
      1. Analog Output
      2. Pulse Width Output
      3. RS-232 Serial Output
    2. MaxSonar Range Finder for iPhone
      1. Adding the Serial Library
      2. The CorePlot Library
        1. Compiling the Core Plot library from source code
        2. Adding the Core Plot library to the project
      3. Building the User Interface
      4. Building the Backend
      5. Writing the Arduino Sketch
      6. Putting It All Together
      7. Turning Things On and Off
    3. Connecting Directly to the Cable
  7. 5. Connecting to an XBee Network
    1. XBee Modules
      1. Series 1 or Series 2?
      2. Regular Versus Pro?
      3. 802.15.4 or ZigBee?
      4. Which Aerial?
    2. How to Configure an XBee Series 1 Radio
      1. Connecting the XBee to Your Mac
      2. XBee Addressing
    3. Configuring Two XBee Radios
    4. Connecting an XBee to an Arduino
    5. Connecting an XBee to an iOS Device
      1. XBee to RS-232 Serial
    6. Going Further
  8. 6. Other Ways to Connect
    1. Using the Network
      1. Using Ethernet
      2. Using WiFi
    2. Using a Soft Modem
      1. Switch Science Board
      2. HiJack Board
    3. Using the MIDI Protocol
      1. The HIDDUINO
    4. Summary
  9. About the Author
  10. Copyright