You are previewing Arduino iOS Blueprints.
O'Reilly logo
Arduino iOS Blueprints

Book Description

Integrate the Arduino and iOS platforms to design amazing real-world projects to sense and control external devices

About This Book

  • Cover the most widely used methods in the Internet of Things using Arduino and iOS integration through Wi-Fi Shield and the BLE Breakout board

  • Design five real-world projects including of electronics, Arduino code, and an iOS application that seamlessly work together

  • A detailed guide that covers various sensors and actuators through which Arduino interacts with the world including a light sensor, hall effect sensor, accelerometer, servo motor, DC motor, and TRIAC for power line loads

  • Who This Book Is For

    This book is a technical guide for Arduino and iOS developers who have a basic knowledge of the two platforms but want to learn how to integrate them. The book includes a lot of external references to additional documentation and learning materials, so even if you are less experienced, you can improve your knowledge on the subjects covered.

    What You Will Learn

  • Design circuits with Arduino using sensors and actuators

  • Write code to handle analog and digital sensors with the most used protocols including OneWire, I2C, and SPI)

  • Store data on SD Card and in EEPROM

  • Build iOS applications using the MCV pattern and the UIKit components

  • Allow your applications to control Arduino and its hooked-up devices

  • Manage TCP/IP, UDP, and Bluetooth BLE communication between Arduino and iOS devices

  • Make your iOS application take advantage of the sensors available in the iOS devices including accelerometer, gyroscope, and compass

  • Develop iOS applications that use iBeacons

  • In Detail

    Arduino and iOS devices have reached wide popularity due to their simple way of use and flexibility. Hence, their integration opens up new opportunities, allowing everyone to build devices that are extremely useful in everyday life.

    You will first learn how to control Arduino from an iPhone or iPad by writing the Arduino sketch, the iOS application, and integrating everything together via Wi-Fi or Bluetooth BLE. You will then learn about various components that interact with the Arduino such as digital and analog I/O, Wi-Fi shield, Bluetooth BLE, SD card, OneWire, I2C, and so on. You will also learn about iOS, which includes the development of an application from scratch, GUI design and MVC, UIKit, iOS sensors, TCP and Bluetooth BLE communication, and more.

    All the projects are described in detail, providing you with a learning tool, not just some sketches or some iOS code to copy.

    Style and approach

    This is a project-based book with a step-by-step guide that covers everything that you need to build an Arduino-iOS project, right from defining the basic requirements to the coding and testing the entire project. Each chapter ends with ideas on how to improve the project and to constantly learn the topics covered.

    Downloading the example code for this book You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you.

    Table of Contents

    1. Arduino iOS Blueprints
      1. Table of Contents
      2. Arduino iOS Blueprints
      3. Credits
      4. About the Author
      5. About the Reviewers
      6. www.PacktPub.com
        1. Support files, eBooks, discount offers, and more
          1. Why subscribe?
          2. Free access for Packt account holders
      7. Preface
        1. What this book covers
        2. What you need for this book
        3. Who this book is for
        4. Conventions
        5. Reader feedback
        6. Customer support
          1. Downloading the example code
          2. Errata
          3. Piracy
          4. Questions
      8. 1. Arduino and iOS – Platforms and Integration
        1. Hardware and software requirements
          1. Hardware requirements for the Arduino platform
          2. Software requirements for the Arduino platform
          3. Hardware requirements for the iOS platform
          4. Software requirements for the iOS platform
        2. Arduino and the development environment setup
          1. IDE installation
        3. iOS and the development environment setup
          1. Xcode installation
        4. Communication methods between Arduino and iOS devices
          1. TCP/IP versus Bluetooth
        5. Summary
      9. 2. Bluetooth Pet Door Locker
        1. Door locker requirements
        2. Hardware
          1. Required materials and electronics components
          2. Assembly latch and servo motor
          3. Electronic circuit
        3. Arduino code
          1. Installing additional required libraries
          2. Initializing global variables and libraries
          3. Setup code
          4. Main program
          5. Testing and tuning the Arduino side
        4. iOS code
          1. Creating the Xcode project
          2. Designing the application user interface for BLEConnectionViewController
          3. Designing the application user interface for PetDoorLockerViewController
          4. Writing code for BLEConnectionViewController
          5. Writing code for PetDoorLockerViewController
          6. Testing the iOS app
        5. How to go further
        6. Different types of sensors
        7. Summary
      10. 3. Wi-Fi Power Plug
        1. Wi-Fi power plug requirements
        2. Hardware
          1. Additional electronics components
          2. Electronic circuit
        3. Arduino code
          1. Setup code
          2. Main program
        4. iOS code
          1. Creating the Xcode project
          2. Adding a new view controller
          3. Adding a class for storing the information of each activation
          4. Designing the application user interface for WiFiConnectionViewController
          5. Designing the application user interface for PowerPlugViewController
          6. Designing the application user interface for ActivationsTableViewController
          7. Writing code for the WiFiConnectionViewController
          8. Writing code for AppDelegate
          9. Writing code for PowerPlugViewController
          10. Writing code for ActivationsTableViewController
          11. Writing code for ActivationTableViewController
          12. Testing and tuning
        5. How to access the power plug from anywhere in the world
          1. Port forwarding
          2. Dynamic DNS
        6. How to go further
        7. Summary
      11. 4. iOS Guided Rover
        1. iOS guided rover requirements
        2. Hardware
          1. Additional electronic components
          2. What's an accelerometer?
          3. Electronic circuit
          4. How to make the rover turn
          5. How to mount the accelerometer
        3. Arduino code
          1. Setup code
          2. Motor control functions
          3. Main program
        4. iOS code
          1. Creating the Xcode project
          2. Writing code for BLEConnectionViewController
          3. Writing code for RoverViewController
            1. Code to control the rover manually
            2. Testing the Rover with manual driving
            3. Code for controlling the rover by the means of the iOS accelerometer
            4. Driving the rover by the means of the iOS device movement
            5. Code for controlling the rover by voice commands
            6. Driving the rover by voice commands
          4. Testing and tuning
        5. How to go further
        6. Summary
      12. 5. TV Set Constant Volume Controller
        1. Constant Volume Controller requirements
        2. Hardware
          1. Additional electronic components
          2. Electronic circuit
        3. Arduino code
          1. Decoder setup code
          2. Decoder main program
          3. Setup code
          4. Main program
        4. iOS code
          1. Creating the Xcode project
          2. Designing the user interface for VolumeControllerViewController
          3. Writing code for BLEConnectionViewController
          4. Writing code for VolumeControllerViewController
          5. Testing and tuning
        5. How to go further
        6. Summary
      13. 6. Automatic Garage Door Opener
        1. iBeacon – a technical overview
        2. The garage door opener requirements and design constraints
        3. Hardware
          1. Additional electronic components
          2. Electronic circuit
        4. Arduino code
          1. Setup code
          2. Main program
        5. iOS code
          1. Creating the Xcode project
          2. Designing the user interface for BLEConnectionViewController
          3. Designing the user interface for GarageViewController
          4. Designing the user interface for PinsViewController
          5. Writing code for BLEConnectionViewController
          6. Writing code for GarageViewController
          7. Writing code for PinsViewController
          8. Testing and tuning
        6. How to go further
        7. Summary
      14. Index