iOS Hardware as a Sensor Platform: DMM Case Study

Daniel Brateris Dwight Bedford, David Calhoun, Aaron Johnson, Atlanticus Innovations Nickolas Kowalski, Kelli Martino, Thomas Mukalian, 1082 Sky Hill Road Justin Reda, Anthony Samaritano and Robert R. Krchnavek Bridgewater, New Jersey 08807 Rowan University Email: [email protected] Glassboro, New Jersey USA http://www.atlanticusinnovations.com/contact Email: [email protected]

Abstract—iOS is Apple’s mobile operating system and is communication hardware and functional user interfaces. In presently used on the iPhone, iPad, and iPod Touch. The hard- this context, an accessory is an attachment to the iOS hard- ware platforms associated with the iOS operating system provide ware. The attachment can be physical through the 30-pin a powerful platform for sensor applications. In this paper, we provide a case study on the development of a digital multimeter dock connector (UART serial data transfer or USB 2.0 data (DMM) using an iPod Touch. The DMM case study addresses the transfer) or virtual through a wireless (Bluetooth) connection major subsystems (hardware, software, and firmware) of a typical [2]. The accessory would contain the sensing elements as sensor platform and specific advantages of implementation using well as associated hardware. The designer can focus on the an iOS device. development of the electronics and instrumentation within the accessory. Once data is digitized or the control process can I.INTRODUCTION accept digital commands, then the device can be hooked up An embedded sensor system can often utilize a relatively to an iOS device to exchange data and be configured and simple, low-cost microcontroller to achieve the required mea- controlled. The device gains all the functionality offered by surement functionality. However, as the sensor increases in the iOS operating system. complexity, requiring network connectivity or a graphical user Apple’s iOS operating system is used on over 82 million interface, the processor requirements increase significantly and products. It has become one of the most ubiquitous operating so does development time. Communication protocols such as systems/hardware platforms. WiFi, Ethernet, and 3G require a large processing overhead. Some advantages: Graphical user interfaces have similar overheads while the • Low cost. An iPhone can be purchased for $200 (with core processing requirements of the sensor application remain a wireless plan). An iPod Touch running iOS can be relatively simple. purchased for $229. Developing sensor applications using Apple’s iOS system • Communications. An iPhone comes complete with Wi-Fi offers several advantages over traditional, high-performance, and 3G communication capabilities built in. An iPhone embedded system development. The combined feature set also includes Bluetooth technology. An iPod does not of the iOS operating system and associated devices offer a have 3G capability, but does include Bluetooth and Wi-Fi. highly attractive platform for embedded development. The • Camera/video and audio interface. core features offered in iOS devices are a high performance • Easy updates and distribution via the iTunes store or a ARM CPU, power supply, battery management, WiFi support, private distribution server. 3G support, rich touch-based user interface support and many • Software-defined interface. more. • Rigidly controlled and documented development tools. The iOS operating system is a fully featured modern oper- ating system, which is extensively documented and fully sup- II.CASE STUDY:DEVELOPMENTOFANIOS-BASED DMM ported by Apple Inc. Offering more functionality for a lower development cost than many embedded operating systems, iOS The development of an iOS-based digital multimeter provides a unique alternative. Additionally, there are thousands (DMM) provides a comprehensive study of using iOS-based of application examples and hundreds of books written on devices for sensor platforms. Figure 1 is a block diagram indi- developing iOS applications. Overall, the operating system is cating the required subsystems for an iOS-based DMM. There state of the art and the hardware is proven, affordable, and are 4 essential subsystems. First, to attach a hardware device readily available [1]. to an iOS system, Apple requires an authentication routine Using an iOS accessory as the processing and connec- to be performed. Second, the attached hardware requires a tivity portion of a system will allow the designer to avoid microcontroller to handle communications between the iOS the difficulties normally encountered in developing reliable device and the sensor. Third, the sensor, in this case a DMM,

978-1-4244-8064-7/11/$26.00 ©2011 IEEE is required. And finally, an interface needs to be developed for B. DMM Development the iOS. Details on these subsystems are presented below. Single-chip solutions, e.g., Maxim 133, exist for DMM products. Unfortunately, we did not find a chip that worked Accessory Inputs and Outputs at less than 9 volts. For example, the MAX133 required a 9 V supply [5]. The voltage supplied from the connector on the iPod Touch is 3.3 V. Therefore, a system requiring 9 V would Sensor Elements either require a separate battery in the accessory or a DC/DC and Instrumentation Electronics boost conversion circuit to raise the voltage. Adding a separate 9 V battery significantly increases the size of the accessory. Even watch-type batteries in series add to the size of the accessory. A booster circuit has a minimal impact on size, but Accessory could potentially cause RF noise problems. These problems Microcontroller Authentication can cause performance issues when used with cellular devices Hardware like the iPhone. A second problem with using the MAX133 for this appli- cation is the inability to write information to the registers on 30-Pin Connector (USB, UART) or Bluetooth the device to control its functions. Our goal was to use the same microcontroller required for authentication to control the accessory. The MAX133 is primarily designed to be controlled 30-Pin Connector (USB, UART) or Bluetooth using a rotary switch. This significantly complicated the design goal of using a microcontroller to set the functions. WiFi and 3G With this in mind, we decided to create the DMM using a Operating System User Interface analog MUX to select resistor values followed by an ADC.

iOS Hardware iOS The schematic of the DMM is shown in Fig. 2. Final part numbers, values, and DMM performance will be presented at Fig. 1. A block diagram indicating the major subsystems of the accessory SAS and in the final manuscript. and the iOS hardware.

A. Authentication Membership in the Apple Made for iOS (MFi) program gives the licensed company access to the resources necessary to design, build and test an iOS accessory. This includes hard- ware components, technical documentation, technical support, and certification logos. After joining this program a licensed developer can build accessories that communicate with iOS applications through the 30-pin dock connector over USB, UART serial, or wirelessly over Bluetooth. Developers also have access to Developer Technical Support and Compatibility Labs to assist in product development and testing [3]. Membership in the program is a simple process and requires a day or two of effort between your company and Apple Inc. The technical materials required for development are confidential so your company must sign an NDA with Apple. Fig. 2. Schematic representation of the DMM circuit. Once completed, developing an accessory is a relatively easy process requiring a basic knowledge of microprocessors and a few simple communication protocols [2]. C. Microcontroller – Atmel AVR Mega Series Authentication is Apples unique way of controlling what devices are allowed to communicate with iOS applications The processor is the center of the accessory; it manages and Apple devices. Registered MFi developers have access communication between the iOS device and the electronics in to a microchip called the Authentication Coprocessor [4]. the accessory. For the DMM an Atmel AVR microprocessor This device stores proprietary algorithms and keys required was selected because of its low cost and relatively high for the authentication process. Details on the authentication performance in the 8-bit MCU realm. Selection of a processor process are provided to MFi members and development kits is entirely up to the designer of the accessory, only a few are available to speed product development [3]. criteria need to be met. For this design the criteria were: • At least one UART interface with simultaneous bi- are developed or the privacy of your protocols. This means directional support. an accessory can be developed to use a private or public 2 • Hardware I C or SPI support. protocol. As an example, the initial DMM accessory uses a • Extremely low power consumption. basic application that functions as a standard DMM. If we • Minimum of a 10-Bit linear ADC with multiple ADC were to publish our protocol, companies could develop their channels. own iOS applications to work with our DMM accessory. If a • Flexible boot loader with UART support for field company wanted a long term voltage recording system, they firmware upgrades. could design an iOS application to read and record the data • Flexible interrupt controller. over time and then send the data to a server every day. This • Minimal required external components and internal os- application could be built using the already existing DMM cillator. that we supply. From a business standpoint, we could choose • Freely available and documented development tools [6]. to make the protocols freely available, or charge a fee for The MegaAVR series met all the criteria and at an ac- access to the protocol specification. ceptable price point for production. Additionally, many com- III.TESTING mercially available microcontrollers meet the baseline criteria needed to build an iOS accessory, this makes the design RF testing including measuring total radiated power (TRP) process very flexible. Many microcontroller based systems can as well as effective isotropic sensitivity (EIS) must be per- be converted to work as iOS accessories in their current con- formed for an iOS accessory to be certified to work with figuration with only minor hardware and firmware additions. an iPhone; minimal or no RF testing may be required for accessories that only work with WiFi devices. EIS testing must D. iOS Software/Interface be performed over the operating frequencies, includ- One of the most powerful aspects of using iOS hardware ing RS testing – relative sensitivity on intermediate channels. as a sensor platform is the soft interface. In the case study of Although the DUT may be tested with varying devices among developing a DMM, we have created a simple user interface the different iPhone, iPod Touch, and iPad models, TRP and that resembles a common design for a commercial DMM EIS measurement parameters are standardized for devices that (Figure 3). We have also created a much more sophisticated operate on GSM 850, GSM 950, GSM 1800, GSM 1900, and UTMS I, II, & V frequency bands. Specific values for maximum allowable degradation of signal measured from iOS device versus iOS device operating in conjunction with the DUT are specified for frequencies among these bands, ranging 824.2 MHZ to 2140 MHz. Preliminary testing of the DUT will include near and far field testing with antennae/probes tuned for all testing frequencies within our current frequency testing capabilities. Ultimately, for an accessory to be certified, testing needs to be accomplished by an independent vendor. In addition to the required RF testing, we will conduct accuracy, repeatability, and power consumption tests on the DMM prototype. These will be concluded before the final manuscript is due.

IV. CONCLUSION Fig. 3. The user interface on an iPod Touch for the simple DMM accessory. iOS hardware provides a unique platform for sensor ap- plications. iOS hardware includes a complete microcontroller design that has numerous additional features. In this interface, system, with wireless and wire capable networking, user- the user can store readings in registers that will be recalled defined touch-screen interface, and audio/video input/output. later. The interface has a strip chart recorder function so that Development tools are rigidily controlled and well docu- measurements are taken over time. Additional features that can mented. Finally, iOS hardware is relatively inexpensive – an be implemented are voice commands, (e.g., using a bluetooth iPod Touch can be purchased for $229. Using this technol- headset for noisy environments), talking measurements, and ogy allows the engineer to concentrate efforts on designing connectivity to the internet for remote control of the measure- the sensor subsystem – the accessory as referred to in this ments. document. We have demonstrated this approach by designing, 1) Protocol Development: Once an accessory meets Apples building, and testing a digital multimeter (DMM). While a specifications it needs to communicate with the iOS appli- simple sensor application, the accessory consists of all of the cation. Apple suggests developing your own communication subsystems that would be required for more sophisticated sen- protocol to pass messages between the iOS application and sor systems. In particular, the microcontroller in the accessory the accessory. Apple does not restrict how your protocols is responsible for communicating with the iOS hardware and the sensor element. The microcontroller is also responsible for authenticating the accessory with the iOS hardware. Complete test results will be presented at the SAS confer- ence and in the final manuscript

REFERENCES [1] David Mark and Jeff LaMarche, Beginning iPhone 3 Development Ex- ploring the iPhone SDK, California, USA: Apress, 2009. [2] Ken Maskrey, Building iPhone OS Accessories, California, USA: Apress, 2010. [3] Apple Inc, MFi Program Public Information Webpage, http://developer.apple.com/programs/mfi California, USA: Apple Inc., 2010. [4] CSR plc, Made for iPhone Web Page, http://www.csr.com/products/34/made-for-iphone [5] Maxim Integrated Products, MAX133/MAX134 Datasheet, California, USA: Maxim, 1995. [6] Atmel Corporation, ATMega168 Datasheet, California, USA: Atmel, 2010.